5656using namespace o2 ;
5757using namespace o2 ::framework;
5858
59- static constexpr double kMinMomentumForLogBins = 0.05 ;
60- static constexpr double kMaxMomentumForLogBins = 10.0 ;
59+ static constexpr double MinMomentumForLogBins = 0.05 ;
60+ static constexpr double MaxMomentumForLogBins = 10.0 ;
6161
6262// / Local path of a LUT file; "ccdb:<path>" is downloaded once to /tmp/ToTLUTs/<path>/snapshot.root
6363std::string getLocalLutFile (const std::string& filename, o2::ccdb::BasicCCDBManager* ccdbManager)
@@ -114,7 +114,7 @@ class TrackDedxLut
114114 const size_t nDedx = mDedxEdges .size () - 1 ;
115115
116116 bool allLoaded = true ;
117- for (const int pdg : pdgCodes) {
117+ for (const auto & pdg : pdgCodes) {
118118 std::unique_ptr<std::vector<float >> h (f->Get <std::vector<float >>(Form (" h_%d" , pdg)));
119119 if (!h || h->size () != nBins * nDedx) {
120120 LOG (warning) << " No dE/dx LUT for PDG " << pdg << " in " << filename;
@@ -205,16 +205,16 @@ class TrackDedxLut
205205};
206206
207207struct OnTheFlyTrackerPid {
208- static constexpr int kNumSpecies = 9 ;
209- static constexpr std::array<int , kNumSpecies > kPdgCodes = {11 , 13 , 211 , 321 , 2212 , 1000010020 , 1000010030 , 1000020030 , 1000020040 };
210- static constexpr std::array<const char *, kNumSpecies > kNames = {" Elec" , " Muon" , " Pion" , " Kaon" , " Prot" , " Deut" , " Trit" , " He3" , " Al" };
211- static constexpr std::array<const char *, kNumSpecies > kPrettyNames = {" #it{e}" , " #it{#mu}" , " #it{#pi}" , " #it{K}" , " #it{p}" , " #it{d}" , " #it{t}" , " #it{^{3}He}" , " #it{^{4}He}" };
208+ static constexpr int NumSpecies = 9 ;
209+ static constexpr std::array<int , NumSpecies> PdgCodes = {11 , 13 , 211 , 321 , 2212 , 1000010020 , 1000010030 , 1000020030 , 1000020040 };
210+ static constexpr std::array<const char *, NumSpecies> SpeciesNames = {" Elec" , " Muon" , " Pion" , " Kaon" , " Prot" , " Deut" , " Trit" , " He3" , " Al" };
211+ static constexpr std::array<const char *, NumSpecies> SpeciesLabels = {" #it{e}" , " #it{#mu}" , " #it{#pi}" , " #it{K}" , " #it{p}" , " #it{d}" , " #it{t}" , " #it{^{3}He}" , " #it{^{4}He}" };
212212
213- std::array<std::shared_ptr<TH2 >, kNumSpecies > h2dToTvsPperParticle;
214- std::array<std::shared_ptr<TH2 >, kNumSpecies > h2dToTvsPperParticleLin;
215- std::array<std::shared_ptr<TH3 >, kNumSpecies > h3dToTvsPEtaPerParticle;
216- std::array<std::shared_ptr<TH2 >, kNumSpecies > h2dTracks;
217- std::array<std::shared_ptr<TH2 >, kNumSpecies > h2dTracksWithDedx;
213+ std::array<std::shared_ptr<TH2 >, NumSpecies > h2dToTvsPperParticle;
214+ std::array<std::shared_ptr<TH2 >, NumSpecies > h2dToTvsPperParticleLin;
215+ std::array<std::shared_ptr<TH3 >, NumSpecies > h3dToTvsPEtaPerParticle;
216+ std::array<std::shared_ptr<TH2 >, NumSpecies > h2dTracks;
217+ std::array<std::shared_ptr<TH2 >, NumSpecies > h2dTracksWithDedx;
218218
219219 Service<o2::framework::O2DatabasePDG> pdgDatabase{};
220220 Service<o2::ccdb::BasicCCDBManager> ccdb{};
@@ -249,7 +249,7 @@ struct OnTheFlyTrackerPid {
249249 ccdb->setTimestamp (-1 );
250250
251251 mRandom .SetSeed (seed.value );
252- if (!mTrackLut .load (trackLut.value , ccdb.operator ->(), kPdgCodes )) {
252+ if (!mTrackLut .load (trackLut.value , ccdb.operator ->(), PdgCodes )) {
253253 LOG (warning) << " dE/dx LUT incomplete, species without LUT get no tracker PID." ;
254254 }
255255 bookHistograms ();
@@ -272,7 +272,7 @@ struct OnTheFlyTrackerPid {
272272 LOG (fatal) << " At least one of enableLogPBins or enableLinearPBins must be true." ;
273273 }
274274
275- const std::vector<double > logBins = logBinning (numLogBins.value , kMinMomentumForLogBins , kMaxMomentumForLogBins );
275+ const std::vector<double > logBins = logBinning (numLogBins.value , MinMomentumForLogBins, MaxMomentumForLogBins );
276276 const std::string signalTitle = " d#it{E}/d#it{x} (e^{-})" ;
277277 const AxisSpec axisDedx{logBinning (numDedxBins.value , dedxMin.value , dedxMax.value ), signalTitle};
278278 const AxisSpec axisMomentumLog{logBins, " #it{p/z} (GeV/#it{c})" };
@@ -288,28 +288,28 @@ struct OnTheFlyTrackerPid {
288288 histos.add (" hToTvsMomLin" , (" Signal vs #it{p} (linear); #it{p} (GeV/#it{c}); " + signalTitle).c_str (), kTH2F , {axisMomentumLin, axisDedx});
289289 }
290290
291- for (int i = 0 ; i < kNumSpecies ; ++i) {
291+ for (int i = 0 ; i < NumSpecies ; ++i) {
292292 if (enableLogPBins.value ) {
293- const std::string name = std::format (" ToTvsP/hToTvsP_{}" , kNames [i]);
294- const std::string title = std::format (" Signal vs #it{{p/z}} for {}; #it{{p/z}} (GeV/#it{{c}}); {}" , kPrettyNames [i], signalTitle);
293+ const std::string name = std::format (" ToTvsP/hToTvsP_{}" , SpeciesNames [i]);
294+ const std::string title = std::format (" Signal vs #it{{p/z}} for {}; #it{{p/z}} (GeV/#it{{c}}); {}" , SpeciesLabels [i], signalTitle);
295295 h2dToTvsPperParticle[i] = histos.add <TH2 >(name.c_str (), title.c_str (), kTH2F , {axisMomentumLog, axisDedx});
296296 }
297297 if (enableLinearPBins.value ) {
298- const std::string name = std::format (" ToTvsPLin/hToTvsPLin_{}" , kNames [i]);
299- const std::string title = std::format (" Signal vs #it{{p/z}} for {} (linear); #it{{p/z}} (GeV/#it{{c}}); {}" , kPrettyNames [i], signalTitle);
298+ const std::string name = std::format (" ToTvsPLin/hToTvsPLin_{}" , SpeciesNames [i]);
299+ const std::string title = std::format (" Signal vs #it{{p/z}} for {} (linear); #it{{p/z}} (GeV/#it{{c}}); {}" , SpeciesLabels [i], signalTitle);
300300 h2dToTvsPperParticleLin[i] = histos.add <TH2 >(name.c_str (), title.c_str (), kTH2F , {axisMomentumLin, axisDedx});
301301 }
302302
303- const std::string nameEta = std::format (" ToTvsPEta/hToTvsPEta_{}" , kNames [i]);
304- const std::string titleEta = std::format (" Signal vs #it{{p/z}} and |#eta| for {}; #it{{p/z}} (GeV/#it{{c}}); |#eta|; {}" , kPrettyNames [i], signalTitle);
303+ const std::string nameEta = std::format (" ToTvsPEta/hToTvsPEta_{}" , SpeciesNames [i]);
304+ const std::string titleEta = std::format (" Signal vs #it{{p/z}} and |#eta| for {}; #it{{p/z}} (GeV/#it{{c}}); |#eta|; {}" , SpeciesLabels [i], signalTitle);
305305 h3dToTvsPEtaPerParticle[i] = histos.add <TH3 >(nameEta.c_str (), titleEta.c_str (), kTH3F , {axisMomentumLog, axisAbsEta, axisDedx});
306306
307- const std::string nameTracks = std::format (" Bookkeeping/hTracks_{}" , kNames [i]);
308- const std::string titleTracks = std::format (" Reconstructed {}; #it{{p/z}} (GeV/#it{{c}}); |#eta|" , kPrettyNames [i]);
307+ const std::string nameTracks = std::format (" Bookkeeping/hTracks_{}" , SpeciesNames [i]);
308+ const std::string titleTracks = std::format (" Reconstructed {}; #it{{p/z}} (GeV/#it{{c}}); |#eta|" , SpeciesLabels [i]);
309309 h2dTracks[i] = histos.add <TH2 >(nameTracks.c_str (), titleTracks.c_str (), kTH2F , {axisMomentumLog, axisAbsEta});
310310
311- const std::string nameWithDedx = std::format (" Bookkeeping/hTracksWithDedx_{}" , kNames [i]);
312- const std::string titleWithDedx = std::format (" Reconstructed {} with dE/dx; #it{{p/z}} (GeV/#it{{c}}); |#eta|" , kPrettyNames [i]);
311+ const std::string nameWithDedx = std::format (" Bookkeeping/hTracksWithDedx_{}" , SpeciesNames [i]);
312+ const std::string titleWithDedx = std::format (" Reconstructed {} with dE/dx; #it{{p/z}} (GeV/#it{{c}}); |#eta|" , SpeciesLabels [i]);
313313 h2dTracksWithDedx[i] = histos.add <TH2 >(nameWithDedx.c_str (), titleWithDedx.c_str (), kTH2F , {axisMomentumLog, axisAbsEta});
314314 }
315315 }
@@ -326,15 +326,15 @@ struct OnTheFlyTrackerPid {
326326 continue ;
327327 }
328328 const int pdg = std::abs (mcParticle.pdgCode ());
329- const auto itSpecies = std::find (kPdgCodes .begin (), kPdgCodes .end (), pdg);
330- if (itSpecies == kPdgCodes .end ()) {
329+ const auto itSpecies = std::find (PdgCodes .begin (), PdgCodes .end (), pdg);
330+ if (itSpecies == PdgCodes .end ()) {
331331 continue ;
332332 }
333333 const auto * pdgInfo = pdgDatabase->GetParticle (mcParticle.pdgCode ());
334334 if (!pdgInfo || pdgInfo->Charge () == 0 ) {
335335 continue ;
336336 }
337- const int iSpecies = std::distance (kPdgCodes .begin (), itSpecies);
337+ const int iSpecies = std::distance (PdgCodes .begin (), itSpecies);
338338 const float absCharge = std::abs (pdgInfo->Charge ()) / 3 .f ;
339339 const float rigidityTrue = mcParticle.p () / absCharge;
340340
0 commit comments