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" };
@@ -137,6 +139,9 @@ struct OnTheFlyRichPid {
137139 Configurable<std::string> lutPi{" lutPi" , " inherit" , " LUT for pions (if inherit, inherits from otf tracker task)" };
138140 Configurable<std::string> lutKa{" lutKa" , " inherit" , " LUT for kaons (if inherit, inherits from otf tracker task)" };
139141 Configurable<std::string> lutPr{" lutPr" , " inherit" , " LUT for protons (if inherit, inherits from otf tracker task)" };
142+ Configurable<std::string> lutDe{" lutDe" , " inherit" , " LUT for deuterons (if inherit, inherits from otf tracker task)" };
143+ Configurable<std::string> lutTr{" lutTr" , " inherit" , " LUT for tritons (if inherit, inherits from otf tracker task)" };
144+ Configurable<std::string> lutHe3{" lutHe3" , " inherit" , " LUT for helions (if inherit, inherits from otf tracker task)" };
140145 } simConfig;
141146
142147 o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
@@ -304,47 +309,31 @@ struct OnTheFlyRichPid {
304309 LOG (info) << " Bz = " << magneticField.value << " T" ;
305310 }
306311
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-
322312 // Load LUT for pt and eta smearing
323313 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 ;
314+ mSmearer .setCcdbManager (ccdb.operator ->());
315+ auto loadLUT = [&](int pdg, Configurable<std::string>& lut) {
316+ if (lut.value != " inherit" ) {
317+ return ;
346318 }
347- }
319+ if (!getTaskOptionValue (initContext, " on-the-fly-tracker" , lut, false )) {
320+ LOG (fatal) << " Could not get " << lut.name << " from on-the-fly-tracker task" ;
321+ }
322+ std::string lutFile = lut.value ;
323+
324+ bool success = mSmearer .loadTable (pdg, lutFile.c_str ());
325+ if (!success && !lutFile.empty ()) {
326+ LOG (fatal) << " Having issue with loading the LUT " << pdg << " " << lutFile;
327+ }
328+ };
329+ loadLUT (11 , simConfig.lutEl );
330+ loadLUT (13 , simConfig.lutMu );
331+ loadLUT (211 , simConfig.lutPi );
332+ loadLUT (321 , simConfig.lutKa );
333+ loadLUT (2212 , simConfig.lutPr );
334+ loadLUT (1000010020 , simConfig.lutDe );
335+ loadLUT (1000010030 , simConfig.lutTr );
336+ loadLUT (1000020030 , simConfig.lutHe3 );
348337 }
349338
350339 if (doQAplots) {
0 commit comments