1313// / \brief strangeness builder module
1414// / \author ALICE
1515
16- // simple checkers, but ensure 8 bit integers
17- #define BITSET (var, nbit ) ((var) |= (static_cast <uint8_t >(1 ) << static_cast <uint8_t >(nbit)))
18-
1916#ifndef PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_
2017#define PWGLF_UTILS_STRANGENESSBUILDERMODULE_H_
2118
19+ // simple checkers, but ensure 8 bit integers
20+ #define BITSET (var, nbit ) ((var) |= (static_cast <uint8_t >(1 ) << static_cast <uint8_t >(nbit)))
21+
2222#include " TableHelper.h"
2323
2424#include " PWGLF/DataModel/LFStrangenessTables.h"
3939#include < cstdlib>
4040#include < memory>
4141#include < string>
42+ #include < vector>
4243
4344// __________________________________________
4445// strangeness builder module
@@ -531,7 +532,8 @@ class BuilderModule
531532
532533 nEnabledTables = 0 ;
533534
534- TString listOfRequestors[nTables];
535+ constexpr int kTablesConst = nTables; // silence warning
536+ TString listOfRequestors[kTablesConst ];
535537 for (int i = 0 ; i < nTables; i++) {
536538 int f = baseOpts.enabledTables ->get (tableNames[i].c_str (), " enable" );
537539 if (f == 1 ) {
@@ -986,10 +988,10 @@ class BuilderModule
986988
987989 bool trackIsInteresting = false ;
988990 if (
989- (originParticle.pdgCode () == 310 && v0BuilderOpts.mc_addGeneratedK0Short .value > 0 ) ||
990- (originParticle.pdgCode () == 3122 && v0BuilderOpts.mc_addGeneratedLambda .value > 0 ) ||
991- (originParticle.pdgCode () == - 3122 && v0BuilderOpts.mc_addGeneratedAntiLambda .value > 0 ) ||
992- (originParticle.pdgCode () == 22 && v0BuilderOpts.mc_addGeneratedGamma .value > 0 )) {
991+ (originParticle.pdgCode () == PDG_t:: kK0Short && v0BuilderOpts.mc_addGeneratedK0Short .value > 0 ) ||
992+ (originParticle.pdgCode () == PDG_t:: kLambda0 && v0BuilderOpts.mc_addGeneratedLambda .value > 0 ) ||
993+ (originParticle.pdgCode () == PDG_t:: kLambda0Bar && v0BuilderOpts.mc_addGeneratedAntiLambda .value > 0 ) ||
994+ (originParticle.pdgCode () == PDG_t:: kGamma && v0BuilderOpts.mc_addGeneratedGamma .value > 0 )) {
993995 trackIsInteresting = true ;
994996 }
995997 if (!trackIsInteresting) {
@@ -1039,7 +1041,7 @@ class BuilderModule
10391041 currentV0Entry.pdgCode = positiveTrackIndex.pdgCode ;
10401042 currentV0Entry.particleId = positiveTrackIndex.originId ;
10411043 currentV0Entry.isCollinearV0 = false ;
1042- if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear .value && currentV0Entry.pdgCode == 22 ) {
1044+ if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear .value && currentV0Entry.pdgCode == PDG_t:: kGamma ) {
10431045 currentV0Entry.isCollinearV0 = true ;
10441046 }
10451047 currentV0Entry.found = false ;
@@ -1061,7 +1063,7 @@ class BuilderModule
10611063 currentV0Entry.pdgCode = positiveTrackIndex.pdgCode ;
10621064 currentV0Entry.particleId = positiveTrackIndex.originId ;
10631065 currentV0Entry.isCollinearV0 = false ;
1064- if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear .value && currentV0Entry.pdgCode == 22 ) {
1066+ if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear .value && currentV0Entry.pdgCode == PDG_t:: kGamma ) {
10651067 currentV0Entry.isCollinearV0 = true ;
10661068 }
10671069 currentV0Entry.found = false ;
@@ -1137,10 +1139,10 @@ class BuilderModule
11371139
11381140 bool trackIsInteresting = false ;
11391141 if (
1140- (originParticle.pdgCode () == 3312 && cascadeBuilderOpts.mc_addGeneratedXiMinus .value > 0 ) ||
1141- (originParticle.pdgCode () == - 3312 && cascadeBuilderOpts.mc_addGeneratedXiPlus .value > 0 ) ||
1142- (originParticle.pdgCode () == 3334 && cascadeBuilderOpts.mc_addGeneratedOmegaMinus .value > 0 ) ||
1143- (originParticle.pdgCode () == - 3334 && cascadeBuilderOpts.mc_addGeneratedOmegaPlus .value > 0 )) {
1142+ (originParticle.pdgCode () == PDG_t:: kXiMinus && cascadeBuilderOpts.mc_addGeneratedXiMinus .value > 0 ) ||
1143+ (originParticle.pdgCode () == PDG_t:: kXiPlusBar && cascadeBuilderOpts.mc_addGeneratedXiPlus .value > 0 ) ||
1144+ (originParticle.pdgCode () == PDG_t:: kOmegaMinus && cascadeBuilderOpts.mc_addGeneratedOmegaMinus .value > 0 ) ||
1145+ (originParticle.pdgCode () == PDG_t:: kOmegaPlusBar && cascadeBuilderOpts.mc_addGeneratedOmegaPlus .value > 0 )) {
11441146 trackIsInteresting = true ;
11451147 }
11461148 if (!trackIsInteresting) {
@@ -1160,7 +1162,7 @@ class BuilderModule
11601162 for (size_t v0i = 0 ; v0i < v0List.size (); v0i++) {
11611163 auto v0 = v0List[sorted_v0[v0i]];
11621164
1163- if (std::abs (v0.pdgCode ) != 3122 ) {
1165+ if (std::abs (v0.pdgCode ) != PDG_t:: kLambda0 ) {
11641166 continue ; // this V0 isn't a lambda, can't come from a cascade: skip
11651167 }
11661168 if (v0.particleId < 0 ) {
@@ -1182,7 +1184,7 @@ class BuilderModule
11821184 }
11831185 auto v0OriginParticle = mcParticles.rawIteratorAt (v0OriginParticleIndex);
11841186
1185- if (std::abs (v0OriginParticle.pdgCode ()) != 3312 && std::abs (v0OriginParticle.pdgCode ()) != 3334 ) {
1187+ if (std::abs (v0OriginParticle.pdgCode ()) != PDG_t:: kXiMinus && std::abs (v0OriginParticle.pdgCode ()) != PDG_t:: kOmegaMinus ) {
11861188 continue ; // this V0 does not come from any particle of interest, don't try
11871189 }
11881190 for (const auto & bachelorTrackIndex : bachelorTrackArray) {
@@ -1693,10 +1695,10 @@ class BuilderModule
16931695 continue ; // skip secondary MC V0s
16941696
16951697 if (
1696- (v0BuilderOpts.mc_addGeneratedK0Short && mcParticle.pdgCode () == 310 ) ||
1697- (v0BuilderOpts.mc_addGeneratedLambda && mcParticle.pdgCode () == 3122 ) ||
1698- (v0BuilderOpts.mc_addGeneratedAntiLambda && mcParticle.pdgCode () == - 3122 ) ||
1699- (v0BuilderOpts.mc_addGeneratedGamma && mcParticle.pdgCode () == 22 )) {
1698+ (v0BuilderOpts.mc_addGeneratedK0Short && mcParticle.pdgCode () == PDG_t:: kK0Short ) ||
1699+ (v0BuilderOpts.mc_addGeneratedLambda && mcParticle.pdgCode () == PDG_t:: kLambda0 ) ||
1700+ (v0BuilderOpts.mc_addGeneratedAntiLambda && mcParticle.pdgCode () == PDG_t:: kLambda0Bar ) ||
1701+ (v0BuilderOpts.mc_addGeneratedGamma && mcParticle.pdgCode () == PDG_t:: kGamma )) {
17001702 thisInfo.pdgCode = mcParticle.pdgCode ();
17011703 thisInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary ();
17021704 thisInfo.label = mcParticle.globalIndex ();
@@ -1719,7 +1721,7 @@ class BuilderModule
17191721 auto const & daughters = mcParticle.template daughters_as <aod::McParticles>();
17201722
17211723 for (const auto & dau : daughters) {
1722- if (dau.getProcess () != 4 )
1724+ if (dau.getProcess () != TMCProcess:: kPDecay )
17231725 continue ;
17241726
17251727 if (dau.pdgCode () > 0 ) {
@@ -2137,27 +2139,27 @@ class BuilderModule
21372139 bool bbTag = false ;
21382140 if (bachTrack.has_mcParticle ()) {
21392141 auto bachelorParticle = bachTrack.template mcParticle_as <aod::McParticles>();
2140- if (bachelorParticle.pdgCode () == 211 ) { // pi+, look for antiproton in negative prong
2142+ if (bachelorParticle.pdgCode () == PDG_t:: kPiPlus ) { // pi+, look for antiproton in negative prong
21412143 if (negTrack.has_mcParticle ()) {
21422144 auto baryonParticle = negTrack.template mcParticle_as <aod::McParticles>();
2143- if (baryonParticle.has_mothers () && bachelorParticle.has_mothers () && baryonParticle.pdgCode () == - 2212 ) {
2145+ if (baryonParticle.has_mothers () && bachelorParticle.has_mothers () && baryonParticle.pdgCode () == PDG_t:: kProtonBar ) {
21442146 for (const auto & baryonMother : baryonParticle.template mothers_as <aod::McParticles>()) {
21452147 for (const auto & pionMother : bachelorParticle.template mothers_as <aod::McParticles>()) {
2146- if (baryonMother.globalIndex () == pionMother.globalIndex () && baryonMother.pdgCode () == - 3122 ) {
2148+ if (baryonMother.globalIndex () == pionMother.globalIndex () && baryonMother.pdgCode () == PDG_t:: kLambda0Bar ) {
21472149 bbTag = true ;
21482150 }
21492151 }
21502152 }
21512153 }
21522154 }
21532155 } // end if-pion
2154- if (bachelorParticle.pdgCode () == - 211 ) { // pi-, look for proton in positive prong
2156+ if (bachelorParticle.pdgCode () == PDG_t:: kPiMinus ) { // pi-, look for proton in positive prong
21552157 if (posTrack.has_mcParticle ()) {
21562158 auto baryonParticle = posTrack.template mcParticle_as <aod::McParticles>();
2157- if (baryonParticle.has_mothers () && bachelorParticle.has_mothers () && baryonParticle.pdgCode () == 2212 ) {
2159+ if (baryonParticle.has_mothers () && bachelorParticle.has_mothers () && baryonParticle.pdgCode () == PDG_t:: kProton ) {
21582160 for (const auto & baryonMother : baryonParticle.template mothers_as <aod::McParticles>()) {
21592161 for (const auto & pionMother : bachelorParticle.template mothers_as <aod::McParticles>()) {
2160- if (baryonMother.globalIndex () == pionMother.globalIndex () && baryonMother.pdgCode () == 3122 ) {
2162+ if (baryonMother.globalIndex () == pionMother.globalIndex () && baryonMother.pdgCode () == PDG_t:: kLambda0 ) {
21612163 bbTag = true ;
21622164 }
21632165 }
@@ -2207,10 +2209,10 @@ class BuilderModule
22072209 continue ; // skip secondary MC cascades
22082210
22092211 if (
2210- (cascadeBuilderOpts.mc_addGeneratedXiMinus && mcParticle.pdgCode () == 3312 ) ||
2211- (cascadeBuilderOpts.mc_addGeneratedXiPlus && mcParticle.pdgCode () == - 3312 ) ||
2212- (cascadeBuilderOpts.mc_addGeneratedOmegaMinus && mcParticle.pdgCode () == 3334 ) ||
2213- (cascadeBuilderOpts.mc_addGeneratedOmegaPlus && mcParticle.pdgCode () == - 3334 )) {
2212+ (cascadeBuilderOpts.mc_addGeneratedXiMinus && mcParticle.pdgCode () == PDG_t:: kXiMinus ) ||
2213+ (cascadeBuilderOpts.mc_addGeneratedXiPlus && mcParticle.pdgCode () == PDG_t:: kXiPlusBar ) ||
2214+ (cascadeBuilderOpts.mc_addGeneratedOmegaMinus && mcParticle.pdgCode () == PDG_t:: kOmegaMinus ) ||
2215+ (cascadeBuilderOpts.mc_addGeneratedOmegaPlus && mcParticle.pdgCode () == PDG_t:: kOmegaPlusBar )) {
22142216 thisCascInfo.pdgCode = mcParticle.pdgCode ();
22152217 thisCascInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary ();
22162218
@@ -2225,10 +2227,10 @@ class BuilderModule
22252227 if (mcParticle.has_daughters ()) {
22262228 auto const & daughters = mcParticle.template daughters_as <aod::McParticles>();
22272229 for (const auto & dau : daughters) {
2228- if (dau.getProcess () != 4 ) // check whether the daughter comes from a decay
2230+ if (dau.getProcess () != TMCProcess:: kPDecay ) // check whether the daughter comes from a decay
22292231 continue ;
22302232
2231- if (std::abs (dau.pdgCode ()) == 211 || std::abs (dau.pdgCode ()) == 321 ) {
2233+ if (std::abs (dau.pdgCode ()) == PDG_t:: kPiPlus || std::abs (dau.pdgCode ()) == PDG_t:: kKPlus ) {
22322234 thisCascInfo.pdgCodeBachelor = dau.pdgCode ();
22332235 thisCascInfo.bachP [0 ] = dau.px ();
22342236 thisCascInfo.bachP [1 ] = dau.py ();
@@ -2238,11 +2240,11 @@ class BuilderModule
22382240 thisCascInfo.xyz [2 ] = dau.vz ();
22392241 thisCascInfo.mcParticleBachelor = dau.globalIndex ();
22402242 }
2241- if (std::abs (dau.pdgCode ()) == 2212 ) {
2243+ if (std::abs (dau.pdgCode ()) == PDG_t:: kProton ) {
22422244 thisCascInfo.pdgCodeV0 = dau.pdgCode ();
22432245
22442246 for (const auto & v0Dau : dau.template daughters_as <aod::McParticles>()) {
2245- if (v0Dau.getProcess () != 4 )
2247+ if (v0Dau.getProcess () != TMCProcess:: kPDecay )
22462248 continue ;
22472249
22482250 if (v0Dau.pdgCode () > 0 ) {
@@ -2476,10 +2478,10 @@ class BuilderModule
24762478 interlinks.cascadeToTraCascCores .push_back (products.tracascdata .lastIndex ());
24772479 }
24782480 if (baseOpts.mEnabledTables [kCascCovs ]) {
2479- std::array<float , 21 > traCovMat = {0 .};
2481+ std::array<float , o2::track:: kLabCovMatSize > traCovMat = {0 .};
24802482 strangeTrackParCov.getCovXYZPxPyPzGlo (traCovMat);
2481- float traCovMatArray[21 ];
2482- for (int ii = 0 ; ii < 21 ; ii++) {
2483+ float traCovMatArray[o2::track:: kLabCovMatSize ];
2484+ for (int ii = 0 ; ii < o2::track:: kLabCovMatSize ; ii++) {
24832485 traCovMatArray[ii] = traCovMat[ii];
24842486 }
24852487 products.tracasccovs (traCovMatArray);
@@ -2512,7 +2514,7 @@ class BuilderModule
25122514 auto const & motherList = part.template mothers_as <aod::McParticles>();
25132515 if (motherList.size () == 1 ) {
25142516 for (const auto & mother : motherList) {
2515- if (std::abs (part.pdgCode ()) == 13 && treatPiToMuDecays) {
2517+ if (std::abs (part.pdgCode ()) == PDG_t:: kMuonMinus && treatPiToMuDecays) {
25162518 // muon decay, de-ref mother twice
25172519 if (mother.has_mothers ()) {
25182520 auto grandMotherList = mother.template mothers_as <aod::McParticles>();
0 commit comments