Skip to content

Commit a506334

Browse files
committed
Fixed the O2 linter errors in spectraTOF.cxx
1 parent 9d64bd8 commit a506334

File tree

2 files changed

+51
-80
lines changed

2 files changed

+51
-80
lines changed

PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ DECLARE_SOA_COLUMN(FlagCharmBachInterm, flagCharmBachInterm, int8_t);
8686
DECLARE_SOA_COLUMN(NKinkedTracks, nKinkedTracks, int8_t); //! Number of kinked tracks found in MC matching
8787
} // namespace hf_cand_reso_to_trk_lite
8888

89-
DECLARE_SOA_TABLE(HfCandDTrkLites, "AOD", "HFCANDDTRKLITE", //! Table with candidate charm hadron properties
89+
DECLARE_SOA_TABLE(HfCandDTrkLites, "AOD", "HFCANDDTRKLITE", //! Table with some B0 properties
9090
// Candidate Properties
9191
hf_cand_reso_to_trk_lite::M,
9292
hf_cand_reso_to_trk_lite::Pt,
@@ -123,7 +123,7 @@ DECLARE_SOA_TABLE(HfCandDTrkLites, "AOD", "HFCANDDTRKLITE", //! Table with candi
123123
hf_cand_reso_to_trk_lite::FlagCharmBachInterm,
124124
hf_cand_reso_to_trk_lite::NKinkedTracks);
125125

126-
DECLARE_SOA_TABLE(HfGenResoLites, "AOD", "HFGENRESOLITE", //! Table with gen level charm hadron properties
126+
DECLARE_SOA_TABLE(HfGenResoLites, "AOD", "HFGENRESOLITE", //! Table with some B0 properties
127127
hf_cand_reso_to_trk_lite::Pt,
128128
hf_cand_reso_to_trk_lite::Y,
129129
hf_cand_reso_to_trk_lite::Origin,
@@ -132,8 +132,7 @@ DECLARE_SOA_TABLE(HfGenResoLites, "AOD", "HFGENRESOLITE", //! Table with gen lev
132132
} // namespace o2::aod
133133

134134
enum DecayChannel : uint8_t {
135-
D0Kplus = 0,
136-
D0Proton
135+
D0Kplus = 0
137136
};
138137

139138
struct HfTaskCharmResoToDTrkReduced {
@@ -211,25 +210,17 @@ struct HfTaskCharmResoToDTrkReduced {
211210
void fillCand(const Cand& candidate, const Coll& collision, const CharmBach& bach0, const TrkBach& bach1)
212211
{
213212
// Base
213+
float massReso{0}, cosThetaStar{0};
214+
int8_t sign{0};
214215
float tpcNSigmaBach1{0}, tofNSigmaBach1{0}, tpcTofNSigmaBach1{0};
215-
double bachMass = 0.f;
216-
217216
if constexpr (Channel == DecayChannel::D0Kplus) {
218-
bachMass = MassKPlus;
217+
massReso = useDeltaMass ? candidate.invMass() + MassD0 : candidate.invMass();
218+
cosThetaStar = RecoDecay::cosThetaStar(std::array{bach0.pVector(), bach1.pVector()}, std::array{MassD0, MassKPlus}, massReso, 0);
219219
tpcNSigmaBach1 = bach1.tpcNSigmaKa();
220220
tofNSigmaBach1 = bach1.tofNSigmaKa();
221221
tpcTofNSigmaBach1 = bach1.tpcTofNSigmaKa();
222-
} else if constexpr (Channel == DecayChannel::D0Proton) {
223-
bachMass = MassProton;
224-
tpcNSigmaBach1 = bach1.tpcNSigmaPr();
225-
tofNSigmaBach1 = bach1.tofNSigmaPr();
226-
tpcTofNSigmaBach1 = bach1.tpcTofNSigmaPr();
222+
sign = bach1.sign();
227223
}
228-
229-
float massReso = useDeltaMass ? candidate.invMass() + MassD0 : candidate.invMass();
230-
float cosThetaStar = RecoDecay::cosThetaStar(std::array{bach0.pVector(), bach1.pVector()}, std::array{MassD0, bachMass}, massReso, 0);
231-
int8_t sign = bach1.sign();
232-
233224
float y = RecoDecay::y(std::array{candidate.px(), candidate.py(), candidate.pz()}, massReso);
234225
float eta = RecoDecay::eta(std::array{candidate.px(), candidate.py(), candidate.pz()});
235226
float phi = RecoDecay::phi(candidate.px(), candidate.py());
@@ -371,9 +362,6 @@ struct HfTaskCharmResoToDTrkReduced {
371362
case DecayChannel::D0Kplus:
372363
massReso = cand.invMass() + MassD0;
373364
break;
374-
case DecayChannel::D0Proton:
375-
massReso = cand.invMass() + MassD0;
376-
break;
377365
default:
378366
break;
379367
}
@@ -463,25 +451,6 @@ struct HfTaskCharmResoToDTrkReduced {
463451
}
464452
PROCESS_SWITCH(HfTaskCharmResoToDTrkReduced, processD0KplusDataWithMl, "Process data for D0Kplus analysis with Ml", false);
465453

466-
void processD0ProtonData(aod::HfRedCollisions const& collisions,
467-
ReducedReso2PrTrk const& candidates,
468-
aod::HfRed2PrNoTrks const& charmBachs,
469-
aod::HfRedTrkNoParams const& trkBachs)
470-
{
471-
processData<false, false, DecayChannel::D0Proton>(collisions, candidates, charmBachs, trkBachs);
472-
}
473-
PROCESS_SWITCH(HfTaskCharmResoToDTrkReduced, processD0ProtonData, "Process data for D0Proton analysis", true);
474-
475-
// Process data with ML
476-
void processD0ProtonDataWithMl(aod::HfRedCollisions const& collisions,
477-
ReducedReso2PrTrk const& candidates,
478-
soa::Join<aod::HfRed2PrNoTrks, aod::HfRed2ProngsMl> const& charmBachs,
479-
aod::HfRedTrkNoParams const& trkBachs)
480-
{
481-
processData<false, true, DecayChannel::D0Proton>(collisions, candidates, charmBachs, trkBachs);
482-
}
483-
PROCESS_SWITCH(HfTaskCharmResoToDTrkReduced, processD0ProtonDataWithMl, "Process data for D0Proton analysis with Ml", false);
484-
485454
// MC
486455
void processD0KplusMC(aod::HfRedCollisions const& collisions,
487456
ReducedReso2PrTrkMC const& candidates,

PWGLF/Tasks/Nuspex/spectraTOF.cxx

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ 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+
8385
// Spectra task
8486
struct 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

Comments
 (0)