Skip to content

Commit 64efc3b

Browse files
author
Preet Pati
committed
Addition New PID function
1 parent 08d95c0 commit 64efc3b

File tree

1 file changed

+115
-14
lines changed

1 file changed

+115
-14
lines changed

PWGCF/Flow/Tasks/flowPbpbPikp.cxx

Lines changed: 115 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "Common/DataModel/TrackSelectionTables.h"
3737
#include "Common/DataModel/Centrality.h"
3838
#include "Common/DataModel/PIDResponse.h"
39+
#include "Common/DataModel/PIDResponseITS.h"
3940
#include "Common/Core/trackUtilities.h"
4041
#include "Common/DataModel/Multiplicity.h"
4142
#include "CommonConstants/PhysicsConstants.h"
@@ -82,13 +83,14 @@ struct FlowPbpbPikp {
8283
O2_DEFINE_CONFIGURABLE(cfgCutPtMax, float, 3.0f, "Maximal pT for ref tracks")
8384
O2_DEFINE_CONFIGURABLE(cfgCutEta, float, 0.8f, "Eta range for tracks")
8485
O2_DEFINE_CONFIGURABLE(cfgTpcCluster, int, 70, "Number of TPC clusters")
86+
O2_DEFINE_CONFIGURABLE(cfgTpcCrossRows, int, 70, "Number of TPC clusters")
8587
O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters")
8688
O2_DEFINE_CONFIGURABLE(cfgNbootstrap, int, 10, "Number of subsamples")
8789
O2_DEFINE_CONFIGURABLE(cfgOutputNUAWeights, bool, true, "Fill and output NUA weights")
8890
O2_DEFINE_CONFIGURABLE(cfgOutputRunByRun, bool, true, "Fill and output NUA weights run by run")
8991
O2_DEFINE_CONFIGURABLE(cfgEfficiency, std::string, "", "CCDB path to efficiency object")
9092
O2_DEFINE_CONFIGURABLE(cfgAcceptance, std::string, "", "CCDB path to acceptance object")
91-
O2_DEFINE_CONFIGURABLE(cfgTpcNsigmaCut, float, 2.0f, "TPC N-sigma cut for pions, kaons, protons")
93+
O2_DEFINE_CONFIGURABLE(cfgTpcCut, float, 2.0f, "TPC N-sigma cut for pions, kaons, protons")
9294
O2_DEFINE_CONFIGURABLE(cfgTofPtCut, float, 0.5f, "Minimum pt to use TOF N-sigma")
9395
O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 2.0f, "DCAxy range for tracks")
9496
O2_DEFINE_CONFIGURABLE(cfgCutDCAz, float, 2.0f, "DCAz range for tracks")
@@ -97,18 +99,21 @@ struct FlowPbpbPikp {
9799
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyMax, int, 2000, "Maximum occupancy cut")
98100
O2_DEFINE_CONFIGURABLE(cfgUseGlobalTrack, bool, true, "use Global track")
99101
O2_DEFINE_CONFIGURABLE(cfgITScluster, int, 5, "Number of ITS cluster")
100-
O2_DEFINE_CONFIGURABLE(cfgTrackDensityCorrUse, bool, true, "Use track density efficiency correction")
102+
O2_DEFINE_CONFIGURABLE(cfgTrackDensityCorrUse, bool, false, "Use track density efficiency correction")
101103

102104
O2_DEFINE_CONFIGURABLE(cfgUseWeightPhiEtaVtxz, bool, false, "Use Phi, Eta, VertexZ dependent NUA weights")
103105
O2_DEFINE_CONFIGURABLE(cfgUseWeightPhiPtCent, bool, false, "Use Phi, Pt, Centrality dependent NUA weights")
104106
O2_DEFINE_CONFIGURABLE(cfgUseWeightPhiEtaPt, bool, true, "Use Phi, Eta, Pt dependent NUA weights")
105107
O2_DEFINE_CONFIGURABLE(cfgUseStrictPID, bool, true, "Use strict PID cuts for TPC")
106108
O2_DEFINE_CONFIGURABLE(cfgV0AT0Acut, int, 5, "V0AT0A cut")
109+
O2_DEFINE_CONFIGURABLE(cfgUseAsymmetricPID, bool, false, "Use asymmetric PID cuts");
110+
107111

