Skip to content

Commit e4d1932

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents f4fbd45 + 3223c9c commit e4d1932

39 files changed

+3884
-387
lines changed

Common/Core/TrackSelectorPID.h

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef COMMON_CORE_TRACKSELECTORPID_H_
1818
#define COMMON_CORE_TRACKSELECTORPID_H_
1919

20+
#include <CommonConstants/PhysicsConstants.h>
2021
#include <Framework/Logger.h>
2122
#include <ReconstructionDataFormats/PID.h>
2223

@@ -43,6 +44,9 @@ class TrackSelectorPidBase
4344
/// Default constructor
4445
TrackSelectorPidBase() = default;
4546

47+
static constexpr float NSigmaMinDefault{-999.f};
48+
static constexpr float NSigmaMaxDefault{999.f};
49+
4650
/// Conversion operator
4751
template <uint64_t pdgNew>
4852
operator TrackSelectorPidBase<pdgNew>() const
@@ -108,10 +112,10 @@ class TrackSelectorPidBase
108112
/// \param tpcNSigmaCustom custom TPC nσ value to be used for the selection, in case the desired value cannot be taken from the track table
109113
/// \return true if track satisfies TPC PID hypothesis for given TPC nσ range
110114
template <typename T>
111-
bool isSelectedByTpc(const T& track, bool& conditionalTof, float tpcNSigmaCustom = -999.f)
115+
bool isSelectedByTpc(const T& track, bool& conditionalTof, float tpcNSigmaCustom = NSigmaMinDefault)
112116
{
113117
// Accept if selection is disabled via large values.
114-
if (mNSigmaTpcMin < -999. && mNSigmaTpcMax > 999.) {
118+
if (mNSigmaTpcMin < NSigmaMinDefault && mNSigmaTpcMax > NSigmaMaxDefault) {
115119
return true;
116120
}
117121

@@ -127,16 +131,18 @@ class TrackSelectorPidBase
127131
nSigma = track.tpcNSigmaKa();
128132
} else if constexpr (pdg == kProton) {
129133
nSigma = track.tpcNSigmaPr();
134+
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
135+
nSigma = track.tpcNSigmaDe();
130136
} else {
131137
errorPdg();
132138
}
133139

134140
/// use custom TPC nσ, if a valid value is provided
135-
if (tpcNSigmaCustom > -999.f) {
141+
if (tpcNSigmaCustom > NSigmaMinDefault) {
136142
nSigma = tpcNSigmaCustom;
137143
}
138144

139-
if (mNSigmaTpcMinCondTof < -999. && mNSigmaTpcMaxCondTof > 999.) {
145+
if (mNSigmaTpcMinCondTof < NSigmaMinDefault && mNSigmaTpcMaxCondTof > NSigmaMaxDefault) {
140146
conditionalTof = true;
141147
} else {
142148
conditionalTof = mNSigmaTpcMinCondTof <= nSigma && nSigma <= mNSigmaTpcMaxCondTof;
@@ -148,7 +154,7 @@ class TrackSelectorPidBase
148154
/// \param track track
149155
/// \return TPC selection status (see TrackSelectorPID::Status)
150156
template <typename T>
151-
TrackSelectorPID::Status statusTpc(const T& track, float tpcNSigmaCustom = -999.f)
157+
TrackSelectorPID::Status statusTpc(const T& track, float tpcNSigmaCustom = NSigmaMinDefault)
152158
{
153159
if (!isValidForTpc(track)) {
154160
return TrackSelectorPID::NotApplicable;
@@ -202,10 +208,10 @@ class TrackSelectorPidBase
202208
/// \param tofNSigmaCustom custom TOF nσ value to be used for the selection, in case the desired value cannot be taken from the track table
203209
/// \return true if track satisfies TOF PID hypothesis for given TOF nσ range
204210
template <typename T>
205-
bool isSelectedByTof(const T& track, bool& conditionalTpc, float tofNSigmaCustom = -999.f)
211+
bool isSelectedByTof(const T& track, bool& conditionalTpc, float tofNSigmaCustom = NSigmaMinDefault)
206212
{
207213
// Accept if selection is disabled via large values.
208-
if (mNSigmaTofMin < -999. && mNSigmaTofMax > 999.) {
214+
if (mNSigmaTofMin < NSigmaMinDefault && mNSigmaTofMax > NSigmaMaxDefault) {
209215
return true;
210216
}
211217

@@ -221,16 +227,18 @@ class TrackSelectorPidBase
221227
nSigma = track.tofNSigmaKa();
222228
} else if constexpr (pdg == kProton) {
223229
nSigma = track.tofNSigmaPr();
230+
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
231+
nSigma = track.tofNSigmaDe();
224232
} else {
225233
errorPdg();
226234
}
227235

228236
/// use custom TOF nσ, if a valid value is provided
229-
if (tofNSigmaCustom > -999.f) {
237+
if (tofNSigmaCustom > NSigmaMinDefault) {
230238
nSigma = tofNSigmaCustom;
231239
}
232240

233-
if (mNSigmaTofMinCondTpc < -999. && mNSigmaTofMaxCondTpc > 999.) {
241+
if (mNSigmaTofMinCondTpc < NSigmaMinDefault && mNSigmaTofMaxCondTpc > NSigmaMaxDefault) {
234242
conditionalTpc = true;
235243
} else {
236244
conditionalTpc = mNSigmaTofMinCondTpc <= nSigma && nSigma <= mNSigmaTofMaxCondTpc;
@@ -242,7 +250,7 @@ class TrackSelectorPidBase
242250
/// \param track track
243251
/// \return TOF selection status (see TrackSelectorPID::Status)
244252
template <typename T>
245-
TrackSelectorPID::Status statusTof(const T& track, float tofNSigmaCustom = -999.f)
253+
TrackSelectorPID::Status statusTof(const T& track, float tofNSigmaCustom = NSigmaMinDefault)
246254
{
247255
if (!isValidForTof(track)) {
248256
return TrackSelectorPID::NotApplicable;
@@ -301,7 +309,7 @@ class TrackSelectorPidBase
301309
bool isSelectedByRich(const T& track, bool& conditionalTof)
302310
{
303311
// Accept if selection is disabled via large values.
304-
if (mNSigmaRichMin < -999. && mNSigmaRichMax > 999.) {
312+
if (mNSigmaRichMin < NSigmaMinDefault && mNSigmaRichMax > NSigmaMaxDefault) {
305313
return true;
306314
}
307315

@@ -321,7 +329,7 @@ class TrackSelectorPidBase
321329
errorPdg();
322330
}
323331

324-
if (mNSigmaRichMinCondTof < -999. && mNSigmaRichMaxCondTof > 999.) {
332+
if (mNSigmaRichMinCondTof < NSigmaMinDefault && mNSigmaRichMaxCondTof > NSigmaMaxDefault) {
325333
conditionalTof = true;
326334
} else {
327335
conditionalTof = mNSigmaRichMinCondTof <= nSigma && nSigma <= mNSigmaRichMaxCondTof;
@@ -405,7 +413,7 @@ class TrackSelectorPidBase
405413
/// \param track track
406414
/// \return status of combined PID (TPC or TOF) (see TrackSelectorPID::Status)
407415
template <typename T>
408-
TrackSelectorPID::Status statusTpcOrTof(const T& track, float tpcNSigmaCustom = -999.f, float tofNSigmaCustom = -999.f)
416+
TrackSelectorPID::Status statusTpcOrTof(const T& track, float tpcNSigmaCustom = NSigmaMinDefault, float tofNSigmaCustom = NSigmaMinDefault)
409417
{
410418
int pidTpc = statusTpc(track, tpcNSigmaCustom);
411419
int pidTof = statusTof(track, tofNSigmaCustom);
@@ -426,7 +434,7 @@ class TrackSelectorPidBase
426434
/// \param track track
427435
/// \return status of combined PID (TPC and TOF) (see TrackSelectorPID::Status)
428436
template <typename T>
429-
TrackSelectorPID::Status statusTpcAndTof(const T& track, float tpcNSigmaCustom = -999.f, float tofNSigmaCustom = -999.f)
437+
TrackSelectorPID::Status statusTpcAndTof(const T& track, float tpcNSigmaCustom = NSigmaMinDefault, float tofNSigmaCustom = NSigmaMinDefault)
430438
{
431439
int pidTpc = TrackSelectorPID::NotApplicable;
432440
if (track.hasTPC()) {
@@ -464,23 +472,29 @@ class TrackSelectorPidBase
464472
template <typename T>
465473
bool isElectronAndNotPion(const T& track, bool useTof = true, bool useRich = true)
466474
{
475+
constexpr float NSigmaInvalid{-1000.f};
476+
constexpr float PTofRichTElectronMin{0.4f};
477+
constexpr float PTofRichTElectronMax{0.6f};
478+
constexpr float PRichPionBandMin{1.0f};
479+
constexpr float PRichPionBandMax{2.0f};
480+
467481
bool isSelTof = false;
468482
bool isSelRich = false;
469483
bool hasRich = track.richId() > -1;
470484
bool hasTof = isValidForTof(track);
471485
auto nSigmaTofEl = track.tofNSigmaEl();
472486
auto nSigmaTofPi = track.tofNSigmaPi();
473-
auto nSigmaRichEl = hasRich ? track.rich().richNsigmaEl() : -1000.;
474-
auto nSigmaRichPi = hasRich ? track.rich().richNsigmaPi() : -1000.;
487+
auto nSigmaRichEl = hasRich ? track.rich().richNsigmaEl() : NSigmaInvalid;
488+
auto nSigmaRichPi = hasRich ? track.rich().richNsigmaPi() : NSigmaInvalid;
475489
auto p = track.p();
476490

477491
// TOF
478-
if (useTof && hasTof && (p < 0.6)) {
479-
if (p > 0.4 && hasRich) {
492+
if (useTof && hasTof && (p < PTofRichTElectronMax)) {
493+
if (p > PTofRichTElectronMin && hasRich) {
480494
if ((std::abs(nSigmaTofEl) < mNSigmaTofMax) && (std::abs(nSigmaRichEl) < mNSigmaRichMax)) {
481495
isSelTof = true; // is selected as electron by TOF and RICH
482496
}
483-
} else if (p <= 0.4) {
497+
} else if (p <= PTofRichTElectronMin) {
484498
if (std::abs(nSigmaTofEl) < mNSigmaTofMax) {
485499
isSelTof = true; // is selected as electron by TOF
486500
}
@@ -499,7 +513,7 @@ class TrackSelectorPidBase
499513
if (std::abs(nSigmaRichEl) < mNSigmaRichMax) {
500514
isSelRich = true; // is selected as electron by RICH
501515
}
502-
if ((std::abs(nSigmaRichPi) < mNSigmaRichMax) && (p > 1.0) && (p < 2.0)) {
516+
if ((std::abs(nSigmaRichPi) < mNSigmaRichMax) && (p > PRichPionBandMin) && (p < PRichPionBandMax)) {
503517
isSelRich = false; // is selected as pion by RICH
504518
}
505519
} else {
@@ -551,6 +565,8 @@ class TrackSelectorPidBase
551565
return track.bayesID() == o2::track::PID::Kaon;
552566
} else if constexpr (pdg == kProton) {
553567
return track.bayesID() == o2::track::PID::Proton;
568+
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
569+
return track.bayesID() == o2::track::PID::Deuteron;
554570
} else {
555571
errorPdg();
556572
return false;
@@ -579,6 +595,8 @@ class TrackSelectorPidBase
579595
prob = track.bayesKa();
580596
} else if constexpr (pdg == kProton) {
581597
prob = track.bayesPr();
598+
} else if constexpr (pdg == o2::constants::physics::Pdg::kDeuteron) {
599+
prob = track.bayesDe();
582600
} else {
583601
errorPdg();
584602
}
@@ -656,10 +674,11 @@ class TrackSelectorPidBase
656674
};
657675

658676
// Predefined types
659-
using TrackSelectorEl = TrackSelectorPidBase<kElectron>; // El
660-
using TrackSelectorMu = TrackSelectorPidBase<kMuonMinus>; // Mu
661-
using TrackSelectorPi = TrackSelectorPidBase<kPiPlus>; // Pi
662-
using TrackSelectorKa = TrackSelectorPidBase<kKPlus>; // Ka
663-
using TrackSelectorPr = TrackSelectorPidBase<kProton>; // Pr
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
682+
using TrackSelectorDe = TrackSelectorPidBase<o2::constants::physics::Pdg::kDeuteron>; // De
664683

665684
#endif // COMMON_CORE_TRACKSELECTORPID_H_

Common/Tasks/qVectorsCorrection.cxx

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct qVectorsCorrection {
7878
Configurable<bool> cfgQAFlowStudy{"cfgQAFlowStudy", false, "configurable for flow study"};
7979
Configurable<bool> cfgQAOccupancyStudy{"cfgQAOccupancyStudy", false, "configurable for occupancy study"};
8080
Configurable<bool> cfgAddEvtSelPileup{"cfgAddEvtSelPileup", false, "configurable for pileup selection"};
81-
Configurable<bool> cfgShiftCor{"cfgShiftCor", false, "configurable for shift correction"};
81+
Configurable<bool> cfgShiftCorPrep{"cfgShiftCorPrep", false, "configurable for shift correction"};
8282

8383
Configurable<float> cfgMinPt{"cfgMinPt", 0.15, "Minimum transverse momentum for charged track"};
8484
Configurable<float> cfgMaxEta{"cfgMaxEta", 0.8, "Maximum pseudorapidiy for charged track"};
@@ -178,6 +178,9 @@ struct qVectorsCorrection {
178178
AxisSpec axisAzimuth{cfgaxisAzimuth, "relative azimuthal angle"};
179179
AxisSpec axisOccupancy{cfgaxisOccupancy, "Occupancy"};
180180

181+
AxisSpec axisShift = {10, 0, 10, "shift"};
182+
AxisSpec axisBasis = {20, 0, 20, "basis"};
183+
181184
histosQA.add("histCentFull", "Centrality distribution for valid events",
182185
HistType::kTH1F, {axisCent});
183186

@@ -201,6 +204,10 @@ struct qVectorsCorrection {
201204
histosQA.add(Form("histQvecRefAFinalV%d", cfgnMods->at(i)), "", {HistType::kTH3F, {axisQvec, axisQvec, axisCent}});
202205
histosQA.add(Form("histQvecRefBFinalV%d", cfgnMods->at(i)), "", {HistType::kTH3F, {axisQvec, axisQvec, axisCent}});
203206

207+
if (cfgShiftCorPrep) {
208+
histosQA.add(Form("histShiftV%d", cfgnMods->at(i)), "", {HistType::kTProfile3D, {axisCent, axisBasis, axisShift}});
209+
}
210+
204211
if (cfgQAOccupancyStudy) {
205212
histosQA.add(Form("histQvecOccFinalV%d", cfgnMods->at(i)), "", {HistType::kTHnSparseF, {axisQvecF, axisQvecF, axisCent, axisOccupancy}});
206213
histosQA.add(Form("histQvecRefAOccFinalV%d", cfgnMods->at(i)), "", {HistType::kTHnSparseF, {axisQvecF, axisQvecF, axisCent, axisOccupancy}});
@@ -254,6 +261,49 @@ struct qVectorsCorrection {
254261
}
255262
} // End void init(InitContext const&)
256263

264+
template <typename T>
265+
void fillHistosShiftCor(const T& vec, int nmode)
266+
{
267+
int DetInd = DetId * 4 + cfgnTotalSystem * 4 * (nmode - 2) + 3;
268+
int RefAInd = RefAId * 4 + cfgnTotalSystem * 4 * (nmode - 2) + 3;
269+
int RefBInd = RefBId * 4 + cfgnTotalSystem * 4 * (nmode - 2) + 3;
270+
271+
if (nmode == 2) {
272+
for (int ishift = 1; ishift <= 10; ishift++) {
273+
histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * DetId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast<float>(nmode)));
274+
histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * DetId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast<float>(nmode)));
275+
276+
histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * RefAId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast<float>(nmode)));
277+
histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * RefAId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast<float>(nmode)));
278+
279+
histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * RefBId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast<float>(nmode)));
280+
histosQA.fill(HIST("histShiftV2"), vec.cent(), 2.0 * RefBId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast<float>(nmode)));
281+
}
282+
} else if (nmode == 3) {
283+
for (int ishift = 1; ishift <= 10; ishift++) {
284+
histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * DetId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast<float>(nmode)));
285+
histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * DetId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast<float>(nmode)));
286+
287+
histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * RefAId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast<float>(nmode)));
288+
histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * RefAId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast<float>(nmode)));
289+
290+
histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * RefBId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast<float>(nmode)));
291+
histosQA.fill(HIST("histShiftV3"), vec.cent(), 2.0 * RefBId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast<float>(nmode)));
292+
}
293+
} else if (nmode == 4) {
294+
for (int ishift = 1; ishift <= 10; ishift++) {
295+
histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * DetId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast<float>(nmode)));
296+
histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * DetId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[DetInd], vec.qvecRe()[DetInd]) / static_cast<float>(nmode)));
297+
298+
histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * RefAId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast<float>(nmode)));
299+
histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * RefAId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefAInd], vec.qvecRe()[RefAInd]) / static_cast<float>(nmode)));
300+
301+
histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * RefBId + 0.5, ishift - 0.5, TMath::Sin(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast<float>(nmode)));
302+
histosQA.fill(HIST("histShiftV4"), vec.cent(), 2.0 * RefBId + 1.5, ishift - 0.5, TMath::Cos(ishift * static_cast<float>(nmode) * TMath::ATan2(vec.qvecIm()[RefBInd], vec.qvecRe()[RefBInd]) / static_cast<float>(nmode)));
303+
}
304+
}
305+
}
306+
257307
template <typename CollType, typename TrackType>
258308
void fillHistosFlowWithSC(const CollType& coll, const TrackType& track, int nmode)
259309
{
@@ -674,6 +724,12 @@ struct qVectorsCorrection {
674724
return;
675725
}
676726

727+
if (cfgShiftCorPrep) {
728+
for (uint i = 0; i < cfgnMods->size(); i++) {
729+
fillHistosShiftCor(qVec, cfgnMods->at(i));
730+
}
731+
}
732+
677733
for (uint i = 0; i < cfgnMods->size(); i++) {
678734
fillHistosQvec(qVec, cfgnMods->at(i));
679735
if (cfgQAFinal && cfgQAFlowStudy) {
@@ -715,7 +771,7 @@ struct qVectorsCorrection {
715771

716772
for (uint i = 0; i < cfgnMods->size(); i++) {
717773
fillHistosQvecWithSC(qVec, cfgnMods->at(i));
718-
if (cfgQAFlowStudy) {
774+
if (cfgQAFinal && cfgQAFlowStudy) {
719775
fillHistosFlowWithSC(qVec, tracks, cfgnMods->at(i));
720776
}
721777
}

0 commit comments

Comments
 (0)