Skip to content

Commit 1756576

Browse files
committed
fixed the hardcoded pdg codes
1 parent 77cc59c commit 1756576

File tree

3 files changed

+66
-66
lines changed

3 files changed

+66
-66
lines changed

PWGLF/DataModel/LFSigmaTables.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,10 @@ DECLARE_SOA_COLUMN(LambdaPDGCodeMother, lambdaPDGCodeMother, int);
590590
DECLARE_SOA_COLUMN(LambdaIsCorrectlyAssoc, lambdaIsCorrectlyAssoc, bool);
591591

592592
DECLARE_SOA_DYNAMIC_COLUMN(IsSigma0, isSigma0, //! IsSigma0
593-
[](int pdgCode) -> bool { return pdgCode == 3212; });
593+
[](int pdgCode) -> bool { return pdgCode == PDG_t::kSigma0; }); //3212
594594

595595
DECLARE_SOA_DYNAMIC_COLUMN(IsAntiSigma0, isAntiSigma0, //! IsASigma0
596-
[](int pdgCode) -> bool { return pdgCode == -3212; });
596+
[](int pdgCode) -> bool { return pdgCode == PDG_t::kSigma0Bar; }); //-3212
597597

598598
DECLARE_SOA_DYNAMIC_COLUMN(MCPx, mcpx, //! Sigma0 px
599599
[](float photonMCPx, float lambdaMCPx) -> float { return photonMCPx + lambdaMCPx; });
@@ -759,7 +759,7 @@ DECLARE_SOA_COLUMN(KShortPDGCodeMother, kshortPDGCodeMother, int);
759759
DECLARE_SOA_COLUMN(KShortIsCorrectlyAssoc, kshortIsCorrectlyAssoc, bool);
760760

761761
DECLARE_SOA_DYNAMIC_COLUMN(IsKStar, isKStar, //! IsSigma0
762-
[](int pdgCode) -> bool { return pdgCode == 313; });
762+
[](int pdgCode) -> bool { return pdgCode == o2::constants::physics::Pdg::kK0Star892; }); //313
763763

764764
DECLARE_SOA_DYNAMIC_COLUMN(MCPx, mcpx, //! Sigma0 px
765765
[](float photonMCPx, float kshortMCPx) -> float { return photonMCPx + kshortMCPx; });
@@ -1154,10 +1154,10 @@ DECLARE_SOA_COLUMN(Photon2PDGCodeMother, photon2PDGCodeMother, int);
11541154
DECLARE_SOA_COLUMN(Photon2IsCorrectlyAssoc, photon2IsCorrectlyAssoc, bool);
11551155

11561156
DECLARE_SOA_DYNAMIC_COLUMN(IsPi0, isPi0, //! IsPi0
1157-
[](int pdgCode) -> bool { return pdgCode == 111; });
1157+
[](int pdgCode) -> bool { return pdgCode == PDG_t::kPi0; }); //111
11581158

11591159
DECLARE_SOA_DYNAMIC_COLUMN(IsFromXi0, isFromXi0, //! Pi0 from Xi0
1160-
[](int pdgCodeMother) -> bool { return pdgCodeMother == 3322; });
1160+
[](int pdgCodeMother) -> bool { return pdgCodeMother == o2::constants::physics::Pdg::kXi0; }); // 3322
11611161

11621162
DECLARE_SOA_DYNAMIC_COLUMN(MCPx, mcpx, //! Pi0 MC px
11631163
[](float photon1MCPx, float photon2MCPx) -> float { return photon1MCPx + photon2MCPx; });

