Skip to content

Commit b70855b

Browse files
authored
[ALICE3] A3: Update LUT fetching in TOF and RICH (#13080)
- remove configurable
1 parent 5d13187 commit b70855b

File tree

2 files changed

+87
-136
lines changed

2 files changed

+87
-136
lines changed

ALICE3/TableProducer/OTF/onTheFlyRichPid.cxx

Lines changed: 44 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,31 @@
3838
#include "Common/Core/trackUtilities.h"
3939
#include "Common/DataModel/TrackSelectionTables.h"
4040

41-
#include "CCDB/BasicCCDBManager.h"
42-
#include "CCDB/CcdbApi.h"
43-
#include "CommonConstants/GeomConstants.h"
44-
#include "CommonConstants/MathConstants.h"
45-
#include "CommonConstants/PhysicsConstants.h"
46-
#include "CommonUtils/NameConf.h"
47-
#include "DataFormatsCalibration/MeanVertexObject.h"
48-
#include "DataFormatsParameters/GRPMagField.h"
49-
#include "DetectorsBase/GeometryManager.h"
50-
#include "DetectorsBase/Propagator.h"
51-
#include "DetectorsVertexing/HelixHelper.h"
52-
#include "Framework/ASoAHelpers.h"
53-
#include "Framework/AnalysisDataModel.h"
54-
#include "Framework/AnalysisTask.h"
55-
#include "Framework/HistogramRegistry.h"
56-
#include "Framework/O2DatabasePDGPlugin.h"
57-
#include "Framework/RunningWorkflowInfo.h"
58-
#include "Framework/runDataProcessing.h"
59-
#include "ReconstructionDataFormats/DCA.h"
60-
#include "ReconstructionDataFormats/PID.h"
61-
62-
#include "TRandom3.h"
63-
#include "TString.h"
64-
#include "TVector3.h"
41+
#include <CCDB/BasicCCDBManager.h>
42+
#include <CCDB/CcdbApi.h>
43+
#include <CommonConstants/GeomConstants.h>
44+
#include <CommonConstants/MathConstants.h>
45+
#include <CommonConstants/PhysicsConstants.h>
46+
#include <CommonUtils/NameConf.h>
47+
#include <DataFormatsCalibration/MeanVertexObject.h>
48+
#include <DataFormatsParameters/GRPMagField.h>
49+
#include <DetectorsBase/GeometryManager.h>
50+
#include <DetectorsBase/Propagator.h>
51+
#include <DetectorsVertexing/HelixHelper.h>
52+
#include <Framework/ASoAHelpers.h>
53+
#include <Framework/AnalysisDataModel.h>
54+
#include <Framework/AnalysisTask.h>
55+
#include <Framework/HistogramRegistry.h>
56+
#include <Framework/O2DatabasePDGPlugin.h>
57+
#include <Framework/RunningWorkflowInfo.h>
58+
#include <Framework/runDataProcessing.h>
59+
#include <ReconstructionDataFormats/DCA.h>
60+
#include <ReconstructionDataFormats/PID.h>
61+
6562
#include <TPDGCode.h>
63+
#include <TRandom3.h>
64+
#include <TString.h>
65+
#include <TVector3.h>
6666

6767
#include <cmath>
6868
#include <map>
@@ -80,6 +80,8 @@ struct OnTheFlyRichPid {
8080

8181
// necessary for particle charges
8282
Service<o2::framework::O2DatabasePDG> pdg;
83+
// Necessary for LUTs
84+
Service<o2::ccdb::BasicCCDBManager> ccdb;
8385

8486
// master setting: magnetic field
8587
Configurable<float> magneticField{"magneticField", 0, "magnetic field (kilogauss) if 0, taken from the tracker task"};
@@ -131,14 +133,6 @@ struct OnTheFlyRichPid {
131133
Configurable<float> bRICHPixelSize{"bRICHPixelSize", 0.1, "barrel RICH pixel size (cm)"};
132134
Configurable<float> bRichGapRefractiveIndex{"bRichGapRefractiveIndex", 1.000283, "barrel RICH gap refractive index"};
133135

134-
struct : ConfigurableGroup {
135-
Configurable<std::string> lutEl{"lutEl", "inherit", "LUT for electrons (if inherit, inherits from otf tracker task)"};
136-
Configurable<std::string> lutMu{"lutMu", "inherit", "LUT for muons (if inherit, inherits from otf tracker task)"};
137-
Configurable<std::string> lutPi{"lutPi", "inherit", "LUT for pions (if inherit, inherits from otf tracker task)"};
138-
Configurable<std::string> lutKa{"lutKa", "inherit", "LUT for kaons (if inherit, inherits from otf tracker task)"};
139-
Configurable<std::string> lutPr{"lutPr", "inherit", "LUT for protons (if inherit, inherits from otf tracker task)"};
140-
} simConfig;
141-
142136
o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
143137

144138
// Track smearer (here used to get relative pt and eta uncertainties)
@@ -304,47 +298,27 @@ struct OnTheFlyRichPid {
304298
LOG(info) << "Bz = " << magneticField.value << " T";
305299
}
306300

307-
// Check if inheriting the LUT configuration
308-
auto configLutPath = [&](Configurable<std::string>& lut) {
309-
if (lut.value != "inherit") {
310-
return;
311-
}
312-
if (!getTaskOptionValue(initContext, "on-the-fly-tracker", lut, false)) {
313-
LOG(fatal) << "Could not get " << lut.name << " from on-the-fly-tracker task";
314-
}
315-
};
316-
configLutPath(simConfig.lutEl);
317-
configLutPath(simConfig.lutMu);
318-
configLutPath(simConfig.lutPi);
319-
configLutPath(simConfig.lutKa);
320-
configLutPath(simConfig.lutPr);
321-
322301
// Load LUT for pt and eta smearing
323302
if (flagIncludeTrackAngularRes && flagRICHLoadDelphesLUTs) {
324-
std::map<int, const char*> mapPdgLut;
325-
const char* lutElChar = simConfig.lutEl->c_str();
326-
const char* lutMuChar = simConfig.lutMu->c_str();
327-
const char* lutPiChar = simConfig.lutPi->c_str();
328-
const char* lutKaChar = simConfig.lutKa->c_str();
329-
const char* lutPrChar = simConfig.lutPr->c_str();
330-
331-
LOGF(info, "Will load electron lut file ..: %s for RICH PID", lutElChar);
332-
LOGF(info, "Will load muon lut file ......: %s for RICH PID", lutMuChar);
333-
LOGF(info, "Will load pion lut file ......: %s for RICH PID", lutPiChar);
334-
LOGF(info, "Will load kaon lut file ......: %s for RICH PID", lutKaChar);
335-
LOGF(info, "Will load proton lut file ....: %s for RICH PID", lutPrChar);
336-
337-
mapPdgLut.insert(std::make_pair(11, lutElChar));
338-
mapPdgLut.insert(std::make_pair(13, lutMuChar));
339-
mapPdgLut.insert(std::make_pair(211, lutPiChar));
340-
mapPdgLut.insert(std::make_pair(321, lutKaChar));
341-
mapPdgLut.insert(std::make_pair(2212, lutPrChar));
342-
343-
for (const auto& e : mapPdgLut) {
344-
if (!mSmearer.loadTable(e.first, e.second)) {
345-
LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second;
303+
mSmearer.setCcdbManager(ccdb.operator->());
304+
auto loadLUT = [&](int pdg, const std::string& cfgNameToInherit) {
305+
std::string lut = "none";
306+
if (!getTaskOptionValue(initContext, "on-the-fly-tracker", cfgNameToInherit, lut, false)) {
307+
LOG(fatal) << "Could not get " << cfgNameToInherit << " from on-the-fly-tracker task";
346308
}
347-
}
309+
bool success = mSmearer.loadTable(pdg, lut.c_str());
310+
if (!success && !lut.empty()) {
311+
LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << lut;
312+
}
313+
};
314+
loadLUT(11, "lutEl");
315+
loadLUT(13, "lutMu");
316+
loadLUT(211, "lutPi");
317+
loadLUT(321, "lutKa");
318+
loadLUT(2212, "lutPr");
319+
loadLUT(1000010020, "lutDe");
320+
loadLUT(1000010030, "lutTr");
321+
loadLUT(1000020030, "lutHe3");
348322
}
349323

350324
if (doQAplots) {

ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx

Lines changed: 43 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,30 @@
3232
#include "Common/Core/trackUtilities.h"
3333
#include "Common/DataModel/TrackSelectionTables.h"
3434

35-
#include "CCDB/BasicCCDBManager.h"
36-
#include "CCDB/CcdbApi.h"
37-
#include "CommonConstants/GeomConstants.h"
38-
#include "CommonConstants/MathConstants.h"
39-
#include "CommonConstants/PhysicsConstants.h"
40-
#include "CommonUtils/NameConf.h"
41-
#include "DataFormatsCalibration/MeanVertexObject.h"
42-
#include "DataFormatsParameters/GRPMagField.h"
43-
#include "DetectorsBase/GeometryManager.h"
44-
#include "DetectorsBase/Propagator.h"
45-
#include "DetectorsVertexing/HelixHelper.h"
46-
#include "Framework/ASoAHelpers.h"
47-
#include "Framework/AnalysisDataModel.h"
48-
#include "Framework/AnalysisTask.h"
49-
#include "Framework/HistogramRegistry.h"
50-
#include "Framework/O2DatabasePDGPlugin.h"
51-
#include "Framework/RunningWorkflowInfo.h"
52-
#include "Framework/runDataProcessing.h"
53-
#include "ReconstructionDataFormats/DCA.h"
54-
55-
#include "TEfficiency.h"
56-
#include "THashList.h"
57-
#include "TRandom3.h"
35+
#include <CCDB/BasicCCDBManager.h>
36+
#include <CCDB/CcdbApi.h>
37+
#include <CommonConstants/GeomConstants.h>
38+
#include <CommonConstants/MathConstants.h>
39+
#include <CommonConstants/PhysicsConstants.h>
40+
#include <CommonUtils/NameConf.h>
41+
#include <DataFormatsCalibration/MeanVertexObject.h>
42+
#include <DataFormatsParameters/GRPMagField.h>
43+
#include <DetectorsBase/GeometryManager.h>
44+
#include <DetectorsBase/Propagator.h>
45+
#include <DetectorsVertexing/HelixHelper.h>
46+
#include <Framework/ASoAHelpers.h>
47+
#include <Framework/AnalysisDataModel.h>
48+
#include <Framework/AnalysisTask.h>
49+
#include <Framework/HistogramRegistry.h>
50+
#include <Framework/O2DatabasePDGPlugin.h>
51+
#include <Framework/RunningWorkflowInfo.h>
52+
#include <Framework/runDataProcessing.h>
53+
#include <ReconstructionDataFormats/DCA.h>
54+
55+
#include <TEfficiency.h>
56+
#include <THashList.h>
5857
#include <TPDGCode.h>
58+
#include <TRandom3.h>
5959

6060
#include <map>
6161
#include <string>
@@ -81,6 +81,8 @@ struct OnTheFlyTofPid {
8181

8282
// necessary for particle charges
8383
Service<o2::framework::O2DatabasePDG> pdg;
84+
// Necessary for LUTs
85+
Service<o2::ccdb::BasicCCDBManager> ccdb;
8486

8587
// these are the settings governing the TOF layers to be used
8688
// note that there are two layers foreseen for now: inner and outer TOF
@@ -97,11 +99,6 @@ struct OnTheFlyTofPid {
9799
Configurable<float> multiplicityEtaRange{"multiplicityEtaRange", 0.800000012, "eta range to compute the multiplicity"};
98100
Configurable<bool> flagIncludeTrackTimeRes{"flagIncludeTrackTimeRes", true, "flag to include or exclude track time resolution"};
99101
Configurable<bool> flagTOFLoadDelphesLUTs{"flagTOFLoadDelphesLUTs", false, "flag to load Delphes LUTs for tracking correction (use recoTrack parameters if false)"};
100-
Configurable<std::string> lutEl{"lutEl", "inherit", "LUT for electrons (if inherit, inherits from otf tracker task)"};
101-
Configurable<std::string> lutMu{"lutMu", "inherit", "LUT for muons (if inherit, inherits from otf tracker task)"};
102-
Configurable<std::string> lutPi{"lutPi", "inherit", "LUT for pions (if inherit, inherits from otf tracker task)"};
103-
Configurable<std::string> lutKa{"lutKa", "inherit", "LUT for kaons (if inherit, inherits from otf tracker task)"};
104-
Configurable<std::string> lutPr{"lutPr", "inherit", "LUT for protons (if inherit, inherits from otf tracker task)"};
105102
} simConfig;
106103

107104
struct : ConfigurableGroup {
@@ -151,47 +148,27 @@ struct OnTheFlyTofPid {
151148
LOG(info) << "Bz = " << simConfig.magneticField.value << " T";
152149
}
153150

154-
// Check if inheriting the LUT configuration
155-
auto configLutPath = [&](Configurable<std::string>& lut) {
156-
if (lut.value != "inherit") {
157-
return;
158-
}
159-
if (!getTaskOptionValue(initContext, "on-the-fly-tracker", lut, false)) {
160-
LOG(fatal) << "Could not get " << lut.name << " from on-the-fly-tracker task";
161-
}
162-
};
163-
configLutPath(simConfig.lutEl);
164-
configLutPath(simConfig.lutMu);
165-
configLutPath(simConfig.lutPi);
166-
configLutPath(simConfig.lutKa);
167-
configLutPath(simConfig.lutPr);
168-
169151
// Load LUT for pt and eta smearing
170152
if (simConfig.flagIncludeTrackTimeRes && simConfig.flagTOFLoadDelphesLUTs) {
171-
std::map<int, const char*> mapPdgLut;
172-
const char* lutElChar = simConfig.lutEl->c_str();
173-
const char* lutMuChar = simConfig.lutMu->c_str();
174-
const char* lutPiChar = simConfig.lutPi->c_str();
175-
const char* lutKaChar = simConfig.lutKa->c_str();
176-
const char* lutPrChar = simConfig.lutPr->c_str();
177-
178-
LOGF(info, "Will load electron lut file ..: %s for TOF PID", lutElChar);
179-
LOGF(info, "Will load muon lut file ......: %s for TOF PID", lutMuChar);
180-
LOGF(info, "Will load pion lut file ......: %s for TOF PID", lutPiChar);
181-
LOGF(info, "Will load kaon lut file ......: %s for TOF PID", lutKaChar);
182-
LOGF(info, "Will load proton lut file ....: %s for TOF PID", lutPrChar);
183-
184-
mapPdgLut.insert(std::make_pair(11, lutElChar));
185-
mapPdgLut.insert(std::make_pair(13, lutMuChar));
186-
mapPdgLut.insert(std::make_pair(211, lutPiChar));
187-
mapPdgLut.insert(std::make_pair(321, lutKaChar));
188-
mapPdgLut.insert(std::make_pair(2212, lutPrChar));
189-
190-
for (const auto& e : mapPdgLut) {
191-
if (!mSmearer.loadTable(e.first, e.second)) {
192-
LOG(fatal) << "Having issue with loading the LUT " << e.first << " " << e.second;
153+
mSmearer.setCcdbManager(ccdb.operator->());
154+
auto loadLUT = [&](int pdg, const std::string& cfgNameToInherit) {
155+
std::string lut = "none";
156+
if (!getTaskOptionValue(initContext, "on-the-fly-tracker", cfgNameToInherit, lut, false)) {
157+
LOG(fatal) << "Could not get " << cfgNameToInherit << " from on-the-fly-tracker task";
193158
}
194-
}
159+
bool success = mSmearer.loadTable(pdg, lut.c_str());
160+
if (!success && !lut.empty()) {
161+
LOG(fatal) << "Having issue with loading the LUT " << pdg << " " << lut;
162+
}
163+
};
164+
loadLUT(11, "lutEl");
165+
loadLUT(13, "lutMu");
166+
loadLUT(211, "lutPi");
167+
loadLUT(321, "lutKa");
168+
loadLUT(2212, "lutPr");
169+
loadLUT(1000010020, "lutDe");
170+
loadLUT(1000010030, "lutTr");
171+
loadLUT(1000020030, "lutHe3");
195172
}
196173

197174
if (plotsConfig.doQAplots) {

0 commit comments

Comments
 (0)