Skip to content

Commit ba8ac2c

Browse files
authored
PWGF: Fix pdg codes in femtodream (#8232)
1 parent 27edab7 commit ba8ac2c

File tree

2 files changed

+21
-90
lines changed

2 files changed

+21
-90
lines changed

PWGCF/FemtoDream/Core/femtoDreamParticleHisto.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,19 +357,19 @@ class FemtoDreamParticleHisto
357357
float pidTOF = 0.;
358358

359359
switch (abs(mPDG)) {
360-
case 11:
360+
case kElectron:
361361
pidTPC = part.tpcNSigmaEl();
362362
pidTOF = part.tofNSigmaEl();
363363
break;
364-
case 211:
364+
case kPiPlus:
365365
pidTPC = part.tpcNSigmaPi();
366366
pidTOF = part.tofNSigmaPi();
367367
break;
368-
case 321:
368+
case kKPlus:
369369
pidTPC = part.tpcNSigmaKa();
370370
pidTOF = part.tofNSigmaKa();
371371
break;
372-
case 2212:
372+
case kProton:
373373
pidTPC = part.tpcNSigmaPr();
374374
pidTOF = part.tofNSigmaPr();
375375
break;

PWGCF/FemtoDream/Core/femtoDreamUtils.h

Lines changed: 17 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -18,87 +18,12 @@
1818

1919
#include <vector>
2020
#include <string>
21-
#include <functional>
22-
#include <algorithm>
23-
#include "Framework/ASoAHelpers.h"
2421
#include "CommonConstants/PhysicsConstants.h"
2522
#include "PWGCF/DataModel/FemtoDerived.h"
2623

2724
namespace o2::analysis::femtoDream
2825
{
2926

30-
// TODO: remove all these functions pertaining to PID selection for the next tutorial session they have been removed from femtodream tasks but are still present in tutorial files
31-
32-
enum kDetector { kTPC,
33-
kTPCTOF,
34-
kNdetectors };
35-
36-
/// internal function that returns the kPIDselection element corresponding to a
37-
/// specifica n-sigma value \param nSigma number of sigmas for PID
38-
/// \param vNsigma vector with the number of sigmas of interest
39-
/// \return kPIDselection corresponding to n-sigma
40-
int getPIDselection(float nSigma, std::vector<float> vNsigma)
41-
{
42-
std::sort(vNsigma.begin(), vNsigma.end(), std::greater<>());
43-
auto it = std::find(vNsigma.begin(), vNsigma.end(), nSigma);
44-
if (it == vNsigma.end()) {
45-
it = vNsigma.begin() + 1;
46-
LOG(warn) << "Invalid value of nSigma: " << nSigma << ". Return the first value of the vector: " << *(it);
47-
}
48-
return std::distance(vNsigma.begin(), it);
49-
}
50-
51-
/// function that checks whether the PID selection specified in the vectors is
52-
/// fulfilled
53-
/// \param pidcut Bit-wise container for the PID
54-
/// \param vSpecies vector with ID corresponding to the selected species (output from cutculator)
55-
/// \param nSpecies number of available selected species (output from cutculator)
56-
/// \param nSigma number of sigma selection fo PID
57-
/// \param vNsigma vector with available n-sigma selections for PID
58-
/// \param kDetector enum corresponding to the PID technique
59-
/// \return Whether the PID selection specified in the vectors is fulfilled
60-
bool isPIDSelected(aod::femtodreamparticle::cutContainerType pidcut,
61-
int vSpecies,
62-
int nSpecies,
63-
float nSigma,
64-
std::vector<float> vNsigma,
65-
kDetector iDet)
66-
{
67-
int iNsigma = getPIDselection(nSigma, vNsigma);
68-
int nDet = static_cast<int>(kDetector::kNdetectors);
69-
int bit_to_check = 1 + (vNsigma.size() - (iNsigma + 1)) * nDet * nSpecies + (nSpecies - (vSpecies + 1)) * nSpecies + (nDet - 1 - iDet);
70-
return ((pidcut >> (bit_to_check)) & 1) == 1;
71-
};
72-
73-
/// function that checks whether the PID selection specified in the vectors is fulfilled, depending on the momentum TPC or TPC+TOF PID is conducted
74-
/// \param pidcut Bit-wise container for the PID
75-
/// \param momentum Momentum of the track
76-
/// \param pidThresh Momentum threshold that separates between TPC and TPC+TOF PID
77-
/// \param vSpecies Vector with the species of interest (number returned by the CutCulator)
78-
/// \param nSpecies number of available selected species (output from cutculator)
79-
/// \param nSigmaTPC Number of TPC sigmas for selection
80-
/// \param nSigmaTPCTOF Number of TPC+TOF sigmas for selection (circular selection)
81-
/// \return Whether the PID selection is fulfilled
82-
bool isFullPIDSelected(aod::femtodreamparticle::cutContainerType const& pidCut,
83-
float momentum,
84-
float pidThresh,
85-
int vSpecies,
86-
int nSpecies,
87-
std::vector<float> vNsigma,
88-
float nSigmaTPC,
89-
float nSigmaTPCTOF)
90-
{
91-
bool pidSelection = true;
92-
if (momentum < pidThresh) {
93-
/// TPC PID only
94-
pidSelection = isPIDSelected(pidCut, vSpecies, nSpecies, nSigmaTPC, vNsigma, kDetector::kTPC);
95-
} else {
96-
/// TPC + TOF PID
97-
pidSelection = isPIDSelected(pidCut, vSpecies, nSpecies, nSigmaTPCTOF, vNsigma, kDetector::kTPCTOF);
98-
}
99-
return pidSelection;
100-
};
101-
10227
/// function for getting the mass of a particle depending on the pdg code
10328
/// \param pdgCode pdg code of the particle
10429
/// \return mass of the particle
@@ -109,27 +34,33 @@ inline float getMass(int pdgCode)
10934
float mass = 0;
11035
// add new particles if necessary here
11136
switch (std::abs(pdgCode)) {
112-
case kPiPlus: // charged pions, changed magic number as per their pdg name
37+
case kPiPlus:
11338
mass = o2::constants::physics::MassPiPlus;
11439
break;
115-
case kKPlus: // charged kaon
40+
case kKPlus:
11641
mass = o2::constants::physics::MassKPlus;
11742
break;
118-
case kProton: // proton
43+
case kProton:
11944
mass = o2::constants::physics::MassProton;
12045
break;
121-
case kLambda0: // Lambda
46+
case kLambda0:
12247
mass = o2::constants::physics::MassLambda;
12348
break;
124-
case o2::constants::physics::Pdg::kPhi: // Phi Meson
49+
case o2::constants::physics::Pdg::kPhi:
12550
mass = o2::constants::physics::MassPhi;
12651
break;
127-
case o2::constants::physics::Pdg::kLambdaCPlus: // Charm Lambda
52+
case o2::constants::physics::Pdg::kLambdaCPlus:
12853
mass = o2::constants::physics::MassLambdaCPlus;
12954
break;
130-
case o2::constants::physics::Pdg::kDeuteron: // Deuteron
55+
case o2::constants::physics::Pdg::kDeuteron:
13156
mass = o2::constants::physics::MassDeuteron;
13257
break;
58+
case o2::constants::physics::Pdg::kTriton:
59+
mass = o2::constants::physics::MassTriton;
60+
break;
61+
case o2::constants::physics::Pdg::kHelium3:
62+
mass = o2::constants::physics::MassHelium3;
63+
break;
13364
default:
13465
LOG(fatal) << "PDG code is not suppored";
13566
}
@@ -141,10 +72,10 @@ inline int checkDaughterType(o2::aod::femtodreamparticle::ParticleType partType,
14172
int partOrigin = 0;
14273
if (partType == o2::aod::femtodreamparticle::ParticleType::kTrack) {
14374
switch (abs(motherPDG)) {
144-
case 3122:
75+
case kLambda0:
14576
partOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kSecondaryDaughterLambda;
14677
break;
147-
case 3222:
78+
case kSigmaPlus:
14879
partOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kSecondaryDaughterSigmaplus;
14980
break;
15081
default:
@@ -156,10 +87,10 @@ inline int checkDaughterType(o2::aod::femtodreamparticle::ParticleType partType,
15687

15788
} else if (partType == o2::aod::femtodreamparticle::ParticleType::kV0Child) {
15889
switch (abs(motherPDG)) {
159-
case 3122:
90+
case kLambda0:
16091
partOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kSecondaryDaughterLambda;
16192
break;
162-
case 3222:
93+
case kSigmaPlus:
16394
partOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kSecondaryDaughterSigmaplus;
16495
break;
16596
default:

0 commit comments

Comments
 (0)