Skip to content

Commit 6f7fe59

Browse files
committed
rename pdg code to pass O2 linter test
1 parent a72e60b commit 6f7fe59

File tree

1 file changed

+43
-42
lines changed

1 file changed

+43
-42
lines changed

PWGLF/Tasks/Nuspex/spectraTOF.cxx

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "PWGLF/DataModel/mcCentrality.h"
4141
#include "Common/Core/RecoDecay.h"
4242
#include "TPDGCode.h"
43+
#include "Framework/PhysicsConstants.h"
4344
using namespace o2;
4445
using namespace o2::track;
4546
using namespace o2::framework;
@@ -1490,9 +1491,9 @@ struct tofSpectra {
14901491
if (mcParticle.isPhysicalPrimary()) {
14911492
if (isTPCPion && rapidityPi <= trkselOptions.cfgCutY) {
14921493
if (usePDGcode) {
1493-
if (pdgCode == 211) {
1494+
if (pdgCode == o2::constants::physics::Pdg::kPiPlus) {
14941495
histos.fill(HIST("nsigmatpc/mc_closure/pos/pi"), track.pt(), nsigmaTPCPi, multiplicity);
1495-
} else if (pdgCode == -211) {
1496+
} else if (pdgCode == o2::constants::physics::Pdg::kPiMinus) {
14961497
histos.fill(HIST("nsigmatpc/mc_closure/neg/pi"), track.pt(), nsigmaTPCPi, multiplicity);
14971498
}
14981499
} else {
@@ -1502,9 +1503,9 @@ struct tofSpectra {
15021503
}
15031504
if (isTPCKaon && rapidityKa <= trkselOptions.cfgCutY) {
15041505
if (usePDGcode) {
1505-
if (pdgCode == 321) {
1506+
if (pdgCode == o2::constants::physics::Pdg::kKPlus) {
15061507
histos.fill(HIST("nsigmatpc/mc_closure/pos/ka"), track.pt(), nsigmaTPCKa, multiplicity);
1507-
} else if (pdgCode == -321) {
1508+
} else if (pdgCode == o2::constants::physics::Pdg::kKMinus) {
15081509
histos.fill(HIST("nsigmatpc/mc_closure/neg/ka"), track.pt(), nsigmaTPCKa, multiplicity);
15091510
}
15101511
} else {
@@ -1514,9 +1515,9 @@ struct tofSpectra {
15141515
}
15151516
if (isTPCProton && rapidityPr <= trkselOptions.cfgCutY) {
15161517
if (usePDGcode) {
1517-
if (pdgCode == 2212) {
1518+
if (pdgCode == o2::constants::physics::Pdg::kProton) {
15181519
histos.fill(HIST("nsigmatpc/mc_closure/pos/pr"), track.pt(), nsigmaTPCPr, multiplicity);
1519-
} else if (pdgCode == -2212) {
1520+
} else if (pdgCode == o2::constants::physics::Pdg::kProtonBar) {
15201521
histos.fill(HIST("nsigmatpc/mc_closure/neg/pr"), track.pt(), nsigmaTPCPr, multiplicity);
15211522
}
15221523
} else {
@@ -1528,9 +1529,9 @@ struct tofSpectra {
15281529
// TOF Selection and Histogram Filling
15291530
if (isTOFPion && rapidityPi <= trkselOptions.cfgCutY) {
15301531
if (usePDGcode) {
1531-
if (pdgCode == 211) {
1532+
if (pdgCode == o2::constants::physics::Pdg::kPiPlus) {
15321533
histos.fill(HIST("nsigmatof/mc_closure/pos/pi"), track.pt(), nsigmaTOFPi, multiplicity);
1533-
} else if (pdgCode == -211) {
1534+
} else if (pdgCode == o2::constants::physics::Pdg::kPiMinus) {
15341535
histos.fill(HIST("nsigmatof/mc_closure/neg/pi"), track.pt(), nsigmaTOFPi, multiplicity);
15351536
}
15361537
} else {
@@ -1540,9 +1541,9 @@ struct tofSpectra {
15401541
}
15411542
if (isTOFKaon && rapidityKa <= trkselOptions.cfgCutY) {
15421543
if (usePDGcode) {
1543-
if (pdgCode == 321) {
1544+
if (pdgCode == o2::constants::physics::Pdg::kKPlus) {
15441545
histos.fill(HIST("nsigmatof/mc_closure/pos/ka"), track.pt(), nsigmaTOFKa, multiplicity);
1545-
} else if (pdgCode == -321) {
1546+
} else if (pdgCode == o2::constants::physics::Pdg::kKMinus) {
15461547
histos.fill(HIST("nsigmatof/mc_closure/neg/ka"), track.pt(), nsigmaTOFKa, multiplicity);
15471548
}
15481549
} else {
@@ -1552,9 +1553,9 @@ struct tofSpectra {
15521553
}
15531554
if (isTOFProton && rapidityPr <= trkselOptions.cfgCutY) {
15541555
if (usePDGcode) {
1555-
if (pdgCode == 2212) {
1556+
if (pdgCode == o2::constants::physics::Pdg::kProton) {
15561557
histos.fill(HIST("nsigmatof/mc_closure/pos/pr"), track.pt(), nsigmaTOFPr, multiplicity);
1557-
} else if (pdgCode == -2212) {
1558+
} else if (pdgCode == o2::constants::physics::Pdg::kProtonBar) {
15581559
histos.fill(HIST("nsigmatof/mc_closure/neg/pr"), track.pt(), nsigmaTOFPr, multiplicity);
15591560
}
15601561
} else {
@@ -2109,7 +2110,7 @@ struct tofSpectra {
21092110
histos.fill(HIST(hpt_num_prm[i]), track.pt(), multiplicity);
21102111
}
21112112
if (isPionTPC || isKaonTPC || isProtonTPC) {
2112-
if (pdgCode == 2212) {
2113+
if (pdgCode == o2::constants::physics::Pdg::kProton) {
21132114
if (isImpactParam) {
21142115
histos.fill(HIST("MC/withPID/pr/pos/prm/pt/num"), track.pt(), impParam);
21152116
if (!mcParticle.isPhysicalPrimary()) {
@@ -2129,7 +2130,7 @@ struct tofSpectra {
21292130
}
21302131
}
21312132
}
2132-
} else if (pdgCode == -2212) {
2133+
} else if (pdgCode == o2::constants::physics::Pdg::kProtonBar) {
21332134
if (isImpactParam) {
21342135
histos.fill(HIST("MC/withPID/pr/neg/prm/pt/num"), track.pt(), impParam);
21352136
if (!mcParticle.isPhysicalPrimary()) {
@@ -2149,7 +2150,7 @@ struct tofSpectra {
21492150
}
21502151
}
21512152
}
2152-
} else if (pdgCode == 211) {
2153+
} else if (pdgCode == o2::constants::physics::Pdg::kPiPlus) {
21532154
if (isImpactParam) {
21542155
histos.fill(HIST("MC/withPID/pi/pos/prm/pt/num"), track.pt(), impParam);
21552156
if (!mcParticle.isPhysicalPrimary()) {
@@ -2169,7 +2170,7 @@ struct tofSpectra {
21692170
}
21702171
}
21712172
}
2172-
} else if (pdgCode == -211) {
2173+
} else if (pdgCode == o2::constants::physics::Pdg::kPiMinus) {
21732174
if (isImpactParam) {
21742175
histos.fill(HIST("MC/withPID/pi/neg/prm/pt/num"), track.pt(), impParam);
21752176
if (!mcParticle.isPhysicalPrimary()) {
@@ -2189,7 +2190,7 @@ struct tofSpectra {
21892190
}
21902191
}
21912192
}
2192-
} else if (pdgCode == 321) {
2193+
} else if (pdgCode == o2::constants::physics::Pdg::kKPlus) {
21932194
if (isImpactParam) {
21942195
histos.fill(HIST("MC/withPID/ka/pos/prm/pt/num"), track.pt(), impParam);
21952196
if (!mcParticle.isPhysicalPrimary()) {
@@ -2209,7 +2210,7 @@ struct tofSpectra {
22092210
}
22102211
}
22112212
}
2212-
} else if (pdgCode == -321) {
2213+
} else if (pdgCode == o2::constants::physics::Pdg::kKMinus) {
22132214
if (isImpactParam) {
22142215
histos.fill(HIST("MC/withPID/ka/neg/prm/pt/num"), track.pt(), impParam);
22152216
if (!mcParticle.isPhysicalPrimary()) {
@@ -2246,7 +2247,7 @@ struct tofSpectra {
22462247
if (track.hasTOF()) {
22472248
if (isPionTOF || isKaonTOF || isProtonTOF) {
22482249
// Proton (positive)
2249-
if (pdgCode == 2212) {
2250+
if (pdgCode == o2::constants::physics::Pdg::kProton) {
22502251
if (isImpactParam) {
22512252
histos.fill(HIST("MC/withPID/pr/pos/prm/pt/numtof"), track.pt(), impParam);
22522253
} else {
@@ -2260,7 +2261,7 @@ struct tofSpectra {
22602261
histos.fill(HIST("MC/withPID/pr/pos/prm/pt/numtof_matched"), track.pt(), multiplicity);
22612262
}
22622263
}
2263-
} else if (pdgCode == -2212) {
2264+
} else if (pdgCode == o2::constants::physics::Pdg::kProtonBar) {
22642265
if (isImpactParam) {
22652266
histos.fill(HIST("MC/withPID/pr/neg/prm/pt/numtof"), track.pt(), impParam);
22662267
} else {
@@ -2273,7 +2274,7 @@ struct tofSpectra {
22732274
histos.fill(HIST("MC/withPID/pr/neg/prm/pt/numtof_matched"), track.pt(), multiplicity);
22742275
}
22752276
}
2276-
} else if (pdgCode == 211) {
2277+
} else if (pdgCode == o2::constants::physics::Pdg::kPiPlus) {
22772278
if (isImpactParam) {
22782279
histos.fill(HIST("MC/withPID/pi/pos/prm/pt/numtof"), track.pt(), impParam);
22792280
} else {
@@ -2287,7 +2288,7 @@ struct tofSpectra {
22872288
histos.fill(HIST("MC/withPID/pi/pos/prm/pt/numtof_matched"), track.pt(), multiplicity);
22882289
}
22892290
}
2290-
} else if (pdgCode == -211) {
2291+
} else if (pdgCode == o2::constants::physics::Pdg::kPiMinus) {
22912292
if (isImpactParam) {
22922293
histos.fill(HIST("MC/withPID/pi/neg/prm/pt/numtof"), track.pt(), impParam);
22932294
} else {
@@ -2301,7 +2302,7 @@ struct tofSpectra {
23012302
histos.fill(HIST("MC/withPID/pi/neg/prm/pt/numtof_matched"), track.pt(), multiplicity);
23022303
}
23032304
}
2304-
} else if (pdgCode == 321) {
2305+
} else if (pdgCode == o2::constants::physics::Pdg::kKPlus) {
23052306
if (isImpactParam) {
23062307
histos.fill(HIST("MC/withPID/ka/pos/prm/pt/numtof"), track.pt(), impParam);
23072308
} else {
@@ -2315,7 +2316,7 @@ struct tofSpectra {
23152316
histos.fill(HIST("MC/withPID/ka/pos/prm/pt/numtof_matched"), track.pt(), multiplicity);
23162317
}
23172318
}
2318-
} else if (pdgCode == -321) {
2319+
} else if (pdgCode == o2::constants::physics::Pdg::kKMinus) {
23192320
if (isImpactParam) {
23202321
histos.fill(HIST("MC/withPID/ka/neg/prm/pt/numtof"), track.pt(), impParam);
23212322
} else {
@@ -2659,17 +2660,17 @@ struct tofSpectra {
26592660
continue;
26602661
}
26612662

2662-
if (pdgCode == 2212) {
2663+
if (pdgCode == o2::constants::physics::Pdg::kProton) {
26632664
histos.fill(HIST("MC/test/pr/pos/prm/pt/den"), pt, multiplicity);
2664-
} else if (pdgCode == -2212) {
2665+
} else if (pdgCode == o2::constants::physics::Pdg::kProtonBar) {
26652666
histos.fill(HIST("MC/test/pr/neg/prm/pt/den"), pt, multiplicity);
2666-
} else if (pdgCode == 211) {
2667+
} else if (pdgCode == o2::constants::physics::Pdg::kPiPlus) {
26672668
histos.fill(HIST("MC/test/pi/pos/prm/pt/den"), pt, multiplicity);
2668-
} else if (pdgCode == -211) {
2669+
} else if (pdgCode == o2::constants::physics::Pdg::kPiMinus) {
26692670
histos.fill(HIST("MC/test/pi/neg/prm/pt/den"), pt, multiplicity);
2670-
} else if (pdgCode == 321) {
2671+
} else if (pdgCode == o2::constants::physics::Pdg::kKPlus) {
26712672
histos.fill(HIST("MC/test/ka/pos/prm/pt/den"), pt, multiplicity);
2672-
} else if (pdgCode == -321) {
2673+
} else if (pdgCode == o2::constants::physics::Pdg::kKMinus) {
26732674
histos.fill(HIST("MC/test/ka/neg/prm/pt/den"), pt, multiplicity);
26742675
}
26752676
}
@@ -2740,33 +2741,33 @@ struct tofSpectra {
27402741
const bool isProtonTOF = track.hasTOF() && std::abs(nsigmaTOFPr) < trkselOptions.cfgCutNsigma;
27412742

27422743
if (isPionTPC || isKaonTPC || isProtonTPC) {
2743-
if (pdgCode == 2212) {
2744+
if (pdgCode == o2::constants::physics::Pdg::kProton) {
27442745
histos.fill(HIST("MC/test/RecoEvs/pr/pos/prm/pt/num"), pt, multiplicity);
2745-
} else if (pdgCode == -2212) {
2746+
} else if (pdgCode == o2::constants::physics::Pdg::kProtonBar) {
27462747
histos.fill(HIST("MC/test/RecoEvs/pr/neg/prm/pt/num"), pt, multiplicity);
2747-
} else if (pdgCode == 211) {
2748+
} else if (pdgCode == o2::constants::physics::Pdg::kPiPlus) {
27482749
histos.fill(HIST("MC/test/RecoEvs/pi/pos/prm/pt/num"), pt, multiplicity);
2749-
} else if (pdgCode == -211) {
2750+
} else if (pdgCode == o2::constants::physics::Pdg::kPiMinus) {
27502751
histos.fill(HIST("MC/test/RecoEvs/pi/neg/prm/pt/num"), pt, multiplicity);
2751-
} else if (pdgCode == 321) {
2752+
} else if (pdgCode == o2::constants::physics::Pdg::kKPlus) {
27522753
histos.fill(HIST("MC/test/RecoEvs/ka/pos/prm/pt/num"), pt, multiplicity);
2753-
} else if (pdgCode == -321) {
2754+
} else if (pdgCode == o2::constants::physics::Pdg::kKMinus) {
27542755
histos.fill(HIST("MC/test/RecoEvs/ka/neg/prm/pt/num"), pt, multiplicity);
27552756
}
27562757
}
27572758

27582759
if (isPionTOF || isKaonTOF || isProtonTOF) {
2759-
if (pdgCode == 2212) {
2760+
if (pdgCode == o2::constants::physics::Pdg::kProton) {
27602761
histos.fill(HIST("MC/test/RecoEvs/pr/pos/prm/pt/numtof"), pt, multiplicity);
2761-
} else if (pdgCode == -2212) {
2762+
} else if (pdgCode == o2::constants::physics::Pdg::kProtonBar) {
27622763
histos.fill(HIST("MC/test/RecoEvs/pr/neg/prm/pt/numtof"), pt, multiplicity);
2763-
} else if (pdgCode == 211) {
2764+
} else if (pdgCode == o2::constants::physics::Pdg::kPiPlus) {
27642765
histos.fill(HIST("MC/test/RecoEvs/pi/pos/prm/pt/numtof"), pt, multiplicity);
2765-
} else if (pdgCode == -211) {
2766+
} else if (pdgCode == o2::constants::physics::Pdg::kPiMinus) {
27662767
histos.fill(HIST("MC/test/RecoEvs/pi/neg/prm/pt/numtof"), pt, multiplicity);
2767-
} else if (pdgCode == 321) {
2768+
} else if (pdgCode == o2::constants::physics::Pdg::kKPlus) {
27682769
histos.fill(HIST("MC/test/RecoEvs/ka/pos/prm/pt/numtof"), pt, multiplicity);
2769-
} else if (pdgCode == -321) {
2770+
} else if (pdgCode == o2::constants::physics::Pdg::kKMinus) {
27702771
histos.fill(HIST("MC/test/RecoEvs/ka/neg/prm/pt/numtof"), pt, multiplicity);
27712772
}
27722773
}

0 commit comments

Comments
 (0)