Skip to content

Commit 746ed62

Browse files
authored
PDG to PDG_t
1 parent 322f996 commit 746ed62

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

PWGLF/Utils/strangenessBuilderModule.h

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
#include "Framework/HistogramRegistry.h"
3535
#include "Framework/HistogramSpec.h"
3636

37+
#include <vector>
3738
#include <array>
3839
#include <cmath>
3940
#include <cstdlib>
4041
#include <memory>
4142
#include <string>
42-
#include <vector>
4343

4444
//__________________________________________
4545
// strangeness builder module
@@ -532,7 +532,7 @@ class BuilderModule
532532

533533
nEnabledTables = 0;
534534

535-
const int nTablesConst = nTables; // silence warning
535+
constexpr int nTablesConst = nTables; // silence warning
536536
TString listOfRequestors[nTablesConst];
537537
for (int i = 0; i < nTables; i++) {
538538
int f = baseOpts.enabledTables->get(tableNames[i].c_str(), "enable");
@@ -988,10 +988,10 @@ class BuilderModule
988988

989989
bool trackIsInteresting = false;
990990
if (
991-
(originParticle.pdgCode() == 310 && v0BuilderOpts.mc_addGeneratedK0Short.value > 0) ||
992-
(originParticle.pdgCode() == 3122 && v0BuilderOpts.mc_addGeneratedLambda.value > 0) ||
993-
(originParticle.pdgCode() == -3122 && v0BuilderOpts.mc_addGeneratedAntiLambda.value > 0) ||
994-
(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)) {
995995
trackIsInteresting = true;
996996
}
997997
if (!trackIsInteresting) {
@@ -1041,7 +1041,7 @@ class BuilderModule
10411041
currentV0Entry.pdgCode = positiveTrackIndex.pdgCode;
10421042
currentV0Entry.particleId = positiveTrackIndex.originId;
10431043
currentV0Entry.isCollinearV0 = false;
1044-
if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == 22) {
1044+
if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == PDG_t::kGamma) {
10451045
currentV0Entry.isCollinearV0 = true;
10461046
}
10471047
currentV0Entry.found = false;
@@ -1063,7 +1063,7 @@ class BuilderModule
10631063
currentV0Entry.pdgCode = positiveTrackIndex.pdgCode;
10641064
currentV0Entry.particleId = positiveTrackIndex.originId;
10651065
currentV0Entry.isCollinearV0 = false;
1066-
if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == 22) {
1066+
if (v0BuilderOpts.mc_addGeneratedGammaMakeCollinear.value && currentV0Entry.pdgCode == PDG_t::kGamma) {
10671067
currentV0Entry.isCollinearV0 = true;
10681068
}
10691069
currentV0Entry.found = false;
@@ -1139,10 +1139,10 @@ class BuilderModule
11391139

11401140
bool trackIsInteresting = false;
11411141
if (
1142-
(originParticle.pdgCode() == 3312 && cascadeBuilderOpts.mc_addGeneratedXiMinus.value > 0) ||
1143-
(originParticle.pdgCode() == -3312 && cascadeBuilderOpts.mc_addGeneratedXiPlus.value > 0) ||
1144-
(originParticle.pdgCode() == 3334 && cascadeBuilderOpts.mc_addGeneratedOmegaMinus.value > 0) ||
1145-
(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)) {
11461146
trackIsInteresting = true;
11471147
}
11481148
if (!trackIsInteresting) {
@@ -1162,7 +1162,7 @@ class BuilderModule
11621162
for (size_t v0i = 0; v0i < v0List.size(); v0i++) {
11631163
auto v0 = v0List[sorted_v0[v0i]];
11641164

1165-
if (std::abs(v0.pdgCode) != 3122) {
1165+
if (std::abs(v0.pdgCode) != PDG_t::kLambda0) {
11661166
continue; // this V0 isn't a lambda, can't come from a cascade: skip
11671167
}
11681168
if (v0.particleId < 0) {
@@ -1184,7 +1184,7 @@ class BuilderModule
11841184
}
11851185
auto v0OriginParticle = mcParticles.rawIteratorAt(v0OriginParticleIndex);
11861186

1187-
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) {
11881188
continue; // this V0 does not come from any particle of interest, don't try
11891189
}
11901190
for (const auto& bachelorTrackIndex : bachelorTrackArray) {
@@ -1695,10 +1695,10 @@ class BuilderModule
16951695
continue; // skip secondary MC V0s
16961696

16971697
if (
1698-
(v0BuilderOpts.mc_addGeneratedK0Short && mcParticle.pdgCode() == 310) ||
1699-
(v0BuilderOpts.mc_addGeneratedLambda && mcParticle.pdgCode() == 3122) ||
1700-
(v0BuilderOpts.mc_addGeneratedAntiLambda && mcParticle.pdgCode() == -3122) ||
1701-
(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)) {
17021702
thisInfo.pdgCode = mcParticle.pdgCode();
17031703
thisInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary();
17041704
thisInfo.label = mcParticle.globalIndex();
@@ -1721,7 +1721,7 @@ class BuilderModule
17211721
auto const& daughters = mcParticle.template daughters_as<aod::McParticles>();
17221722

17231723
for (const auto& dau : daughters) {
1724-
if (dau.getProcess() != 4)
1724+
if (dau.getProcess() != TMCProcess::kPDecay)
17251725
continue;
17261726

17271727
if (dau.pdgCode() > 0) {
@@ -2139,27 +2139,27 @@ class BuilderModule
21392139
bool bbTag = false;
21402140
if (bachTrack.has_mcParticle()) {
21412141
auto bachelorParticle = bachTrack.template mcParticle_as<aod::McParticles>();
2142-
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
21432143
if (negTrack.has_mcParticle()) {
21442144
auto baryonParticle = negTrack.template mcParticle_as<aod::McParticles>();
2145-
if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == -2212) {
2145+
if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == PDG_t::kProtonBar) {
21462146
for (const auto& baryonMother : baryonParticle.template mothers_as<aod::McParticles>()) {
21472147
for (const auto& pionMother : bachelorParticle.template mothers_as<aod::McParticles>()) {
2148-
if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == -3122) {
2148+
if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == PDG_t::kLambda0Bar) {
21492149
bbTag = true;
21502150
}
21512151
}
21522152
}
21532153
}
21542154
}
21552155
} // end if-pion
2156-
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
21572157
if (posTrack.has_mcParticle()) {
21582158
auto baryonParticle = posTrack.template mcParticle_as<aod::McParticles>();
2159-
if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == 2212) {
2159+
if (baryonParticle.has_mothers() && bachelorParticle.has_mothers() && baryonParticle.pdgCode() == PDG_t::kProton) {
21602160
for (const auto& baryonMother : baryonParticle.template mothers_as<aod::McParticles>()) {
21612161
for (const auto& pionMother : bachelorParticle.template mothers_as<aod::McParticles>()) {
2162-
if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == 3122) {
2162+
if (baryonMother.globalIndex() == pionMother.globalIndex() && baryonMother.pdgCode() == PDG_t::kLambda0) {
21632163
bbTag = true;
21642164
}
21652165
}
@@ -2209,10 +2209,10 @@ class BuilderModule
22092209
continue; // skip secondary MC cascades
22102210

22112211
if (
2212-
(cascadeBuilderOpts.mc_addGeneratedXiMinus && mcParticle.pdgCode() == 3312) ||
2213-
(cascadeBuilderOpts.mc_addGeneratedXiPlus && mcParticle.pdgCode() == -3312) ||
2214-
(cascadeBuilderOpts.mc_addGeneratedOmegaMinus && mcParticle.pdgCode() == 3334) ||
2215-
(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)) {
22162216
thisCascInfo.pdgCode = mcParticle.pdgCode();
22172217
thisCascInfo.isPhysicalPrimary = mcParticle.isPhysicalPrimary();
22182218

@@ -2240,11 +2240,11 @@ class BuilderModule
22402240
thisCascInfo.xyz[2] = dau.vz();
22412241
thisCascInfo.mcParticleBachelor = dau.globalIndex();
22422242
}
2243-
if (std::abs(dau.pdgCode()) == 2212) {
2243+
if (std::abs(dau.pdgCode()) == PDG_t::kProton) {
22442244
thisCascInfo.pdgCodeV0 = dau.pdgCode();
22452245

22462246
for (const auto& v0Dau : dau.template daughters_as<aod::McParticles>()) {
2247-
if (v0Dau.getProcess() != 4)
2247+
if (v0Dau.getProcess() != TMCProcess::kPDecay)
22482248
continue;
22492249

22502250
if (v0Dau.pdgCode() > 0) {
@@ -2478,10 +2478,10 @@ class BuilderModule
24782478
interlinks.cascadeToTraCascCores.push_back(products.tracascdata.lastIndex());
24792479
}
24802480
if (baseOpts.mEnabledTables[kCascCovs]) {
2481-
std::array<float, 21> traCovMat = {0.};
2481+
std::array<float, o2::track::kLabCovMatSize> traCovMat = {0.};
24822482
strangeTrackParCov.getCovXYZPxPyPzGlo(traCovMat);
2483-
float traCovMatArray[21];
2484-
for (int ii = 0; ii < 21; ii++) {
2483+
float traCovMatArray[o2::track::kLabCovMatSize];
2484+
for (int ii = 0; ii < o2::track::kLabCovMatSize; ii++) {
24852485
traCovMatArray[ii] = traCovMat[ii];
24862486
}
24872487
products.tracasccovs(traCovMatArray);
@@ -2514,7 +2514,7 @@ class BuilderModule
25142514
auto const& motherList = part.template mothers_as<aod::McParticles>();
25152515
if (motherList.size() == 1) {
25162516
for (const auto& mother : motherList) {
2517-
if (std::abs(part.pdgCode()) == 13 && treatPiToMuDecays) {
2517+
if (std::abs(part.pdgCode()) == PDG_t::kMuonMinus && treatPiToMuDecays) {
25182518
// muon decay, de-ref mother twice
25192519
if (mother.has_mothers()) {
25202520
auto grandMotherList = mother.template mothers_as<aod::McParticles>();

0 commit comments

Comments
 (0)