Skip to content

Commit 7b5501c

Browse files
Preet-BhanjanPreet Patialibuild
authored
[PWGCF] Added ITS PID (#11608)
Co-authored-by: Preet Pati <preet@preet-6.local> Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 420d8cb commit 7b5501c

File tree

1 file changed

+71
-48
lines changed

1 file changed

+71
-48
lines changed

PWGCF/Flow/Tasks/flowPbpbPikp.cxx

Lines changed: 71 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,48 +13,46 @@
1313
/// \brief PID flow using the generic framework
1414
/// \author Preet Bhanjan Pati <preet.bhanjan.pati@cern.ch>
1515

16-
#include <CCDB/BasicCCDBManager.h>
17-
#include <cmath>
18-
#include <vector>
19-
#include <utility>
20-
#include <array>
21-
#include <string>
22-
#include <map>
23-
24-
#include "Math/Vector4D.h"
25-
26-
#include "Framework/runDataProcessing.h"
27-
#include "Framework/AnalysisTask.h"
28-
#include "Framework/ASoAHelpers.h"
29-
#include "Framework/RunningWorkflowInfo.h"
30-
#include "Framework/HistogramRegistry.h"
31-
#include "Framework/AnalysisDataModel.h"
32-
#include "Framework/StepTHn.h"
16+
#include "PWGCF/GenericFramework/Core/FlowContainer.h"
17+
#include "PWGCF/GenericFramework/Core/GFW.h"
18+
#include "PWGCF/GenericFramework/Core/GFWConfig.h"
19+
#include "PWGCF/GenericFramework/Core/GFWCumulant.h"
20+
#include "PWGCF/GenericFramework/Core/GFWPowerArray.h"
21+
#include "PWGCF/GenericFramework/Core/GFWWeights.h"
22+
#include "PWGCF/GenericFramework/Core/GFWWeightsList.h"
3323

34-
#include "Common/DataModel/EventSelection.h"
3524
#include "Common/Core/TrackSelection.h"
36-
#include "Common/DataModel/TrackSelectionTables.h"
25+
#include "Common/Core/trackUtilities.h"
3726
#include "Common/DataModel/Centrality.h"
27+
#include "Common/DataModel/EventSelection.h"
28+
#include "Common/DataModel/Multiplicity.h"
3829
#include "Common/DataModel/PIDResponse.h"
3930
#include "Common/DataModel/PIDResponseITS.h"
40-
#include "Common/Core/trackUtilities.h"
41-
#include "Common/DataModel/Multiplicity.h"
42-
#include "CommonConstants/PhysicsConstants.h"
43-
44-
#include "PWGCF/GenericFramework/Core/GFWPowerArray.h"
45-
#include "PWGCF/GenericFramework/Core/GFW.h"
46-
#include "PWGCF/GenericFramework/Core/GFWCumulant.h"
47-
#include "PWGCF/GenericFramework/Core/FlowContainer.h"
48-
#include "PWGCF/GenericFramework/Core/GFWWeights.h"
49-
#include "PWGCF/GenericFramework/Core/GFWWeightsList.h"
50-
#include "PWGCF/GenericFramework/Core/GFWConfig.h"
31+
#include "Common/DataModel/TrackSelectionTables.h"
5132

52-
#include "ReconstructionDataFormats/Track.h"
33+
#include "CommonConstants/PhysicsConstants.h"
34+
#include "Framework/ASoAHelpers.h"
35+
#include "Framework/AnalysisDataModel.h"
36+
#include "Framework/AnalysisTask.h"
37+
#include "Framework/HistogramRegistry.h"
38+
#include "Framework/RunningWorkflowInfo.h"
39+
#include "Framework/StepTHn.h"
40+
#include "Framework/runDataProcessing.h"
5341
#include "ReconstructionDataFormats/PID.h"
42+
#include "ReconstructionDataFormats/Track.h"
43+
#include <CCDB/BasicCCDBManager.h>
5444

45+
#include "Math/Vector4D.h"
46+
#include <TF1.h>
5547
#include <TProfile.h>
5648
#include <TRandom3.h>
57-
#include <TF1.h>
49+
50+
#include <array>
51+
#include <cmath>
52+
#include <map>
53+
#include <string>
54+
#include <utility>
55+
#include <vector>
5856

5957
using namespace o2;
6058
using namespace o2::framework;
@@ -72,6 +70,7 @@ GFWCorrConfigs configs;
7270
using namespace o2::analysis::genericframework;
7371

7472
struct FlowPbpbPikp {
73+
o2::aod::ITSResponse itsResponse;
7574
Service<ccdb::BasicCCDBManager> ccdb;
7675
Configurable<int64_t> noLaterThan{"noLaterThan", std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"};
7776
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
@@ -107,11 +106,12 @@ struct FlowPbpbPikp {
107106
O2_DEFINE_CONFIGURABLE(cfgUseStrictPID, bool, true, "Use strict PID cuts for TPC")
108107
O2_DEFINE_CONFIGURABLE(cfgV0AT0Acut, int, 5, "V0AT0A cut")
109108
O2_DEFINE_CONFIGURABLE(cfgUseAsymmetricPID, bool, false, "Use asymmetric PID cuts");
109+
O2_DEFINE_CONFIGURABLE(cfgUseItsPID, bool, true, "Use ITS PID for particle identification");
110110

111111
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"};
112112
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"};
113113
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"};
114-
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"};
114+
Configurable<std::vector<double>> cfgItsNsigmaCut{"cfgItsNsigmaCut", std::vector<double>{3, 3, 3, -3, -3, -3}, "ITS n-sigma cut for pions_posNsigma, kaons_posNsigma, protons_posNsigma, pions_negNsigma, kaons_negNsigma, protons_negNsigma"};
115115
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"};
116116
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]"};
117117

@@ -125,6 +125,7 @@ struct FlowPbpbPikp {
125125
ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "centrality axis for histograms"};
126126
ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {80, -5, 5}, "nsigmaTPC axis"};
127127
ConfigurableAxis axisNsigmaTOF{"axisNsigmaTOF", {80, -5, 5}, "nsigmaTOF axis"};
128+
ConfigurableAxis axisNsigmaITS{"axisNsigmaITS", {80, -5, 5}, "nsigmaITS axis"};
128129
ConfigurableAxis axisParticles{"axisParticles", {3, 0, 3}, "axis for different hadrons"};
129130
ConfigurableAxis axisTPCsignal{"axisTPCsignal", {10000, 0, 1000}, "axis for TPC signal"};
130131
ConfigurableAxis axisTOFbeta{"axisTOFbeta", {200, 0, 2}, "axis for TOF beta"};
@@ -249,9 +250,14 @@ struct FlowPbpbPikp {
249250
histos.add("TofBeta", "", {HistType::kTH2D, {axisPt, axisTOFbeta}});
250251

251252
histos.add("TofTpcNsigma_before", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}});
252-
histos.add("TofTpcNsigma_after", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}});
253+
if (!cfgUseItsPID)
254+
histos.add("TofTpcNsigma_after", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaTPC, axisNsigmaTOF, axisPt}}});
253255
histos.add("partCount", "", {HistType::kTHnSparseD, {{axisParticles, axisMultiplicity, axisPt}}});
254256

