Skip to content

Commit 0d493d3

Browse files
committed
Fixed the O2 linter errors in spectraTOF.cxx tes1t
1 parent a506334 commit 0d493d3

File tree

1 file changed

+42
-44
lines changed

1 file changed

+42
-44
lines changed

PWGLF/Tasks/Nuspex/spectraTOF.cxx

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ std::array<std::shared_ptr<TH2>, NpCharge> hPtNumTOFMatchWithPIDSignalPrm; // Pt
8080

8181
std::array<std::array<std::shared_ptr<TH3>, NpCharge>, 3> hMCpdg_nsigmaTPC; // 2D array of nsigmaTPC histograms [Selection: pi,K,p][True PDG: 18 species]
8282

83-
int indexPi = 2, indexKa = 3, indexPr = 4;
84-
8583
// Spectra task
8684
struct tofSpectra {
8785
struct : ConfigurableGroup {
@@ -1508,9 +1506,9 @@ struct tofSpectra {
15081506
if (mcParticle.isPhysicalPrimary()) {
15091507
if (isTPCPion && rapidityPi <= trkselOptions.cfgCutY) {
15101508
if (usePDGcode) {
1511-
if (pdgCode == PDGs[indexPi]) {
1509+
if (pdgCode == kPiPlus) {
15121510
histos.fill(HIST("nsigmatpc/mc_closure/pos/pi"), track.pt(), nsigmaTPCPi, multiplicity);
1513-
} else if (pdgCode == PDGs[indexPi+Np]) {
1511+
} else if (pdgCode == -kPiPlus) {
15141512
histos.fill(HIST("nsigmatpc/mc_closure/neg/pi"), track.pt(), nsigmaTPCPi, multiplicity);
15151513
}
15161514
} else {
@@ -1520,9 +1518,9 @@ struct tofSpectra {
15201518
}
15211519
if (isTPCKaon && rapidityKa <= trkselOptions.cfgCutY) {
15221520
if (usePDGcode) {
1523-
if (pdgCode == PDGs[indexKa]) {
1521+
if (pdgCode == kKPlus) {
15241522
histos.fill(HIST("nsigmatpc/mc_closure/pos/ka"), track.pt(), nsigmaTPCKa, multiplicity);
1525-
} else if (pdgCode == PDGs[indexKa+Np]) {
1523+
} else if (pdgCode == -kKPlus) {
15261524
histos.fill(HIST("nsigmatpc/mc_closure/neg/ka"), track.pt(), nsigmaTPCKa, multiplicity);
15271525
}
15281526
} else {
@@ -1532,9 +1530,9 @@ struct tofSpectra {
15321530
}
15331531
if (isTPCProton && rapidityPr <= trkselOptions.cfgCutY) {
15341532
if (usePDGcode) {
1535-
if (pdgCode == PDGs[indexPr]) {
1533+
if (pdgCode == kProton) {
15361534
histos.fill(HIST("nsigmatpc/mc_closure/pos/pr"), track.pt(), nsigmaTPCPr, multiplicity);
1537-
} else if (pdgCode == PDGs[indexPr+Np]) {
1535+
} else if (pdgCode == -kProton) {
15381536
histos.fill(HIST("nsigmatpc/mc_closure/neg/pr"), track.pt(), nsigmaTPCPr, multiplicity);
15391537
}
15401538
} else {
@@ -1548,7 +1546,7 @@ struct tofSpectra {
15481546
if (usePDGcode) {
15491547
if (pdgCode == kPiPlus) {
15501548
histos.fill(HIST("nsigmatof/mc_closure/pos/pi"), track.pt(), nsigmaTOFPi, multiplicity);
1551-
} else if (pdgCode == PDGs[indexPi+Np]) {
1549+
} else if (pdgCode == -kPiPlus) {
15521550
histos.fill(HIST("nsigmatof/mc_closure/neg/pi"), track.pt(), nsigmaTOFPi, multiplicity);
15531551
}
15541552
} else {
@@ -1558,9 +1556,9 @@ struct tofSpectra {
15581556
}
15591557
if (isTOFKaon && rapidityKa <= trkselOptions.cfgCutY) {
15601558
if (usePDGcode) {
1561-
if (pdgCode == PDGs[indexKa]) {
1559+
if (pdgCode == kKPlus) {
15621560
histos.fill(HIST("nsigmatof/mc_closure/pos/ka"), track.pt(), nsigmaTOFKa, multiplicity);
1563-
} else if (pdgCode == PDGs[indexKa+Np]) {
1561+
} else if (pdgCode == -kKPlus) {
15641562
histos.fill(HIST("nsigmatof/mc_closure/neg/ka"), track.pt(), nsigmaTOFKa, multiplicity);
15651563
}
15661564
} else {
@@ -1570,9 +1568,9 @@ struct tofSpectra {
15701568
}
15711569
if (isTOFProton && rapidityPr <= trkselOptions.cfgCutY) {
15721570
if (usePDGcode) {
1573-
if (pdgCode == PDGs[indexPr]) {
1571+
if (pdgCode == kProton) {
15741572
histos.fill(HIST("nsigmatof/mc_closure/pos/pr"), track.pt(), nsigmaTOFPr, multiplicity);
1575-
} else if (pdgCode == PDGs[indexPr+Np]) {
1573+
} else if (pdgCode == -kProton) {
15761574
histos.fill(HIST("nsigmatof/mc_closure/neg/pr"), track.pt(), nsigmaTOFPr, multiplicity);
15771575
}
15781576
} else {
@@ -1612,7 +1610,7 @@ struct tofSpectra {
16121610
for (const auto& track : tracks) {
16131611
// Track selection criteria
16141612
/* if (track.tpcNClsCrossedRows() < minNCrossedRowsTPC || track.tpcChi2NCl() > maxChi2PerClusterTPC || track.tpcChi2NCl() > maxChi2PerClusterTPC ||
1615-
track.itsChi2NCl() > maxChi2PerClusterITS || std::abs(track.dcaXY()) > maxDcaXYFactor.value * (0.0105f + 0.0350f / std::pow(track.pt(), 1.1f)) || std::abs(track.dcaZ()) > maxDcaZ.value || track.eta() < trkselOptions.cfgCutEtaMin || track.eta() > trkselOptions.cfgCutEtaMax || track.tpcCrossedRowsOverFindableCls() < minNCrossedRowsOverFindableClustersTPC || track.tpcNClsFound() < minTPCNClsFound ||
1613+
track.itsChi2NCl() > maxChi2PerClusterITS || std::abs(track.dcaXY()) > maxDcaXYFactor.value * (0.0105f + 0.0350f / pow(track.pt(), 1.1f)) || std::abs(track.dcaZ()) > maxDcaZ.value || track.eta() < trkselOptions.cfgCutEtaMin || track.eta() > trkselOptions.cfgCutEtaMax || track.tpcCrossedRowsOverFindableCls() < minNCrossedRowsOverFindableClustersTPC || track.tpcNClsFound() < minTPCNClsFound ||
16161614
!(o2::aod::track::ITSrefit) || !(o2::aod::track::TPCrefit)) {
16171615
continue;
16181616
}*/
@@ -2131,7 +2129,7 @@ struct tofSpectra {
21312129
histos.fill(HIST(hpt_num_prm[i]), track.pt(), multiplicity);
21322130
}
21332131
if (isPionTPC || isKaonTPC || isProtonTPC) {
2134-
if (pdgCode == 2212) {
2132+
if (pdgCode == kProton) {
21352133
if (isImpactParam) {
21362134
histos.fill(HIST("MC/withPID/pr/pos/prm/pt/num"), track.pt(), impParam);
21372135
if (!mcParticle.isPhysicalPrimary()) {
@@ -2151,7 +2149,7 @@ struct tofSpectra {
21512149
}
21522150
}
21532151
}
2154-
} else if (pdgCode == -2212) {
2152+
} else if (pdgCode == -kProton) {
21552153
if (isImpactParam) {
21562154
histos.fill(HIST("MC/withPID/pr/neg/prm/pt/num"), track.pt(), impParam);
21572155
if (!mcParticle.isPhysicalPrimary()) {
@@ -2171,7 +2169,7 @@ struct tofSpectra {
21712169
}
21722170
}
21732171
}
2174-
} else if (pdgCode == PDGs[indexPi]) {
2172+
} else if (pdgCode == kPiPlus) {
21752173
if (isImpactParam) {
21762174
histos.fill(HIST("MC/withPID/pi/pos/prm/pt/num"), track.pt(), impParam);
21772175
if (!mcParticle.isPhysicalPrimary()) {
@@ -2191,7 +2189,7 @@ struct tofSpectra {
21912189
}
21922190
}
21932191
}
2194-
} else if (pdgCode == PDGs[indexPi+Np]) {
2192+
} else if (pdgCode == -kPiPlus) {
21952193
if (isImpactParam) {
21962194
histos.fill(HIST("MC/withPID/pi/neg/prm/pt/num"), track.pt(), impParam);
21972195
if (!mcParticle.isPhysicalPrimary()) {
@@ -2211,7 +2209,7 @@ struct tofSpectra {
22112209
}
22122210
}
22132211
}
2214-
} else if (pdgCode == PDGs[indexKa]) {
2212+
} else if (pdgCode == kKPlus) {
22152213
if (isImpactParam) {
22162214
histos.fill(HIST("MC/withPID/ka/pos/prm/pt/num"), track.pt(), impParam);
22172215
if (!mcParticle.isPhysicalPrimary()) {
@@ -2231,7 +2229,7 @@ struct tofSpectra {
22312229
}
22322230
}
22332231
}
2234-
} else if (pdgCode == PDGs[indexKa+Np]) {
2232+
} else if (pdgCode == -kKPlus) {
22352233
if (isImpactParam) {
22362234
histos.fill(HIST("MC/withPID/ka/neg/prm/pt/num"), track.pt(), impParam);
22372235
if (!mcParticle.isPhysicalPrimary()) {
@@ -2268,7 +2266,7 @@ struct tofSpectra {
22682266
if (track.hasTOF()) {
22692267
if (isPionTOF || isKaonTOF || isProtonTOF) {
22702268
// Proton (positive)
2271-
if (pdgCode == PDGs[indexPr]) {
2269+
if (pdgCode == kProton) {
22722270
if (isImpactParam) {
22732271
histos.fill(HIST("MC/withPID/pr/pos/prm/pt/numtof"), track.pt(), impParam);
22742272
} else {
@@ -2282,7 +2280,7 @@ struct tofSpectra {
22822280
histos.fill(HIST("MC/withPID/pr/pos/prm/pt/numtof_matched"), track.pt(), multiplicity);
22832281
}
22842282
}
2285-
} else if (pdgCode == PDGs[indexPr+Np]) {
2283+
} else if (pdgCode == -kProton) {
22862284
if (isImpactParam) {
22872285
histos.fill(HIST("MC/withPID/pr/neg/prm/pt/numtof"), track.pt(), impParam);
22882286
} else {
@@ -2295,7 +2293,7 @@ struct tofSpectra {
22952293
histos.fill(HIST("MC/withPID/pr/neg/prm/pt/numtof_matched"), track.pt(), multiplicity);
22962294
}
22972295
}
2298-
} else if (pdgCode == PDGs[indexPi]) {
2296+
} else if (pdgCode == kPiPlus) {
22992297
if (isImpactParam) {
23002298
histos.fill(HIST("MC/withPID/pi/pos/prm/pt/numtof"), track.pt(), impParam);
23012299
} else {
@@ -2309,7 +2307,7 @@ struct tofSpectra {
23092307
histos.fill(HIST("MC/withPID/pi/pos/prm/pt/numtof_matched"), track.pt(), multiplicity);
23102308
}
23112309
}
2312-
} else if (pdgCode == PDGs[indexPi+Np]) {
2310+
} else if (pdgCode == -kPiPlus) {
23132311
if (isImpactParam) {
23142312
histos.fill(HIST("MC/withPID/pi/neg/prm/pt/numtof"), track.pt(), impParam);
23152313
} else {
@@ -2323,7 +2321,7 @@ struct tofSpectra {
23232321
histos.fill(HIST("MC/withPID/pi/neg/prm/pt/numtof_matched"), track.pt(), multiplicity);
23242322
}
23252323
}
2326-
} else if (pdgCode == PDGs[indexKa]) {
2324+
} else if (pdgCode == kKPlus) {
23272325
if (isImpactParam) {
23282326
histos.fill(HIST("MC/withPID/ka/pos/prm/pt/numtof"), track.pt(), impParam);
23292327
} else {
@@ -2337,7 +2335,7 @@ struct tofSpectra {
23372335
histos.fill(HIST("MC/withPID/ka/pos/prm/pt/numtof_matched"), track.pt(), multiplicity);
23382336
}
23392337
}
2340-
} else if (pdgCode == PDGs[indexKa+Np]) {
2338+
} else if (pdgCode == -kKPlus) {
23412339
if (isImpactParam) {
23422340
histos.fill(HIST("MC/withPID/ka/neg/prm/pt/numtof"), track.pt(), impParam);
23432341
} else {
@@ -2681,17 +2679,17 @@ struct tofSpectra {
26812679
continue;
26822680
}
26832681

2684-
if (pdgCode == PDGs[indexPr]) {
2682+
if (pdgCode == kProton) {
26852683
histos.fill(HIST("MC/test/pr/pos/prm/pt/den"), pt, multiplicity);
2686-
} else if (pdgCode == PDGs[indexPr+Np]) {
2684+
} else if (pdgCode == -kProton) {
26872685
histos.fill(HIST("MC/test/pr/neg/prm/pt/den"), pt, multiplicity);
2688-
} else if (pdgCode == PDGs[indexPi]) {
2686+
} else if (pdgCode == kPiPlus) {
26892687
histos.fill(HIST("MC/test/pi/pos/prm/pt/den"), pt, multiplicity);
2690-
} else if (pdgCode == PDGs[indexPi+Np]) {
2688+
} else if (pdgCode == -kPiPlus) {
26912689
histos.fill(HIST("MC/test/pi/neg/prm/pt/den"), pt, multiplicity);
2692-
} else if (pdgCode == PDGs[indexKa]) {
2690+
} else if (pdgCode == kKPlus) {
26932691
histos.fill(HIST("MC/test/ka/pos/prm/pt/den"), pt, multiplicity);
2694-
} else if (pdgCode == PDGs[indexKa+Np]) {
2692+
} else if (pdgCode == -kKPlus) {
26952693
histos.fill(HIST("MC/test/ka/neg/prm/pt/den"), pt, multiplicity);
26962694
}
26972695
}
@@ -2762,33 +2760,33 @@ struct tofSpectra {
27622760
const bool isProtonTOF = track.hasTOF() && std::abs(nsigmaTOFPr) < trkselOptions.cfgCutNsigma;
27632761

27642762
if (isPionTPC || isKaonTPC || isProtonTPC) {
2765-
if (pdgCode == PDGs[indexPr]) {
2763+
if (pdgCode == kProton) {
27662764
histos.fill(HIST("MC/test/RecoEvs/pr/pos/prm/pt/num"), pt, multiplicity);
2767-
} else if (pdgCode == PDGs[indexPr+Np]) {
2765+
} else if (pdgCode == -kProton) {
27682766
histos.fill(HIST("MC/test/RecoEvs/pr/neg/prm/pt/num"), pt, multiplicity);
2769-
} else if (pdgCode == PDGs[indexPi]) {
2767+
} else if (pdgCode == kPiPlus) {
27702768
histos.fill(HIST("MC/test/RecoEvs/pi/pos/prm/pt/num"), pt, multiplicity);
2771-
} else if (pdgCode == PDGs[indexPi+Np]) {
2769+
} else if (pdgCode == -kPiPlus) {
27722770
histos.fill(HIST("MC/test/RecoEvs/pi/neg/prm/pt/num"), pt, multiplicity);
2773-
} else if (pdgCode == PDGs[indexKa]) {
2771+
} else if (pdgCode == kKPlus) {
27742772
histos.fill(HIST("MC/test/RecoEvs/ka/pos/prm/pt/num"), pt, multiplicity);
2775-
} else if (pdgCode == PDGs[indexKa+Np]) {
2773+
} else if (pdgCode == -kKPlus) {
27762774
histos.fill(HIST("MC/test/RecoEvs/ka/neg/prm/pt/num"), pt, multiplicity);
27772775
}
27782776
}
27792777

27802778
if (isPionTOF || isKaonTOF || isProtonTOF) {
2781-
if (pdgCode == PDGs[indexPr]) {
2779+
if (pdgCode == kProton) {
27822780
histos.fill(HIST("MC/test/RecoEvs/pr/pos/prm/pt/numtof"), pt, multiplicity);
2783-
} else if (pdgCode == PDGs[indexPr+Np]) {
2781+
} else if (pdgCode == -kProton) {
27842782
histos.fill(HIST("MC/test/RecoEvs/pr/neg/prm/pt/numtof"), pt, multiplicity);
2785-
} else if (pdgCode == PDGs[indexPi]) {
2783+
} else if (pdgCode == kPiPlus) {
27862784
histos.fill(HIST("MC/test/RecoEvs/pi/pos/prm/pt/numtof"), pt, multiplicity);
2787-
} else if (pdgCode == PDGs[indexPi+Np]) {
2785+
} else if (pdgCode == -kPiPlus) {
27882786
histos.fill(HIST("MC/test/RecoEvs/pi/neg/prm/pt/numtof"), pt, multiplicity);
2789-
} else if (pdgCode == PDGs[indexKa]) {
2787+
} else if (pdgCode == kKPlus) {
27902788
histos.fill(HIST("MC/test/RecoEvs/ka/pos/prm/pt/numtof"), pt, multiplicity);
2791-
} else if (pdgCode == PDGs[indexKa+Np]) {
2789+
} else if (pdgCode == -kKPlus) {
27922790
histos.fill(HIST("MC/test/RecoEvs/ka/neg/prm/pt/numtof"), pt, multiplicity);
27932791
}
27942792
}

0 commit comments

Comments
 (0)