108112
Configurable<std::vector<double>> cfgTrackDensityP0{"cfgTrackDensityP0", std::vector<double>{0.7217476707, 0.7384792571, 0.7542625668, 0.7640680200, 0.7701951667, 0.7755299053, 0.7805901710, 0.7849446786, 0.7957356586, 0.8113039262, 0.8211968966, 0.8280558878, 0.8329342135}, "parameter 0 for track density efficiency correction"};
109113
Configurable<std::vector<double>> cfgTrackDensityP1{"cfgTrackDensityP1", std::vector<double>{-2.169488e-05, -2.191913e-05, -2.295484e-05, -2.556538e-05, -2.754463e-05, -2.816832e-05, -2.846502e-05, -2.843857e-05, -2.705974e-05, -2.477018e-05, -2.321730e-05, -2.203315e-05, -2.109474e-05}, "parameter 1 for track density efficiency correction"};
110-
Configurable<std::vector<double>> cfgTofNsigmaCut{"cfgTofNsigmaCut", std::vector<double>{1.5, 1.5, 1.5}, "TOF n-sigma cut for pions, kaons, protons"};
111-
Configurable<std::vector<double>> cfgItsNsigmaCut{"cfgItsNsigmaCut", std::vector<double>{3, 2.5, 2}, "ITS n-sigma cut for pions, kaons, protons"};
114+
Configurable<std::vector<double>> cfgTofNsigmaCut{"cfgTofNsigmaCut", std::vector<double>{1.5, 1.5, 1.5, -1.5, -1.5, -1.5}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"};
115+
Configurable<std::vector<double>> cfgItsNsigmaCut{"cfgItsNsigmaCut", std::vector<double>{3, 2.5, 2, 3, 2.5, 2}, "ITS n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"};
116+
Configurable<std::vector<double>> cfgTpcNsigmaCut{"cfgTpcNsigmaCut", std::vector<double>{1.5, 1.5, 1.5, -1.5, -1.5, -1.5}, "TOF n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"};
112117
Configurable<std::vector<int>> cfgUseEventCuts{"cfgUseEventCuts", std::vector<int>{1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0}, "Switch for various event cuts [kNoTimeFrameBorder, kNoITSROFrameBorder, kNoSameBunchPileup, kIsGoodZvtxFT0vsPV, kNoCollInTimeRangeStandard, kIsGoodITSLayersAll, kNoCollInRofStandard, kNoHighMultCollInPrevRof, Occupancy, Multiplicity correlation, T0AV0A 3 sigma cut, kIsVertexITSTPC, kTVXinTRD]"};
113118

114119
Configurable<GFWRegions> cfgRegions{"cfgRegions", {{"refN08", "refP08", "full", "poiN", "olN", "poiP", "olP", "poi", "ol", "poiNpi", "olNpi", "poiPpi", "olPpi", "poifullpi", "olfullpi", "poiNka", "olNka", "poiPka", "olPka", "poifullka", "olfullka", "poiNpr", "olNpr", "poiPpr", "olPpr", "poifullpr", "olfullpr"}, {-0.8, 0.4, -0.8, -0.8, -0.8, 0.4, 0.4, -0.8, -0.8, -0.8, -0.8, 0.4, 0.4, -0.8, -0.8, -0.8, -0.8, 0.4, 0.4, -0.8, -0.8, -0.8, -0.8, 0.4, 0.4, -0.8, -0.8}, {-0.4, 0.8, 0.8, -0.4, -0.4, 0.8, 0.8, 0.8, 0.8, -0.4, -0.4, 0.8, 0.8, 0.8, 0.8, -0.4, -0.4, 0.8, 0.8, 0.8, 0.8, -0.4, -0.4, 0.8, 0.8, 0.8, 0.8}, {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 128, 256, 128, 256, 128, 256, 2, 16, 2, 16, 2, 16, 4, 32, 4, 32, 4, 32, 8, 64, 8, 64, 8, 64}}, "Configurations for GFW regions"};
@@ -123,9 +128,11 @@ struct FlowPbpbPikp {
123128
ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {80, -5, 5}, "nsigmaTOF axis"};
124129
ConfigurableAxis axisParticles{"axisParticles", {3, 0, 3}, "axis for different hadrons"};
125130
ConfigurableAxis axisTPCsignal{"axisTPCsignal", {10000, 0, 1000}, "axis for TPC signal"};
131+
ConfigurableAxis axisTOFbeta{"axisTOFbeta", {200, 0, 2}, "axis for TOF beta"};
126132

127133
std::vector<double> tofNsigmaCut = cfgTofNsigmaCut;
128134
std::vector<double> itsNsigmaCut = cfgItsNsigmaCut;
135+
std::vector<double> tpcNsigmaCut = cfgTofNsigmaCut;
129136

130137
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
131138
Filter trackFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz) && (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtPOIMin) && (aod::track::pt < cfgCutPtPOIMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls);
@@ -238,11 +245,15 @@ struct FlowPbpbPikp {
238245
histos.add("c24_full_pi", "", {HistType::kTProfile, {axisMultiplicity}});
239246
histos.add("c24_full_ka", "", {HistType::kTProfile, {axisMultiplicity}});
240247
histos.add("c24_full_pr", "", {HistType::kTProfile, {axisMultiplicity}});
248+
249+
histos.add("TpcdEdx", "", {HistType::kTH2D, {axisPt, axisTPCsignal}});
250+
histos.add("TofBeta", "", {HistType::kTH2D, {axisPt, axisTOFbeta}});
251+
241252
histos.add("TofTpcNsigma_before", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}});
242253
histos.add("TofTpcNsigma_after", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}});
243254
histos.add("partCount", "", {HistType::kTHnSparseD, {{axisParticles, axisMultiplicity, axisPt}}});
244255