257+
histos.add("TofItsNsigma_before", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaITS, axisNsigmaTOF, axisPt}}});
258+
if (cfgUseItsPID)
259+
histos.add("TofItsNsigma_after", "", {HistType::kTHnSparseD, {{axisParticles, axisNsigmaITS, axisNsigmaTOF, axisPt}}});
260+
255261
histos.add("hEventCount", "Number of Events;; Count", {HistType::kTH1D, {{15, 0, 15}}});
256262
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event");
257263
histos.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "After sel8");
@@ -448,7 +454,10 @@ struct FlowPbpbPikp {
448454
histos.fill(HIST("partCount"), pidIndex - 1, collision.centFT0C(), track.pt());
449455
switch (pidIndex) {
450456
case 1:
451-
histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPi(), track.tofNSigmaPi(), track.pt());
457+
if (!cfgUseItsPID)
458+
histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPi(), track.tofNSigmaPi(), track.pt());
459+
if (cfgUseItsPID)
460+
histos.fill(HIST("TofItsNsigma_after"), pidIndex - 1, itsResponse.nSigmaITS<o2::track::PID::Pion>(track), track.tofNSigmaPi(), track.pt());
452461
histos.fill(HIST("hTrackCount"), 7.5); // Pion count
453462
if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz)
454463
histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_pi_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // pion weights
@@ -458,7 +467,10 @@ struct FlowPbpbPikp {
458467
histos.fill(HIST("PhiCorrected/hPhiEtaPt_pi_corrd"), track.phi(), track.eta(), track.pt(), wacc);
459468
break;
460469
case 2:
461-
histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaKa(), track.tofNSigmaKa(), track.pt());
470+
if (!cfgUseItsPID)
471+
histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaKa(), track.tofNSigmaKa(), track.pt());
472+
if (cfgUseItsPID)
473+
histos.fill(HIST("TofItsNsigma_after"), pidIndex - 1, itsResponse.nSigmaITS<o2::track::PID::Kaon>(track), track.tofNSigmaKa(), track.pt());
462474
histos.fill(HIST("hTrackCount"), 8.5); // Kaon count
463475
if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz)
464476
histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_ka_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // kaon weights
@@ -468,7 +480,10 @@ struct FlowPbpbPikp {
468480
histos.fill(HIST("PhiCorrected/hPhiEtaPt_ka_corrd"), track.phi(), track.eta(), track.pt(), wacc);
469481
break;
470482
case 3:
471-
histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPr(), track.tofNSigmaPr(), track.pt());
483+
if (!cfgUseItsPID)
484+
histos.fill(HIST("TofTpcNsigma_after"), pidIndex - 1, track.tpcNSigmaPr(), track.tofNSigmaPr(), track.pt());
485+
if (cfgUseItsPID)
486+
histos.fill(HIST("TofItsNsigma_after"), pidIndex - 1, itsResponse.nSigmaITS<o2::track::PID::Proton>(track), track.tofNSigmaPr(), track.pt());
472487
histos.fill(HIST("hTrackCount"), 9.5); // Proton count
473488
if (!cfgAcceptance.value.empty() && cfgUseWeightPhiEtaVtxz)
474489
histos.fill(HIST("PhiCorrected/hPhiEtaVtxz_pr_corrd"), track.phi(), track.eta(), collision.posZ(), wacc); // proton weights
@@ -512,17 +527,21 @@ struct FlowPbpbPikp {
512527
}
513528