PWGLF/TableProducer/Strangeness/sigma0builder.cxx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ struct sigma0builder {
755755

756756
// Sanity check: Is V0Pair <-> Mother assignment correct?
757757
bool fIsSigma0 = false;
758-
if ((v01MC.pdgCode() == 22) && (v01MC.pdgCodeMother() == 3212) && (v02MC.pdgCode() == 3122) && (v02MC.pdgCodeMother() == 3212) && (v01.motherMCPartId() == v02.motherMCPartId()))
758+
if ((v01MC.pdgCode() == PDG_t::kGamma) && (v01MC.pdgCodeMother() == PDG_t::kSigma0) && (v02MC.pdgCode() == PDG_t::kLambda0) && (v02MC.pdgCodeMother() == PDG_t::kSigma0) && (v01.motherMCPartId() == v02.motherMCPartId()))
759759
fIsSigma0 = true;
760760

761761
// Check collision assignment
@@ -809,7 +809,7 @@ struct sigma0builder {
809809

810810
// MC QA histograms
811811
// Parenthood check for sigma0-like candidate
812-
if (MCParticle_v01.pdgCode() == 22 && TMath::Abs(MCParticle_v02.pdgCode()) == 3122) {
812+
if (MCParticle_v01.pdgCode() == PDG_t::kGamma&& TMath::Abs(MCParticle_v02.pdgCode()) == PDG_t::kLambda0) {
813813
for (const auto& mother1 : MCMothersList_v01) { // Photon mothers
814814
histos.fill(HIST("MCQA/h2dPhotonNMothersVsPDG"), MCMothersList_v01.size(), mother1.pdgCode());
815815
histos.fill(HIST("MCQA/h2dPhotonNMothersVsMCProcess"), MCMothersList_v01.size(), mother1.getProcess());
@@ -834,11 +834,11 @@ struct sigma0builder {
834834
}
835835

836836
// Check association correctness
837-
if (fIsSigma0 && (MCinfo.V0PairPDGCode == 3212))
837+
if (fIsSigma0 && (MCinfo.V0PairPDGCode == PDG_t::kSigma0))
838838
histos.fill(HIST("MCQA/hSigma0MCCheck"), 1); // match
839-
if (fIsSigma0 && !(MCinfo.V0PairPDGCode == 3212))
839+
if (fIsSigma0 && !(MCinfo.V0PairPDGCode == PDG_t::kSigma0))
840840
histos.fill(HIST("MCQA/hSigma0MCCheck"), 2); // mismatch
841-
if (!fIsSigma0 && (MCinfo.V0PairPDGCode == 3212))
841+
if (!fIsSigma0 && (MCinfo.V0PairPDGCode == PDG_t::kSigma0))
842842
histos.fill(HIST("MCQA/hSigma0MCCheck"), 3); // mismatch
843843
}
844844
}
@@ -1161,7 +1161,7 @@ struct sigma0builder {
11611161
bool fIsV0CorrectlyAssigned = (v0MC.straMCCollisionId() == v0MCCollision.globalIndex());
11621162
bool isPrimary = v0MC.isPhysicalPrimary();
11631163

1164-
if ((v0MC.pdgCode() == 22) && isPhotonAnalysis && isPrimary) { // True Gamma
1164+
if ((v0MC.pdgCode() == PDG_t::kGamma) && isPhotonAnalysis && isPrimary) { // True Gamma
11651165
histos.fill(HIST("V0AssoQA/h2dIRVsPt_TrueGamma"), IR, V0MCpT);
11661166
histos.fill(HIST("V0AssoQA/h3dPAVsIRVsPt_TrueGamma"), V0PA, IR, V0MCpT);
11671167

@@ -1170,7 +1170,7 @@ struct sigma0builder {
11701170
histos.fill(HIST("V0AssoQA/h3dPAVsIRVsPt_TrueGamma_BadCollAssig"), V0PA, IR, V0MCpT);
11711171
}
11721172
}
1173-
if ((v0MC.pdgCode() == 3122) && !isPhotonAnalysis && isPrimary) { // True Lambda
1173+
if ((v0MC.pdgCode() == PDG_t::kLambda0) && !isPhotonAnalysis && isPrimary) { // True Lambda
11741174
histos.fill(HIST("V0AssoQA/h2dIRVsPt_TrueLambda"), IR, V0MCpT);
11751175
histos.fill(HIST("V0AssoQA/h3dPAVsIRVsPt_TrueLambda"), V0PA, IR, V0MCpT);
11761176

@@ -1189,13 +1189,13 @@ struct sigma0builder {
11891189

11901190
// Fill with properties
11911191
GenInfo.IsPrimary = mcParticle.isPhysicalPrimary();
1192-
GenInfo.IsV0Lambda = mcParticle.pdgCode() == 3122;
1193-
GenInfo.IsV0AntiLambda = mcParticle.pdgCode() == -3122;
1194-
GenInfo.IsV0KShort = mcParticle.pdgCode() == 310;
1195-
GenInfo.IsPi0 = mcParticle.pdgCode() == 111;
1196-
GenInfo.IsSigma0 = mcParticle.pdgCode() == 3212;
1197-
GenInfo.IsAntiSigma0 = mcParticle.pdgCode() == -3212;
1198-
GenInfo.IsKStar = mcParticle.pdgCode() == 313;
1192+
GenInfo.IsV0Lambda = mcParticle.pdgCode() == PDG_t::kLambda0; //3122
1193+
GenInfo.IsV0AntiLambda = mcParticle.pdgCode() == PDG_t::kLambda0Bar; //-3122
1194+
GenInfo.IsV0KShort = mcParticle.pdgCode() == PDG_t::kK0Short; //310
1195+
GenInfo.IsPi0 = mcParticle.pdgCode() == PDG_t::kPi0; //111;
1196+
GenInfo.IsSigma0 = mcParticle.pdgCode() == PDG_t::kSigma0; // PDG_t::kSigma0
1197+
GenInfo.IsAntiSigma0 = mcParticle.pdgCode() == PDG_t::kSigma0Bar; //-3212
1198+
GenInfo.IsKStar = mcParticle.pdgCode() == o2::constants::physics::Pdg::kK0Star892; //313;
11991199
GenInfo.IsProducedByGenerator = mcParticle.producedByGenerator();
12001200
GenInfo.MCProcess = mcParticle.getProcess();
12011201
GenInfo.MCPt = mcParticle.pt();
@@ -1224,10 +1224,10 @@ struct sigma0builder {
12241224
histos.fill(HIST("GenQA/h2dSigma0NDaughtersVsPDG"), daughters.size(), daughter.pdgCode());
12251225

12261226
if (GenInfo.NDaughters == 2) {
1227-
if (daughter.pdgCode() == 22)
1227+
if (daughter.pdgCode() == PDG_t::kGamma)
12281228
GenInfo.MCDau1Pt = daughter.pt();
12291229

1230-
if (TMath::Abs(daughter.pdgCode()) == 3122)
1230+
if (TMath::Abs(daughter.pdgCode()) == PDG_t::kLambda0)
12311231
GenInfo.MCDau2Pt = daughter.pt();
12321232
}
12331233
}
@@ -1466,7 +1466,7 @@ struct sigma0builder {
14661466
if constexpr (requires { gamma.motherMCPartId(); }) {
14671467
if (gamma.has_v0MCCore()) {
14681468
auto gammaMC = gamma.template v0MCCore_as<soa::Join<aod::V0MCCores, aod::V0MCCollRefs>>();
1469-
if (gammaMC.pdgCode() != 22)
1469+
if (gammaMC.pdgCode() != PDG_t::kGamma)
14701470
return false;
14711471
}
14721472
}
@@ -1563,7 +1563,7 @@ struct sigma0builder {
15631563
if constexpr (requires { lambda.motherMCPartId(); }) {
15641564
if (lambda.has_v0MCCore()) {
15651565
auto lambdaMC = lambda.template v0MCCore_as<soa::Join<aod::V0MCCores, aod::V0MCCollRefs>>();
1566-
if (TMath::Abs(lambdaMC.pdgCode()) != 3122)
1566+
if (TMath::Abs(lambdaMC.pdgCode()) != PDG_t::kLambda0)
15671567
return false;
15681568
}
15691569
}
@@ -2199,25 +2199,25 @@ struct sigma0builder {
21992199
auto v0MC = v0.template v0MCCore_as<soa::Join<aod::V0MCCores, aod::V0MCCollRefs>>();
22002200

22012201
// True Photon
2202-
if (v0MC.pdgCode() == 22 && fPassPhotonSel) {
2202+
if (v0MC.pdgCode() == PDG_t::kGamma&& fPassPhotonSel) {
22032203
histos.fill(HIST("PhotonLambdaQA/h3dTruePhotonMass"), centrality, v0MC.ptMC(), v0.mGamma());
2204-
if (TMath::Abs(v0MC.pdgCodeMother()) == 3212) { // If from sigma0 or ASigma0
2204+
if (TMath::Abs(v0MC.pdgCodeMother()) == PDG_t::kSigma0) { // If from sigma0 or ASigma0
22052205
histos.fill(HIST("PhotonLambdaQA/h2dTrueSigma0PhotonMass"), v0MC.ptMC(), v0.mGamma());
22062206
}
22072207
}
22082208

22092209
// True Lambda
2210-
if (v0MC.pdgCode() == 3122 && fPassLambdaSel) {
2210+
if (v0MC.pdgCode() == PDG_t::kLambda0 && fPassLambdaSel) {
22112211
histos.fill(HIST("PhotonLambdaQA/h3dTrueLambdaMass"), centrality, v0MC.ptMC(), v0.mLambda());
2212-
if (v0MC.pdgCodeMother() == 3212) { // If from sigma0
2212+
if (v0MC.pdgCodeMother() == PDG_t::kSigma0) { // If from sigma0
22132213
histos.fill(HIST("PhotonLambdaQA/h2dTrueSigma0LambdaMass"), v0MC.ptMC(), v0.mLambda());
22142214
}
22152215
}
22162216

22172217
// True ALambda
2218-
if (v0MC.pdgCode() == -3122 && fPassLambdaSel) {
2218+
if (v0MC.pdgCode() == PDG_t::kLambda0Bar && fPassLambdaSel) {
22192219
histos.fill(HIST("PhotonLambdaQA/h3dTrueALambdaMass"), centrality, v0MC.ptMC(), v0.mAntiLambda());
2220-
if (v0MC.pdgCodeMother() == -3212) { // If from asigma0
2220+
if (v0MC.pdgCodeMother() == PDG_t::kSigma0Bar) { // If from asigma0
22212221
histos.fill(HIST("PhotonLambdaQA/h2dTrueASigma0ALambdaMass"), v0MC.ptMC(), v0.mAntiLambda());
22222222
}
22232223
}

0 commit comments

Comments
 (0)