245-
histos.add("hEventCount", "Number of Event;; Count", {HistType::kTH1D, {{15, 0, 15}}});
256+
histos.add("hEventCount", "Number of Events;; Count", {HistType::kTH1D, {{15, 0, 15}}});
246257
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event");
247258
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "After sel8");
248259
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "kNoTimeFrameBorder");
@@ -259,6 +270,18 @@ struct FlowPbpbPikp {
259270
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(14, "kIsVertexITSTPC");
260271
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(15, "kTVXinTRD");
261272

273+
histos.add("hTrackCount", "Number of Tracks;; Count", {HistType::kTH1D, {{10, 0, 10}}});
274+
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(1, "Filtered track");
275+
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(2, "Global tracks");
276+
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(3, "PV contributor");
277+
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(4, "ITS clusters");
278+
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(5, "TPC signal");
279+
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(6, "TPC clusters");
280+
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(7, "TPC crossed rows");
281+
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(8, "Pions");
282+
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(9, "Kaons");
283+
histos.get<TH1>(HIST("hTrackCount"))->GetXaxis()->SetBinLabel(10, "Protons");
284+
262285
if (cfgOutputNUAWeights && !cfgOutputRunByRun) {
263286
histos.add<TH3>("NUA/hPhiEtaVtxz_ref", ";#varphi;#eta;v_{z}", {HistType::kTH3D, {axisPhi, axisEta, axisVertex}});
264287
histos.add<TH3>("NUA/hPhiEtaVtxz_ch", ";#varphi;#eta;v_{z}", {HistType::kTH3D, {axisPhi, axisEta, axisVertex}});
@@ -386,13 +409,39 @@ struct FlowPbpbPikp {
386409
template <typename TTrack>
387410
bool selectionTrack(const TTrack& track)
388411
{
389-
if (cfgUseGlobalTrack && !(track.isGlobalTrack() && track.isPVContributor() && track.itsNCls() > cfgITScluster && track.tpcNClsFound() > cfgTpcCluster && track.hasTPC())) {
390-
return false;
412+
histos.fill(HIST("hTrackCount"), 0.5); // Filtered tracks
413+
if (cfgUseGlobalTrack && !(track.isGlobalTrack())) {
414+
return 0;
391415
}
392-
if (!cfgUseGlobalTrack && !(track.isPVContributor() && track.itsNCls() > cfgITScluster && track.hasTPC())) {
393-
return false;
416+
if (cfgUseGlobalTrack)
417+
histos.fill(HIST("hTrackCount"), 1.5); // After global track selection
418+
419+
if (!(track.isPVContributor())) {
420+
return 0;
394421
}
395-
return true;
422+
histos.fill(HIST("hTrackCount"), 2.5); // After PV contributor selection
423+
424+
if (!(track.itsNCls() > cfgITScluster)) {
425+
return 0;
426+
}
427+
histos.fill(HIST("hTrackCount"), 3.5); // After ITS cluster selection
428+
429+
if (!(track.hasTPC())) {
430+
return 0;
431+
}
432+
histos.fill(HIST("hTrackCount"), 4.5); // If track has TPC signal
433+
434+
if (!(track.tpcNClsFound() > cfgTpcCluster)) {
435+
return 0;
436+
}
437+
histos.fill(HIST("hTrackCount"), 5.5); // After TPC cluster selection
438+
439+
if (!(track.tpcNClsCrossedRows() > cfgTpcCrossRows)) {
440+
return 0;
441+
}
442+
histos.fill(HIST("hTrackCount"), 6.5); // After TPC crossed rows selection
443+
444+
return 1;
396445
}
397446

398447
template <typename TCollision, typename TTrack>
@@ -402,6 +451,7 @@ struct FlowPbpbPikp {
402451
switch (pidIndex) {
403452
case 1:
404453
histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPi(), track.tofNSigmaPi(), track.pt());
454+
histos.fill(HIST("hTrackCount"), 7.5); // Pion count
405455
if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz)
406456
histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_pi_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // pion weights
407457
if (!cfgAcceptance.value.empty() && cfgUseWeightPhiPtCent)
@@ -411,6 +461,7 @@ struct FlowPbpbPikp {
411461
break;
412462
case 2:
413463
histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaKa(), track.tofNSigmaKa(), track.pt());
464+
histos.fill(HIST("hTrackCount"), 8.5); // Kaon count
414465
if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz)
415466
histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_ka_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // kaon weights
416467
if (!cfgAcceptance.value.empty() && cfgUseWeightPhiPtCent)
@@ -420,6 +471,7 @@ struct FlowPbpbPikp {
420471
break;
421472
case 3:
422473
histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPr(), track.tofNSigmaPr(), track.pt());
474+
histos.fill(HIST("hTrackCount"), 9.5); // Proton count
423475
if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz)
424476
histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_pr_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // proton weights
425477
if (!cfgAcceptance.value.empty() && cfgUseWeightPhiPtCent)
@@ -437,20 +489,20 @@ struct FlowPbpbPikp {
437489
std::array<float, 3> nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()};
438490
std::array<float, 3> nSigmaCombined = {std::hypot(track.tpcNSigmaPi(), track.tofNSigmaPi()), std::hypot(track.tpcNSigmaKa(), track.tofNSigmaKa()), std::hypot(track.tpcNSigmaPr(), track.tofNSigmaPr())};
439491
int pid = -1;
440-
float nsigma = cfgTpcNsigmaCut;
492+
float nsigma = cfgTpcCut;
441493

442494
// Choose which nSigma to use
443495
std::array<float, 3> nSigmaToUse = (track.pt() > cfgTofPtCut && track.hasTOF()) ? nSigmaCombined : nSigmaTPC;
444496
if (track.pt() > cfgTofPtCut && !track.hasTOF())
445-
return -1;
497+
return 0;
446498

447499
const int numSpecies = 3;
448500
int pidCount = 0;
449501
// Select particle with the lowest nsigma
450502
for (int i = 0; i < numSpecies; ++i) {
451503
if (std::abs(nSigmaToUse[i]) < nsigma) {
452504
if (pidCount > 0 && cfgUseStrictPID)
453-
return -1; // more than one particle with low nsigma
505+
return 0; // more than one particle with low nsigma
454506

455507
pidCount++;
456508
pid = i;
@@ -461,6 +513,52 @@ struct FlowPbpbPikp {
461513
return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton
462514
}
463515

516+
template <typename TTrack>
517+
int getNsigmaPIDTpcTof_assymmetric(TTrack track)
518+
{
519+
// Computing Nsigma arrays for pion, kaon, and protons
520+
std::array<float, 3> nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()};
521+
std::array<float, 3> nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()};
522+
int pid = -1;
523+
524+
bool isPion, isKaon, isProton;
525+
bool isTpcPion = nSigmaTPC[0] < tpcNsigmaCut[0] && nSigmaTPC[0] > tpcNsigmaCut[0+3];
526+
bool isTpcKaon = nSigmaTPC[1] < tpcNsigmaCut[1] && nSigmaTPC[1] > tpcNsigmaCut[1+3];
527+
bool isTpcProton = nSigmaTPC[2] < tpcNsigmaCut[2] && nSigmaTPC[2] > tpcNsigmaCut[2+3];
528+
529+
bool isTofPion = nSigmaTOF[0] < tofNsigmaCut[0] && nSigmaTOF[0] > tofNsigmaCut[0+3];
530+
bool isTofKaon = nSigmaTOF[1] < tofNsigmaCut[1] && nSigmaTOF[1] > tofNsigmaCut[1+3];
531+
bool isTofProton = nSigmaTOF[2] < tofNsigmaCut[2] && nSigmaTOF[2] > tofNsigmaCut[2+3];
532+
533+
if (track.pt() > cfgTofPtCut && !track.hasTOF()) {
534+
return 0;
535+
} else if (track.pt() > cfgTofPtCut && track.hasTOF()) {
536+
isPion = isTofPion && isTpcPion;
537+
isKaon = isTofKaon && isTpcKaon;
538+
isProton = isTofProton && isTpcProton;
539+
} else {
540+
isPion = isTpcPion;
541+
isKaon = isTpcKaon;
542+
isProton = isTpcProton;
543+
}
544+
545+
if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) {
546+
return 0; // more than one particle satisfy the criteria
547+
}
548+
549+
if (isPion) {
550+
pid = PIONS;
551+
} else if (isKaon) {
552+
pid = KAONS;
553+
} else if (isProton) {
554+
pid = PROTONS;
555+
} else {
556+
return 0; // no particle satisfies the criteria
557+
}
558+
559+
return pid + 1; // shift the pid by 1, 1 = pion, 2 = kaon, 3 = proton
560+
}
561+
464562
template <char... chars>
465563
void fillProfile(const GFW::CorrConfig& corrconf, const ConstStr<chars...>& tarName, const double& cent)
466564
{
@@ -814,14 +912,17 @@ struct FlowPbpbPikp {
814912
histos.fill(HIST("hEta"), track.eta());
815913
histos.fill(HIST("hPt"), pt);
816914

915+
histos.fill(HIST("TpcdEdx"), pt, track.tpcSignal());
916+
histos.fill(HIST("TofBeta"), pt, track.beta());
917+
817918
histos.fill(HIST("TofTpcNsigma_before"), PIONS, track.tpcNSigmaPi(), track.tofNSigmaPi(), pt);
818919
histos.fill(HIST("TofTpcNsigma_before"), KAONS, track.tpcNSigmaKa(), track.tofNSigmaKa(), pt);
819920
histos.fill(HIST("TofTpcNsigma_before"), PROTONS, track.tpcNSigmaPr(), track.tofNSigmaPr(), pt);
820921

821922
bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range
822923
bool withinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); // within RF pT range
823924

824-
pidIndex = getNsigmaPIDTpcTof(track);
925+
pidIndex = cfgUseAsymmetricPID ? getNsigmaPIDTpcTof_assymmetric(track) : getNsigmaPIDTpcTof(track);
825926

826927
weff = 1; // Initializing weff for each track
827928
// NUA weights

0 commit comments

Comments
 (0)