Skip to content

Commit 674c86c

Browse files
mherzer28alibuild
andauthored
[PWGLF] rigidity correction fix (AliceO2Group#11259)
Co-authored-by: ALICE Action Bot <[email protected]>
1 parent bc17994 commit 674c86c

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

PWGLF/TableProducer/Nuspex/trHeAnalysis.cxx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "ReconstructionDataFormats/PID.h"
3737
#include "ReconstructionDataFormats/Track.h"
3838
#include <TF1.h>
39-
#include <TLorentzVector.h>
4039

4140
namespace o2::aod
4241
{
@@ -137,6 +136,7 @@ class Particle
137136
int charge;
138137
float resolution;
139138
std::vector<float> betheParams;
139+
static constexpr int kNumBetheParams = 5;
140140

141141
Particle(const std::string name_, int pdgCode_, float mass_, int charge_,
142142
LabeledArray<float> bethe)
@@ -150,7 +150,7 @@ class Particle
150150
bethe.get(name, "resolution"); // Access the "resolution" parameter
151151

152152
betheParams.clear();
153-
for (int i = 0; i < 5; ++i) {
153+
for (int i = 0; i < kNumBetheParams; ++i) {
154154
betheParams.push_back(bethe.get(name, i));
155155
}
156156
}
@@ -327,7 +327,7 @@ struct TrHeAnalysis {
327327
track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Helium3)) <
328328
kinemOptions.yHighCut;
329329
histos.fill(HIST("histogram/cuts"), 0);
330-
if (std::abs(track.tpcInnerParam()) < kinemOptions.pCut) {
330+
if (std::abs(track.p()) < kinemOptions.pCut) {
331331
histos.fill(HIST("histogram/cuts"), 1);
332332
continue;
333333
}
@@ -366,10 +366,10 @@ struct TrHeAnalysis {
366366
histos.fill(HIST("histogram/pT"), track.pt());
367367
histos.fill(HIST("histogram/p"), track.p());
368368
histos.fill(HIST("histogram/TPCsignVsTPCmomentum"),
369-
track.tpcInnerParam() / (1.f * track.sign()),
369+
getRigidity(track),
370370
track.tpcSignal());
371371
histos.fill(HIST("histogram/TOFbetaVsP"),
372-
track.p() / (1.f * track.sign()), track.beta());
372+
getRigidity(track), track.beta());
373373
if (enableTr && trRapCut) {
374374
if (std::abs(getTPCnSigma(track, particles.at(0))) <
375375
nsigmaTPCvar.nsigmaTPCTr) {
@@ -391,10 +391,10 @@ struct TrHeAnalysis {
391391
continue;
392392
}
393393
histos.fill(HIST("histogram/H3/H3-TPCsignVsTPCmomentum"),
394-
track.tpcInnerParam() / (1.f * track.sign()),
394+
getRigidity(track),
395395
track.tpcSignal());
396396
histos.fill(HIST("histogram/H3/H3-TOFbetaVsP"),
397-
track.p() / (1.f * track.sign()), track.beta());
397+
getRigidity(track), track.beta());
398398
float tPt = track.pt();
399399
float tEta = track.eta();
400400
float tPhi = track.phi();
@@ -437,10 +437,10 @@ struct TrHeAnalysis {
437437
continue;
438438
}
439439
histos.fill(HIST("histogram/He/He-TPCsignVsTPCmomentum"),
440-
track.tpcInnerParam() / (2.f * track.sign()),
440+
getRigidity(track),
441441
track.tpcSignal());
442442
histos.fill(HIST("histogram/He/He-TOFbetaVsP"),
443-
track.p() / (2.f * track.sign()), track.beta());
443+
getRigidity(track), track.beta());
444444
float tPt = track.pt();
445445
float tEta = track.eta();
446446
float tPhi = track.phi();
@@ -481,7 +481,7 @@ struct TrHeAnalysis {
481481
track.rapidity(o2::track::PID::getMass2Z(o2::track::PID::Helium3)) <
482482
kinemOptions.yHighCut;
483483
histos.fill(HIST("histogram/cuts"), 0);
484-
if (std::abs(track.tpcInnerParam()) < kinemOptions.pCut) {
484+
if (std::abs(track.p()) < kinemOptions.pCut) {
485485
histos.fill(HIST("histogram/cuts"), 1);
486486
continue;
487487
}
@@ -520,7 +520,7 @@ struct TrHeAnalysis {
520520
histos.fill(HIST("histogram/pT"), track.pt());
521521
histos.fill(HIST("histogram/p"), track.p());
522522
histos.fill(HIST("histogram/TPCsignVsTPCmomentum"),
523-
track.tpcInnerParam() / (1.f * track.sign()),
523+
getRigidity(track) / (1.f * track.sign()),
524524
track.tpcSignal());
525525
histos.fill(HIST("histogram/TOFbetaVsP"),
526526
track.p() / (1.f * track.sign()), track.beta());
@@ -544,7 +544,7 @@ struct TrHeAnalysis {
544544
continue;
545545
}
546546
histos.fill(HIST("histogram/H3/H3-TPCsignVsTPCmomentum"),
547-
track.tpcInnerParam() / (1.f * track.sign()),
547+
getRigidity(track) / (1.f * track.sign()),
548548
track.tpcSignal());
549549
histos.fill(HIST("histogram/H3/H3-TOFbetaVsP"),
550550
track.p() / (1.f * track.sign()), track.beta());
@@ -589,10 +589,10 @@ struct TrHeAnalysis {
589589
continue;
590590
}
591591
histos.fill(HIST("histogram/He/He-TPCsignVsTPCmomentum"),
592-
track.tpcInnerParam() / (2.f * track.sign()),
592+
getRigidity(track),
593593
track.tpcSignal());
594594
histos.fill(HIST("histogram/He/He-TOFbetaVsP"),
595-
track.p() / (2.f * track.sign()), track.beta());
595+
getRigidity(track), track.beta());
596596
float tPt = track.pt();
597597
float tEta = track.eta();
598598
float tPhi = track.phi();
@@ -625,7 +625,7 @@ struct TrHeAnalysis {
625625
template <class T>
626626
float getTPCnSigma(T const& track, Particle const& particle)
627627
{
628-
const float rigidity = track.tpcInnerParam();
628+
const float rigidity = getRigidity(track);
629629
if (!track.hasTPC())
630630
return -999;
631631

@@ -643,10 +643,14 @@ struct TrHeAnalysis {
643643
template <class T>
644644
float getMeanItsClsSize(T const& track)
645645
{
646+
constexpr int kNumLayers = 8;
647+
constexpr int kBitsPerLayer = 4;
648+
constexpr int kBitMask = (1 << kBitsPerLayer) - 1;
646649
int sum = 0, n = 0;
647-
for (int i = 0; i < 8; i++) {
648-
sum += (track.itsClusterSizes() >> (4 * i) & 15);
649-
if (track.itsClusterSizes() >> (4 * i) & 15)
650+
for (int i = 0; i < kNumLayers; i++) {
651+
int clsSize = (track.itsClusterSizes() >> (kBitsPerLayer * i)) & kBitMask;
652+
sum += clsSize;
653+
if (clsSize)
650654
n++;
651655
}
652656
return n > 0 ? static_cast<float>(sum) / n : 0.f;

0 commit comments

Comments
 (0)