Skip to content

Commit edd51f0

Browse files
authored
[Common] TrackSelectorPID: Add PDG_t prefix (#13526)
1 parent fb69ea7 commit edd51f0

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

Common/Core/TrackSelectorPID.h

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct TrackSelectorPID {
3737
};
3838
};
3939

40-
template <uint64_t pdg = kPiPlus>
40+
template <uint64_t pdg = PDG_t::kPiPlus>
4141
class TrackSelectorPidBase
4242
{
4343
public:
@@ -121,15 +121,15 @@ class TrackSelectorPidBase
121121

122122
// Get nσ for a given particle hypothesis.
123123
double nSigma = 100.;
124-
if constexpr (pdg == kElectron) {
124+
if constexpr (pdg == PDG_t::kElectron) {
125125
nSigma = track.tpcNSigmaEl();
126-
} else if constexpr (pdg == kMuonMinus) {
126+
} else if constexpr (pdg == PDG_t::kMuonMinus) {
127127
nSigma = track.tpcNSigmaMu();
128-
} else if constexpr (pdg == kPiPlus) {
128+
} else if constexpr (pdg == PDG_t::kPiPlus) {
129129
nSigma = track.tpcNSigmaPi();
130-
} else if constexpr (pdg == kKPlus) {
130+
} else if constexpr (pdg == PDG_t::kKPlus) {
131131
nSigma = track.tpcNSigmaKa();
132-
} else if constexpr (pdg == kProton) {
132+
} else if constexpr (pdg == PDG_t::kProton) {
133133
nSigma = track.tpcNSigmaPr();
134134
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
135135
nSigma = track.tpcNSigmaDe();
@@ -217,15 +217,15 @@ class TrackSelectorPidBase
217217

218218
// Get nσ for a given particle hypothesis.
219219
double nSigma = 100.;
220-
if constexpr (pdg == kElectron) {
220+
if constexpr (pdg == PDG_t::kElectron) {
221221
nSigma = track.tofNSigmaEl();
222-
} else if constexpr (pdg == kMuonMinus) {
222+
} else if constexpr (pdg == PDG_t::kMuonMinus) {
223223
nSigma = track.tofNSigmaMu();
224-
} else if constexpr (pdg == kPiPlus) {
224+
} else if constexpr (pdg == PDG_t::kPiPlus) {
225225
nSigma = track.tofNSigmaPi();
226-
} else if constexpr (pdg == kKPlus) {
226+
} else if constexpr (pdg == PDG_t::kKPlus) {
227227
nSigma = track.tofNSigmaKa();
228-
} else if constexpr (pdg == kProton) {
228+
} else if constexpr (pdg == PDG_t::kProton) {
229229
nSigma = track.tofNSigmaPr();
230230
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
231231
nSigma = track.tofNSigmaDe();
@@ -315,15 +315,15 @@ class TrackSelectorPidBase
315315

316316
// Get nσ for a given particle hypothesis.
317317
double nSigma = 100.;
318-
if constexpr (pdg == kElectron) {
318+
if constexpr (pdg == PDG_t::kElectron) {
319319
nSigma = track.rich().richNsigmaEl();
320-
} else if constexpr (pdg == kMuonMinus) {
320+
} else if constexpr (pdg == PDG_t::kMuonMinus) {
321321
nSigma = track.rich().richNsigmaMu();
322-
} else if constexpr (pdg == kPiPlus) {
322+
} else if constexpr (pdg == PDG_t::kPiPlus) {
323323
nSigma = track.rich().richNsigmaPi();
324-
} else if constexpr (pdg == kKPlus) {
324+
} else if constexpr (pdg == PDG_t::kKPlus) {
325325
nSigma = track.rich().richNsigmaKa();
326-
} else if constexpr (pdg == kProton) {
326+
} else if constexpr (pdg == PDG_t::kProton) {
327327
nSigma = track.rich().richNsigmaPr();
328328
} else {
329329
errorPdg();
@@ -364,7 +364,7 @@ class TrackSelectorPidBase
364364
template <typename T>
365365
bool isValidForMid(const T& track)
366366
{
367-
if constexpr (pdg == kMuonMinus) {
367+
if constexpr (pdg == PDG_t::kMuonMinus) {
368368
return track.midId() > -1;
369369
} else {
370370
errorPdg();
@@ -378,7 +378,7 @@ class TrackSelectorPidBase
378378
template <typename T>
379379
bool isSelectedByMid(const T& track)
380380
{
381-
if constexpr (pdg == kMuonMinus) {
381+
if constexpr (pdg == PDG_t::kMuonMinus) {
382382
return track.mid().midIsMuon() == 1; // FIXME: change to return track.midIsMuon() once the column is bool.
383383
} else {
384384
errorPdg();
@@ -392,7 +392,7 @@ class TrackSelectorPidBase
392392
template <typename T>
393393
TrackSelectorPID::Status statusMid(const T& track)
394394
{
395-
if constexpr (pdg == kMuonMinus) {
395+
if constexpr (pdg == PDG_t::kMuonMinus) {
396396
if (!isValidForMid(track)) {
397397
return TrackSelectorPID::NotApplicable;
398398
}
@@ -555,15 +555,15 @@ class TrackSelectorPidBase
555555
bool isSelectedByBayes(const T& track)
556556
{
557557
// Get index of the most probable species for a given track.
558-
if constexpr (pdg == kElectron) {
558+
if constexpr (pdg == PDG_t::kElectron) {
559559
return track.bayesID() == o2::track::PID::Electron;
560-
} else if constexpr (pdg == kMuonMinus) {
560+
} else if constexpr (pdg == PDG_t::kMuonMinus) {
561561
return track.bayesID() == o2::track::PID::Muon;
562-
} else if constexpr (pdg == kPiPlus) {
562+
} else if constexpr (pdg == PDG_t::kPiPlus) {
563563
return track.bayesID() == o2::track::PID::Pion;
564-
} else if constexpr (pdg == kKPlus) {
564+
} else if constexpr (pdg == PDG_t::kKPlus) {
565565
return track.bayesID() == o2::track::PID::Kaon;
566-
} else if constexpr (pdg == kProton) {
566+
} else if constexpr (pdg == PDG_t::kProton) {
567567
return track.bayesID() == o2::track::PID::Proton;
568568
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
569569
return track.bayesID() == o2::track::PID::Deuteron;
@@ -585,15 +585,15 @@ class TrackSelectorPidBase
585585

586586
// Get probability for a given particle hypothesis.
587587
double prob = 0.;
588-
if constexpr (pdg == kElectron) {
588+
if constexpr (pdg == PDG_t::kElectron) {
589589
prob = track.bayesEl();
590-
} else if constexpr (pdg == kMuonMinus) {
590+
} else if constexpr (pdg == PDG_t::kMuonMinus) {
591591
prob = track.bayesMu();
592-
} else if constexpr (pdg == kPiPlus) {
592+
} else if constexpr (pdg == PDG_t::kPiPlus) {
593593
prob = track.bayesPi();
594-
} else if constexpr (pdg == kKPlus) {
594+
} else if constexpr (pdg == PDG_t::kKPlus) {
595595
prob = track.bayesKa();
596-
} else if constexpr (pdg == kProton) {
596+
} else if constexpr (pdg == PDG_t::kProton) {
597597
prob = track.bayesPr();
598598
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
599599
prob = track.bayesDe();
@@ -674,11 +674,11 @@ class TrackSelectorPidBase
674674
};
675675

676676
// Predefined types
677-
using TrackSelectorEl = TrackSelectorPidBase<kElectron>; // El
678-
using TrackSelectorMu = TrackSelectorPidBase<kMuonMinus>; // Mu
679-
using TrackSelectorPi = TrackSelectorPidBase<kPiPlus>; // Pi
680-
using TrackSelectorKa = TrackSelectorPidBase<kKPlus>; // Ka
681-
using TrackSelectorPr = TrackSelectorPidBase<kProton>; // Pr
677+
using TrackSelectorEl = TrackSelectorPidBase<PDG_t::kElectron>; // El
678+
using TrackSelectorMu = TrackSelectorPidBase<PDG_t::kMuonMinus>; // Mu
679+
using TrackSelectorPi = TrackSelectorPidBase<PDG_t::kPiPlus>; // Pi
680+
using TrackSelectorKa = TrackSelectorPidBase<PDG_t::kKPlus>; // Ka
681+
using TrackSelectorPr = TrackSelectorPidBase<PDG_t::kProton>; // Pr
682682
using TrackSelectorDe = TrackSelectorPidBase<o2::constants::physics::Pdg::kDeuteron>; // De
683683

684684
#endif // COMMON_CORE_TRACKSELECTORPID_H_

0 commit comments

Comments
 (0)