514529
template <typename TTrack>
515-
int getNsigmaPIDTpcTofAssymmetric(TTrack track)
530+
int getNsigmaPIDAssymmetric(TTrack track)
516531
{
517532
// Computing Nsigma arrays for pion, kaon, and protons
518533
std::array<float, 3> nSigmaTPC = {track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr()};
519534
std::array<float, 3> nSigmaTOF = {track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr()};
535+
std::array<float, 3> nSigmaITS = {itsResponse.nSigmaITS<o2::track::PID::Pion>(track), itsResponse.nSigmaITS<o2::track::PID::Kaon>(track), itsResponse.nSigmaITS<o2::track::PID::Proton>(track)};
520536
int pid = -1;
521537

538+
std::array<float, 3> nSigmaToUse = cfgUseItsPID ? nSigmaITS : nSigmaTPC; // Choose which nSigma to use: TPC or ITS
539+
std::vector<double> detectorNsigmaCut = cfgUseItsPID ? itsNsigmaCut : tpcNsigmaCut; // Choose which nSigma to use: TPC or ITS
540+
522541
bool isPion, isKaon, isProton;
523-
bool isTpcPion = nSigmaTPC[0] < tpcNsigmaCut[0] && nSigmaTPC[0] > tpcNsigmaCut[0 + 3];
524-
bool isTpcKaon = nSigmaTPC[1] < tpcNsigmaCut[1] && nSigmaTPC[1] > tpcNsigmaCut[1 + 3];
525-
bool isTpcProton = nSigmaTPC[2] < tpcNsigmaCut[2] && nSigmaTPC[2] > tpcNsigmaCut[2 + 3];
542+
bool isDetectedPion = nSigmaToUse[0] < detectorNsigmaCut[0] && nSigmaToUse[0] > detectorNsigmaCut[0 + 3];
543+
bool isDetectedKaon = nSigmaToUse[1] < detectorNsigmaCut[1] && nSigmaToUse[1] > detectorNsigmaCut[1 + 3];
544+
bool isDetectedProton = nSigmaToUse[2] < detectorNsigmaCut[2] && nSigmaToUse[2] > detectorNsigmaCut[2 + 3];
526545

527546
bool isTofPion = nSigmaTOF[0] < tofNsigmaCut[0] && nSigmaTOF[0] > tofNsigmaCut[0 + 3];
528547
bool isTofKaon = nSigmaTOF[1] < tofNsigmaCut[1] && nSigmaTOF[1] > tofNsigmaCut[1 + 3];
@@ -531,13 +550,13 @@ struct FlowPbpbPikp {
531550
if (track.pt() > cfgTofPtCut && !track.hasTOF()) {
532551
return 0;
533552
} else if (track.pt() > cfgTofPtCut && track.hasTOF()) {
534-
isPion = isTofPion && isTpcPion;
535-
isKaon = isTofKaon && isTpcKaon;
536-
isProton = isTofProton && isTpcProton;
553+
isPion = isTofPion && isDetectedPion;
554+
isKaon = isTofKaon && isDetectedKaon;
555+
isProton = isTofProton && isDetectedProton;
537556
} else {
538-
isPion = isTpcPion;
539-
isKaon = isTpcKaon;
540-
isProton = isTpcProton;
557+
isPion = isDetectedPion;
558+
isKaon = isDetectedKaon;
559+
isProton = isDetectedProton;
541560
}
542561

543562
if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) {
@@ -917,10 +936,14 @@ struct FlowPbpbPikp {
917936
histos.fill(HIST("TofTpcNsigma_before"), KAONS, track.tpcNSigmaKa(), track.tofNSigmaKa(), pt);
918937
histos.fill(HIST("TofTpcNsigma_before"), PROTONS, track.tpcNSigmaPr(), track.tofNSigmaPr(), pt);
919938

939+
histos.fill(HIST("TofItsNsigma_before"), PIONS, itsResponse.nSigmaITS<o2::track::PID::Pion>(track), track.tofNSigmaPi(), pt);
940+
histos.fill(HIST("TofItsNsigma_before"), KAONS, itsResponse.nSigmaITS<o2::track::PID::Kaon>(track), track.tofNSigmaKa(), pt);
941+
histos.fill(HIST("TofItsNsigma_before"), PROTONS, itsResponse.nSigmaITS<o2::track::PID::Proton>(track), track.tofNSigmaPr(), pt);
942+
920943
bool withinPtPOI = (cfgCutPtPOIMin < pt) && (pt < cfgCutPtPOIMax); // within POI pT range
921944
bool withinPtRef = (cfgCutPtMin < pt) && (pt < cfgCutPtMax); // within RF pT range
922945

923-
pidIndex = cfgUseAsymmetricPID ? getNsigmaPIDTpcTofAssymmetric(track) : getNsigmaPIDTpcTof(track);
946+
pidIndex = cfgUseAsymmetricPID ? getNsigmaPIDAssymmetric(track) : getNsigmaPIDTpcTof(track);
924947

925948
weff = 1; // Initializing weff for each track
926949
// NUA weights

0 commit comments

Comments
 (0)