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) {
0 commit comments