@@ -80,6 +80,8 @@ std::array<std::shared_ptr<TH2>, NpCharge> hPtNumTOFMatchWithPIDSignalPrm; // Pt
8080
8181std::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+
8385// Spectra task
8486struct tofSpectra {
8587 struct : ConfigurableGroup {
@@ -1506,9 +1508,9 @@ struct tofSpectra {
15061508 if (mcParticle.isPhysicalPrimary ()) {
15071509 if (isTPCPion && rapidityPi <= trkselOptions.cfgCutY ) {
15081510 if (usePDGcode) {
1509- if (pdgCode == 211 ) {
1511+ if (pdgCode == PDGs[indexPi] ) {
15101512 histos.fill (HIST (" nsigmatpc/mc_closure/pos/pi" ), track.pt (), nsigmaTPCPi, multiplicity);
1511- } else if (pdgCode == - 211 ) {
1513+ } else if (pdgCode == PDGs[indexPi+Np] ) {
15121514 histos.fill (HIST (" nsigmatpc/mc_closure/neg/pi" ), track.pt (), nsigmaTPCPi, multiplicity);
15131515 }
15141516 } else {
@@ -1518,9 +1520,9 @@ struct tofSpectra {
15181520 }
15191521 if (isTPCKaon && rapidityKa <= trkselOptions.cfgCutY ) {
15201522 if (usePDGcode) {
1521- if (pdgCode == 321 ) {
1523+ if (pdgCode == PDGs[indexKa] ) {
15221524 histos.fill (HIST (" nsigmatpc/mc_closure/pos/ka" ), track.pt (), nsigmaTPCKa, multiplicity);
1523- } else if (pdgCode == - 321 ) {
1525+ } else if (pdgCode == PDGs[indexKa+Np] ) {
15241526 histos.fill (HIST (" nsigmatpc/mc_closure/neg/ka" ), track.pt (), nsigmaTPCKa, multiplicity);
15251527 }
15261528 } else {
@@ -1530,9 +1532,9 @@ struct tofSpectra {
15301532 }
15311533 if (isTPCProton && rapidityPr <= trkselOptions.cfgCutY ) {
15321534 if (usePDGcode) {
1533- if (pdgCode == 2212 ) {
1535+ if (pdgCode == PDGs[indexPr] ) {
15341536 histos.fill (HIST (" nsigmatpc/mc_closure/pos/pr" ), track.pt (), nsigmaTPCPr, multiplicity);
1535- } else if (pdgCode == - 2212 ) {
1537+ } else if (pdgCode == PDGs[indexPr+Np] ) {
15361538 histos.fill (HIST (" nsigmatpc/mc_closure/neg/pr" ), track.pt (), nsigmaTPCPr, multiplicity);
15371539 }
15381540 } else {
@@ -1544,9 +1546,9 @@ struct tofSpectra {
15441546 // TOF Selection and Histogram Filling
15451547 if (isTOFPion && rapidityPi <= trkselOptions.cfgCutY ) {
15461548 if (usePDGcode) {
1547- if (pdgCode == 211 ) {
1549+ if (pdgCode == kPiPlus ) {
15481550 histos.fill (HIST (" nsigmatof/mc_closure/pos/pi" ), track.pt (), nsigmaTOFPi, multiplicity);
1549- } else if (pdgCode == - 211 ) {
1551+ } else if (pdgCode == PDGs[indexPi+Np] ) {
15501552 histos.fill (HIST (" nsigmatof/mc_closure/neg/pi" ), track.pt (), nsigmaTOFPi, multiplicity);
15511553 }
15521554 } else {
@@ -1556,9 +1558,9 @@ struct tofSpectra {
15561558 }
15571559 if (isTOFKaon && rapidityKa <= trkselOptions.cfgCutY ) {
15581560 if (usePDGcode) {
1559- if (pdgCode == 321 ) {
1561+ if (pdgCode == PDGs[indexKa] ) {
15601562 histos.fill (HIST (" nsigmatof/mc_closure/pos/ka" ), track.pt (), nsigmaTOFKa, multiplicity);
1561- } else if (pdgCode == - 321 ) {
1563+ } else if (pdgCode == PDGs[indexKa+Np] ) {
15621564 histos.fill (HIST (" nsigmatof/mc_closure/neg/ka" ), track.pt (), nsigmaTOFKa, multiplicity);
15631565 }
15641566 } else {
@@ -1568,9 +1570,9 @@ struct tofSpectra {
15681570 }
15691571 if (isTOFProton && rapidityPr <= trkselOptions.cfgCutY ) {
15701572 if (usePDGcode) {
1571- if (pdgCode == 2212 ) {
1573+ if (pdgCode == PDGs[indexPr] ) {
15721574 histos.fill (HIST (" nsigmatof/mc_closure/pos/pr" ), track.pt (), nsigmaTOFPr, multiplicity);
1573- } else if (pdgCode == - 2212 ) {
1575+ } else if (pdgCode == PDGs[indexPr+Np] ) {
15741576 histos.fill (HIST (" nsigmatof/mc_closure/neg/pr" ), track.pt (), nsigmaTOFPr, multiplicity);
15751577 }
15761578 } else {
@@ -1610,7 +1612,7 @@ struct tofSpectra {
16101612 for (const auto & track : tracks) {
16111613 // Track selection criteria
16121614 /* if (track.tpcNClsCrossedRows() < minNCrossedRowsTPC || track.tpcChi2NCl() > maxChi2PerClusterTPC || track.tpcChi2NCl() > maxChi2PerClusterTPC ||
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 ||
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 ||
16141616 !(o2::aod::track::ITSrefit) || !(o2::aod::track::TPCrefit)) {
16151617 continue;
16161618 }*/
@@ -2169,7 +2171,7 @@ struct tofSpectra {
21692171 }
21702172 }
21712173 }
2172- } else if (pdgCode == 211 ) {
2174+ } else if (pdgCode == PDGs[indexPi] ) {
21732175 if (isImpactParam) {
21742176 histos.fill (HIST (" MC/withPID/pi/pos/prm/pt/num" ), track.pt (), impParam);
21752177 if (!mcParticle.isPhysicalPrimary ()) {
@@ -2189,7 +2191,7 @@ struct tofSpectra {
21892191 }
21902192 }
21912193 }
2192- } else if (pdgCode == - 211 ) {
2194+ } else if (pdgCode == PDGs[indexPi+Np] ) {
21932195 if (isImpactParam) {
21942196 histos.fill (HIST (" MC/withPID/pi/neg/prm/pt/num" ), track.pt (), impParam);
21952197 if (!mcParticle.isPhysicalPrimary ()) {
@@ -2209,7 +2211,7 @@ struct tofSpectra {
22092211 }
22102212 }
22112213 }
2212- } else if (pdgCode == 321 ) {
2214+ } else if (pdgCode == PDGs[indexKa] ) {
22132215 if (isImpactParam) {
22142216 histos.fill (HIST (" MC/withPID/ka/pos/prm/pt/num" ), track.pt (), impParam);
22152217 if (!mcParticle.isPhysicalPrimary ()) {
@@ -2229,7 +2231,7 @@ struct tofSpectra {
22292231 }
22302232 }
22312233 }
2232- } else if (pdgCode == - 321 ) {
2234+ } else if (pdgCode == PDGs[indexKa+Np] ) {
22332235 if (isImpactParam) {
22342236 histos.fill (HIST (" MC/withPID/ka/neg/prm/pt/num" ), track.pt (), impParam);
22352237 if (!mcParticle.isPhysicalPrimary ()) {
@@ -2266,7 +2268,7 @@ struct tofSpectra {
22662268 if (track.hasTOF ()) {
22672269 if (isPionTOF || isKaonTOF || isProtonTOF) {
22682270 // Proton (positive)
2269- if (pdgCode == 2212 ) {
2271+ if (pdgCode == PDGs[indexPr] ) {
22702272 if (isImpactParam) {
22712273 histos.fill (HIST (" MC/withPID/pr/pos/prm/pt/numtof" ), track.pt (), impParam);
22722274 } else {
@@ -2280,7 +2282,7 @@ struct tofSpectra {
22802282 histos.fill (HIST (" MC/withPID/pr/pos/prm/pt/numtof_matched" ), track.pt (), multiplicity);
22812283 }
22822284 }
2283- } else if (pdgCode == - 2212 ) {
2285+ } else if (pdgCode == PDGs[indexPr+Np] ) {
22842286 if (isImpactParam) {
22852287 histos.fill (HIST (" MC/withPID/pr/neg/prm/pt/numtof" ), track.pt (), impParam);
22862288 } else {
@@ -2293,7 +2295,7 @@ struct tofSpectra {
22932295 histos.fill (HIST (" MC/withPID/pr/neg/prm/pt/numtof_matched" ), track.pt (), multiplicity);
22942296 }
22952297 }
2296- } else if (pdgCode == 211 ) {
2298+ } else if (pdgCode == PDGs[indexPi] ) {
22972299 if (isImpactParam) {
22982300 histos.fill (HIST (" MC/withPID/pi/pos/prm/pt/numtof" ), track.pt (), impParam);
22992301 } else {
@@ -2307,7 +2309,7 @@ struct tofSpectra {
23072309 histos.fill (HIST (" MC/withPID/pi/pos/prm/pt/numtof_matched" ), track.pt (), multiplicity);
23082310 }
23092311 }
2310- } else if (pdgCode == - 211 ) {
2312+ } else if (pdgCode == PDGs[indexPi+Np] ) {
23112313 if (isImpactParam) {
23122314 histos.fill (HIST (" MC/withPID/pi/neg/prm/pt/numtof" ), track.pt (), impParam);
23132315 } else {
@@ -2321,7 +2323,7 @@ struct tofSpectra {
23212323 histos.fill (HIST (" MC/withPID/pi/neg/prm/pt/numtof_matched" ), track.pt (), multiplicity);
23222324 }
23232325 }
2324- } else if (pdgCode == 321 ) {
2326+ } else if (pdgCode == PDGs[indexKa] ) {
23252327 if (isImpactParam) {
23262328 histos.fill (HIST (" MC/withPID/ka/pos/prm/pt/numtof" ), track.pt (), impParam);
23272329 } else {
@@ -2335,7 +2337,7 @@ struct tofSpectra {
23352337 histos.fill (HIST (" MC/withPID/ka/pos/prm/pt/numtof_matched" ), track.pt (), multiplicity);
23362338 }
23372339 }
2338- } else if (pdgCode == - 321 ) {
2340+ } else if (pdgCode == PDGs[indexKa+Np] ) {
23392341 if (isImpactParam) {
23402342 histos.fill (HIST (" MC/withPID/ka/neg/prm/pt/numtof" ), track.pt (), impParam);
23412343 } else {
@@ -2679,17 +2681,17 @@ struct tofSpectra {
26792681 continue ;
26802682 }
26812683
2682- if (pdgCode == 2212 ) {
2684+ if (pdgCode == PDGs[indexPr] ) {
26832685 histos.fill (HIST (" MC/test/pr/pos/prm/pt/den" ), pt, multiplicity);
2684- } else if (pdgCode == - 2212 ) {
2686+ } else if (pdgCode == PDGs[indexPr+Np] ) {
26852687 histos.fill (HIST (" MC/test/pr/neg/prm/pt/den" ), pt, multiplicity);
2686- } else if (pdgCode == 211 ) {
2688+ } else if (pdgCode == PDGs[indexPi] ) {
26872689 histos.fill (HIST (" MC/test/pi/pos/prm/pt/den" ), pt, multiplicity);
2688- } else if (pdgCode == - 211 ) {
2690+ } else if (pdgCode == PDGs[indexPi+Np] ) {
26892691 histos.fill (HIST (" MC/test/pi/neg/prm/pt/den" ), pt, multiplicity);
2690- } else if (pdgCode == 321 ) {
2692+ } else if (pdgCode == PDGs[indexKa] ) {
26912693 histos.fill (HIST (" MC/test/ka/pos/prm/pt/den" ), pt, multiplicity);
2692- } else if (pdgCode == - 321 ) {
2694+ } else if (pdgCode == PDGs[indexKa+Np] ) {
26932695 histos.fill (HIST (" MC/test/ka/neg/prm/pt/den" ), pt, multiplicity);
26942696 }
26952697 }
@@ -2760,33 +2762,33 @@ struct tofSpectra {
27602762 const bool isProtonTOF = track.hasTOF () && std::abs (nsigmaTOFPr) < trkselOptions.cfgCutNsigma ;
27612763
27622764 if (isPionTPC || isKaonTPC || isProtonTPC) {
2763- if (pdgCode == 2212 ) {
2765+ if (pdgCode == PDGs[indexPr] ) {
27642766 histos.fill (HIST (" MC/test/RecoEvs/pr/pos/prm/pt/num" ), pt, multiplicity);
2765- } else if (pdgCode == - 2212 ) {
2767+ } else if (pdgCode == PDGs[indexPr+Np] ) {
27662768 histos.fill (HIST (" MC/test/RecoEvs/pr/neg/prm/pt/num" ), pt, multiplicity);
2767- } else if (pdgCode == 211 ) {
2769+ } else if (pdgCode == PDGs[indexPi] ) {
27682770 histos.fill (HIST (" MC/test/RecoEvs/pi/pos/prm/pt/num" ), pt, multiplicity);
2769- } else if (pdgCode == - 211 ) {
2771+ } else if (pdgCode == PDGs[indexPi+Np] ) {
27702772 histos.fill (HIST (" MC/test/RecoEvs/pi/neg/prm/pt/num" ), pt, multiplicity);
2771- } else if (pdgCode == 321 ) {
2773+ } else if (pdgCode == PDGs[indexKa] ) {
27722774 histos.fill (HIST (" MC/test/RecoEvs/ka/pos/prm/pt/num" ), pt, multiplicity);
2773- } else if (pdgCode == - 321 ) {
2775+ } else if (pdgCode == PDGs[indexKa+Np] ) {
27742776 histos.fill (HIST (" MC/test/RecoEvs/ka/neg/prm/pt/num" ), pt, multiplicity);
27752777 }
27762778 }
27772779
27782780 if (isPionTOF || isKaonTOF || isProtonTOF) {
2779- if (pdgCode == 2212 ) {
2781+ if (pdgCode == PDGs[indexPr] ) {
27802782 histos.fill (HIST (" MC/test/RecoEvs/pr/pos/prm/pt/numtof" ), pt, multiplicity);
2781- } else if (pdgCode == - 2212 ) {
2783+ } else if (pdgCode == PDGs[indexPr+Np] ) {
27822784 histos.fill (HIST (" MC/test/RecoEvs/pr/neg/prm/pt/numtof" ), pt, multiplicity);
2783- } else if (pdgCode == 211 ) {
2785+ } else if (pdgCode == PDGs[indexPi] ) {
27842786 histos.fill (HIST (" MC/test/RecoEvs/pi/pos/prm/pt/numtof" ), pt, multiplicity);
2785- } else if (pdgCode == - 211 ) {
2787+ } else if (pdgCode == PDGs[indexPi+Np] ) {
27862788 histos.fill (HIST (" MC/test/RecoEvs/pi/neg/prm/pt/numtof" ), pt, multiplicity);
2787- } else if (pdgCode == 321 ) {
2789+ } else if (pdgCode == PDGs[indexKa] ) {
27882790 histos.fill (HIST (" MC/test/RecoEvs/ka/pos/prm/pt/numtof" ), pt, multiplicity);
2789- } else if (pdgCode == - 321 ) {
2791+ } else if (pdgCode == PDGs[indexKa+Np] ) {
27902792 histos.fill (HIST (" MC/test/RecoEvs/ka/neg/prm/pt/numtof" ), pt, multiplicity);
27912793 }
27922794 }
0 commit comments