diff --git a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx index 09a468e3880..d665eb6756c 100644 --- a/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx +++ b/PWGLF/TableProducer/Strangeness/strangenesstofpid.cxx @@ -57,7 +57,9 @@ #include #include #include +#include #include +#include using namespace o2; using namespace o2::framework; diff --git a/PWGLF/Utils/strangenessBuilderModule.h b/PWGLF/Utils/strangenessBuilderModule.h index e49ed71f14b..7319e29c04e 100644 --- a/PWGLF/Utils/strangenessBuilderModule.h +++ b/PWGLF/Utils/strangenessBuilderModule.h @@ -13,12 +13,12 @@ /// \brief strangeness builder module /// \author ALICE -// simple checkers, but ensure 8 bit integers -#define BITSET(var, nbit) ((var) |= (static_cast(1) << static_cast(nbit))) - #ifndef PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_ #define PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_ +// simple checkers, but ensure 8 bit integers +#define BITSET(var, nbit) ((var) |= (static_cast(1) << static_cast(nbit))) + #include "TableHelper.h" #include "PWGLF/DataModel/LFStrangenessTables.h" @@ -39,6 +39,7 @@ #include #include #include +#include //__________________________________________ // strangeness builder module @@ -531,7 +532,8 @@ class BuilderModule nEnabledTables = 0; - TString listOfRequestors[nTables]; + constexpr int kTablesConst = nTables; // silence warning + TString listOfRequestors[kTablesConst]; for (int i = 0; i < nTables; i++) { int f = baseOpts.enabledTables->get(tableNames[i].c_str(), "enable"); if (f == 1) { @@ -986,10 +988,10 @@ class BuilderModule bool trackIsInteresting = false; if ( - (originParticle.pdgCode() == 310 && v0BuilderOpts.mc_addGeneratedK0Short.value > 0) || - (originParticle.pdgCode() == 3122 && v0BuilderOpts.mc_addGeneratedLambda.value > 0) || - (originParticle.pdgCode() == -3122 && v0BuilderOpts.mc_addGeneratedAntiLambda.value > 0) || - (originParticle.pdgCode() == 22 && v0BuilderOpts.mc_addGeneratedGamma.value > 0)) { + (originParticle.pdgCode() == PDG_t::kK0Short && v0BuilderOpts.mc_addGeneratedK0Short.value > 0) || + (originParticle.pdgCode() == PDG_t::kLambda0 && v0BuilderOpts.mc_addGeneratedLambda.value > 0) || + (originParticle.pdgCode() == PDG_t::kLambda0Bar && v0BuilderOpts.mc_addGeneratedAntiLambda.value > 0) || + (originParticle.pdgCode() == PDG_t::kGamma && v0BuilderOpts.mc_addGeneratedGamma.value > 0)) { trackIsInteresting = true; } if (!trackIsInteresting) { @@ -1039,7 +1041,7 @@ class BuilderModule currentV0Entry.pdgCode = positiveTrackIndex.pdgCode; currentV0Entry.particleId = positiveTrackIndex.originId; currentV0Entry.isCollinearV0 = false; - if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == 22) { + if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == PDG_t::kGamma) { currentV0Entry.isCollinearV0 = true; } currentV0Entry.found = false; @@ -1061,7 +1063,7 @@ class BuilderModule currentV0Entry.pdgCode = positiveTrackIndex.pdgCode; currentV0Entry.particleId = positiveTrackIndex.originId; currentV0Entry.isCollinearV0 = false; - if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == 22) { + if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == PDG_t::kGamma) { currentV0Entry.isCollinearV0 = true; } currentV0Entry.found = false; @@ -1137,10 +1139,10 @@ class BuilderModule bool trackIsInteresting = false; if ( - (originParticle.pdgCode() == 3312 && cascadeBuilderOpts.mc_addGeneratedXiMinus.value > 0) || - (originParticle.pdgCode() == -3312 && cascadeBuilderOpts.mc_addGeneratedXiPlus.value > 0) || - (originParticle.pdgCode() == 3334 && cascadeBuilderOpts.mc_addGeneratedOmegaMinus.value > 0) || - (originParticle.pdgCode() == -3334 && cascadeBuilderOpts.mc_addGeneratedOmegaPlus.value > 0)) { + (originParticle.pdgCode() == PDG_t::kXiMinus && cascadeBuilderOpts.mc_addGeneratedXiMinus.value > 0) || + (originParticle.pdgCode() == PDG_t::kXiPlusBar && cascadeBuilderOpts.mc_addGeneratedXiPlus.value > 0) || + (originParticle.pdgCode() == PDG_t::kOmegaMinus && cascadeBuilderOpts.mc_addGeneratedOmegaMinus.value > 0) || + (originParticle.pdgCode() == PDG_t::kOmegaPlusBar && cascadeBuilderOpts.mc_addGeneratedOmegaPlus.value > 0)) { trackIsInteresting = true; } if (!trackIsInteresting) { @@ -1160,7 +1162,7 @@ class BuilderModule for (size_t v0i = 0; v0i < v0List.size(); v0i++) { auto v0 = v0List[sorted_v0[v0i]]; - if (std::abs(v0.pdgCode) != 3122) { + if (std::abs(v0.pdgCode) != PDG_t::kLambda0) { continue; // this V0 isn't a lambda, can't come from a cascade: skip } if (v0.particleId < 0) { @@ -1182,7 +1184,7 @@ class BuilderModule } auto v0OriginParticle = mcParticles.rawIteratorAt(v0OriginParticleIndex); - if (std::abs(v0OriginParticle.pdgCode()) != 3312 && std::abs(v0OriginParticle.pdgCode()) != 3334) { + if (std::abs(v0OriginParticle.pdgCode()) != PDG_t::kXiMinus && std::abs(v0OriginParticle.pdgCode()) != PDG_t::kOmegaMinus) { continue; // this V0 does not come from any particle of interest, don't try } for (const auto& bachelorTrackIndex : bachelorTrackArray) { @@ -1693,10 +1695,10 @@ class BuilderModule continue; // skip secondary MC V0s if ( - (v0BuilderOpts.mc_addGeneratedK0Short && mcParticle.pdgCode() == 310) || - (v0BuilderOpts.mc_addGeneratedLambda && mcParticle.pdgCode() == 3122) || - (v0BuilderOpts.mc_addGeneratedAntiLambda && mcParticle.pdgCode() == -3122) || - (v0BuilderOpts.mc_addGeneratedGamma && mcParticle.pdgCode() == 22)) { + (v0BuilderOpts.mc_addGeneratedK0Short && mcParticle.pdgCode() == PDG_t::kK0Short) || + (v0BuilderOpts.mc_addGeneratedLambda && mcParticle.pdgCode() == PDG_t::kLambda0) || + (v0BuilderOpts.mc_addGeneratedAntiLambda && mcParticle.pdgCode() == PDG_t::kLambda0Bar) || + (v0BuilderOpts.mc_addGeneratedGamma && mcParticle.pdgCode() == PDG_t::kGamma)) { thisInfo.pdgCode = mcParticle.pdgCode(); thisInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary(); thisInfo.label = mcParticle.globalIndex(); @@ -1719,7 +1721,7 @@ class BuilderModule auto const& daughters = mcParticle.template daughters_as(); for (const auto& dau : daughters) { - if (dau.getProcess() != 4) + if (dau.getProcess() != TMCProcess::kPDecay) continue; if (dau.pdgCode() > 0) { @@ -2137,13 +2139,13 @@ class BuilderModule bool bbTag = false; if (bachTrack.has_mcParticle()) { auto bachelorParticle = bachTrack.template mcParticle_as(); - if (bachelorParticle.pdgCode() == 211) { // pi+, look for antiproton in negative prong + if (bachelorParticle.pdgCode() == PDG_t::kPiPlus) { // pi+, look for antiproton in negative prong if (negTrack.has_mcParticle()) { auto baryonParticle = negTrack.template mcParticle_as(); - if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == -2212) { + if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == PDG_t::kProtonBar) { for (const auto& baryonMother : baryonParticle.template mothers_as()) { for (const auto& pionMother : bachelorParticle.template mothers_as()) { - if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == -3122) { + if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == PDG_t::kLambda0Bar) { bbTag = true; } } @@ -2151,13 +2153,13 @@ class BuilderModule } } } // end if-pion - if (bachelorParticle.pdgCode() == -211) { // pi-, look for proton in positive prong + if (bachelorParticle.pdgCode() == PDG_t::kPiMinus) { // pi-, look for proton in positive prong if (posTrack.has_mcParticle()) { auto baryonParticle = posTrack.template mcParticle_as(); - if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == 2212) { + if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == PDG_t::kProton) { for (const auto& baryonMother : baryonParticle.template mothers_as()) { for (const auto& pionMother : bachelorParticle.template mothers_as()) { - if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == 3122) { + if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == PDG_t::kLambda0) { bbTag = true; } } @@ -2207,10 +2209,10 @@ class BuilderModule continue; // skip secondary MC cascades if ( - (cascadeBuilderOpts.mc_addGeneratedXiMinus && mcParticle.pdgCode() == 3312) || - (cascadeBuilderOpts.mc_addGeneratedXiPlus && mcParticle.pdgCode() == -3312) || - (cascadeBuilderOpts.mc_addGeneratedOmegaMinus && mcParticle.pdgCode() == 3334) || - (cascadeBuilderOpts.mc_addGeneratedOmegaPlus && mcParticle.pdgCode() == -3334)) { + (cascadeBuilderOpts.mc_addGeneratedXiMinus && mcParticle.pdgCode() == PDG_t::kXiMinus) || + (cascadeBuilderOpts.mc_addGeneratedXiPlus && mcParticle.pdgCode() == PDG_t::kXiPlusBar) || + (cascadeBuilderOpts.mc_addGeneratedOmegaMinus && mcParticle.pdgCode() == PDG_t::kOmegaMinus) || + (cascadeBuilderOpts.mc_addGeneratedOmegaPlus && mcParticle.pdgCode() == PDG_t::kOmegaPlusBar)) { thisCascInfo.pdgCode = mcParticle.pdgCode(); thisCascInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary(); @@ -2225,10 +2227,10 @@ class BuilderModule if (mcParticle.has_daughters()) { auto const& daughters = mcParticle.template daughters_as(); for (const auto& dau : daughters) { - if (dau.getProcess() != 4) // check whether the daughter comes from a decay + if (dau.getProcess() != TMCProcess::kPDecay) // check whether the daughter comes from a decay continue; - if (std::abs(dau.pdgCode()) == 211 || std::abs(dau.pdgCode()) == 321) { + if (std::abs(dau.pdgCode()) == PDG_t::kPiPlus || std::abs(dau.pdgCode()) == PDG_t::kKPlus) { thisCascInfo.pdgCodeBachelor = dau.pdgCode(); thisCascInfo.bachP[0] = dau.px(); thisCascInfo.bachP[1] = dau.py(); @@ -2238,11 +2240,11 @@ class BuilderModule thisCascInfo.xyz[2] = dau.vz(); thisCascInfo.mcParticleBachelor = dau.globalIndex(); } - if (std::abs(dau.pdgCode()) == 2212) { + if (std::abs(dau.pdgCode()) == PDG_t::kProton) { thisCascInfo.pdgCodeV0 = dau.pdgCode(); for (const auto& v0Dau : dau.template daughters_as()) { - if (v0Dau.getProcess() != 4) + if (v0Dau.getProcess() != TMCProcess::kPDecay) continue; if (v0Dau.pdgCode() > 0) { @@ -2476,10 +2478,10 @@ class BuilderModule interlinks.cascadeToTraCascCores.push_back(products.tracascdata.lastIndex()); } if (baseOpts.mEnabledTables[kCascCovs]) { - std::array traCovMat = {0.}; + std::array traCovMat = {0.}; strangeTrackParCov.getCovXYZPxPyPzGlo(traCovMat); - float traCovMatArray[21]; - for (int ii = 0; ii < 21; ii++) { + float traCovMatArray[o2::track::kLabCovMatSize]; + for (int ii = 0; ii < o2::track::kLabCovMatSize; ii++) { traCovMatArray[ii] = traCovMat[ii]; } products.tracasccovs(traCovMatArray); @@ -2512,7 +2514,7 @@ class BuilderModule auto const& motherList = part.template mothers_as(); if (motherList.size() == 1) { for (const auto& mother : motherList) { - if (std::abs(part.pdgCode()) == 13 && treatPiToMuDecays) { + if (std::abs(part.pdgCode()) == PDG_t::kMuonMinus && treatPiToMuDecays) { // muon decay, de-ref mother twice if (mother.has_mothers()) { auto grandMotherList = mother.template mothers_as();