Skip to content

Commit cb9ff1b

Browse files
mherzer28alibuild
andauthored
[PWGLF] added second option for mass calculation (#11459)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 5224c36 commit cb9ff1b

File tree

1 file changed

+36
-11
lines changed

1 file changed

+36
-11
lines changed

PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "PWGLF/DataModel/LFParticleIdentification.h"
3636
#include "ReconstructionDataFormats/PID.h"
3737
#include "ReconstructionDataFormats/Track.h"
38+
#include "PWGLF/DataModel/pidTOFGeneric.h"
3839
#include <TF1.h>
3940

4041
namespace o2::aod
@@ -113,7 +114,7 @@ static const std::vector<int> particleCharge{1, 2};
113114
static const std::vector<float> particleChargeFactor{2.3, 2.55};
114115
static const std::vector<std::string> betheBlochParNames{
115116
"p0", "p1", "p2", "p3", "p4", "resolution"};
116-
constexpr float betheBlochDefault[nParticles][nBetheParams]{
117+
constexpr float BetheBlochDefault[nParticles][nBetheParams]{
117118
{0.248753, 3.58634, 0.0167065, 2.29194, 0.774344,
118119
0.07}, // triton
119120
{0.0274556, 18.3054, 3.99987e-05, 3.17219, 11.1775,
@@ -126,7 +127,8 @@ using TracksFull =
126127
soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU,
127128
o2::aod::TracksDCA, aod::pidTOFmass, aod::pidTOFbeta,
128129
aod::pidTPCLfFullTr, aod::pidTPCLfFullHe,
129-
aod::TOFSignal, aod::TrackSelectionExtension>;
130+
aod::TOFSignal, aod::TrackSelectionExtension,
131+
o2::aod::EvTimeTOFFT0ForTrack>;
130132

131133
class Particle
132134
{
@@ -186,7 +188,7 @@ struct TrHeAnalysis {
186188
} evselOptions;
187189

188190
Configurable<bool> cfgTPCPidMethod{"cfgTPCPidMethod", false, "Using own or built in bethe parametrization"}; // false for built in
189-
191+
Configurable<int> cfgMassMethod{"cfgMassMethod", 0, "0: Using built in 1: mass calculated with beta 2: mass calculated with the event time"};
190192
// Set the multiplity event limits
191193
Configurable<float> cfgLowMultCut{"cfgLowMultCut", 0.0f, "Accepted multiplicity percentage lower limit"};
192194
Configurable<float> cfgHighMultCut{"cfgHighMultCut", 100.0f, "Accepted multiplicity percentage higher limit"};
@@ -226,7 +228,7 @@ struct TrHeAnalysis {
226228
Configurable<float> nsigmaTPCTr{"nsigmaTPCTr", 5.f, "Value of the Nsigma TPC cut for tritons"};
227229
Configurable<float> nsigmaTPCHe{"nsigmaTPCHe", 5.f, "Value of the Nsigma TPC cut for helium-3"};
228230
} nsigmaTPCvar;
229-
Configurable<LabeledArray<float>> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"};
231+
Configurable<LabeledArray<float>> cfgBetheBlochParams{"cfgBetheBlochParams", {BetheBlochDefault[0], nParticles, nBetheParams, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for light nuclei"};
230232

231233
void init(o2::framework::InitContext&)
232234
{
@@ -663,12 +665,14 @@ struct TrHeAnalysis {
663665
constexpr int NNumLayers = 8;
664666
constexpr int NBitsPerLayer = 4;
665667
constexpr int NBitMask = (1 << NBitsPerLayer) - 1;
668+
666669
int sum = 0, n = 0;
667670
for (int i = 0; i < NNumLayers; i++) {
668671
int clsSize = (track.itsClusterSizes() >> (NBitsPerLayer * i)) & NBitMask;
669672
sum += clsSize;
670-
if (clsSize)
673+
if (clsSize) {
671674
n++;
675+
}
672676
}
673677
return n > 0 ? static_cast<float>(sum) / n : 0.f;
674678
}
@@ -681,13 +685,34 @@ struct TrHeAnalysis {
681685
return hePID ? track.tpcInnerParam() / 2 : track.tpcInnerParam();
682686
}
683687
template <class T>
684-
float getMass(T const& track)
688+
float getMass(const T& track)
685689
{
686-
const float beta = track.beta();
687-
const float rigidity = getRigidity(track);
688-
float gamma = 1 / std::sqrt(1 - beta * beta);
689-
float mass = (rigidity / std::sqrt(gamma * gamma - 1));
690-
return mass;
690+
if (cfgMassMethod == 0) {
691+
return track.mass();
692+
}
693+
if (cfgMassMethod == 1) {
694+
const float beta = track.beta();
695+
const float rigidity = getRigidity(track);
696+
float gamma = 1 / std::sqrt(1 - beta * beta);
697+
float mass = (rigidity / std::sqrt(gamma * gamma - 1.f));
698+
return mass;
699+
}
700+
if (cfgMassMethod == 2) {
701+
const float rigidity = getRigidity(track);
702+
float tofStartTime = track.evTimeForTrack();
703+
float tofTime = track.tofSignal();
704+
constexpr float CInCmPs = 2.99792458e-2f;
705+
float length = track.length();
706+
float time = tofTime - tofStartTime;
707+
if (time > 0.f && length > 0.f) {
708+
float beta = length / (CInCmPs * time);
709+
float gamma = 1 / std::sqrt(1 - beta * beta);
710+
float mass = rigidity / std::sqrt(gamma * gamma - 1.f);
711+
return mass;
712+
}
713+
return -1.f;
714+
}
715+
return -1.f;
691716
}
692717
};
693718

0 commit comments

Comments
 (0)