Skip to content

Commit 04586ec

Browse files
[PWGJE] Add processes to get track efficiency (#13323)
1 parent b8f6456 commit 04586ec

File tree

1 file changed

+76
-11
lines changed

1 file changed

+76
-11
lines changed

PWGJE/Tasks/jetShape.cxx

Lines changed: 76 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "Framework/HistogramRegistry.h"
3131
#include "Framework/runDataProcessing.h"
3232

33+
#include <TPDGCode.h>
34+
3335
#include <cmath>
3436
#include <string>
3537
#include <vector>
@@ -49,6 +51,8 @@ struct JetShapeTask {
4951
Configurable<int> nBinsTofBeta{"nBinsTofBeta", 350, "Number of Beta bins"};
5052
Configurable<float> pMax{"pMax", 7.0f, "Max value of p"};
5153
Configurable<float> ptMax{"ptMax", 5.0f, "Max value of pT"};
54+
Configurable<int> nBinsP{"nBinsP", 70, "Number of p bins"};
55+
Configurable<int> nBinsPt{"nBinsPt", 50, "Number of pT bins"};
5256
Configurable<int> nBinsDistance{"nBinsDistance", 7, "Number of distance bins"};
5357
Configurable<float> distanceMax{"distanceMax", 0.7f, "Max value of distance"};
5458
Configurable<float> nSigmaTofCut{"nSigmaTofCut", 2.0f, "Number of sigma cut for TOF PID"};
@@ -62,17 +66,17 @@ struct JetShapeTask {
6266
{"tpcTofPr", "tpcTofPr", {HistType::kTHnSparseD, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}, {nBinsDistance, 0, distanceMax}}}},
6367
{"tpcTofPiOutOfJet", "tpcTofPiOutOfJet", {HistType::kTH2F, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}},
6468
{"tpcTofPrOutOfJet", "tpcTofPrOutOfJet", {HistType::kTH2F, {{35, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}},
65-
{"tpcPi", "tpcPi", {HistType::kTH2F, {{70, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}},
66-
{"tofPi", "tofPi", {HistType::kTH2F, {{50, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}},
67-
{"tpcPr", "tpcPr", {HistType::kTH2F, {{70, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}},
68-
{"tofPr", "tofPr", {HistType::kTH2F, {{50, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}},
69+
{"tpcPi", "tpcPi", {HistType::kTH2F, {{nBinsP, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}},
70+
{"tofPi", "tofPi", {HistType::kTH2F, {{nBinsPt, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}},
71+
{"tpcPr", "tpcPr", {HistType::kTH2F, {{nBinsP, 0, pMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}},
72+
{"tofPr", "tofPr", {HistType::kTH2F, {{nBinsPt, 0, ptMax}, {nBinsNSigma, nSigmaMin, nSigmaMax}}}},
6973
{"tpcDedx", "tpcDedx", {HistType::kTHnSparseD, {{nBinsPForDedx, 0, pMax}, {nBinsTpcDedx, 0, 1000}, {nBinsDistance, 0, distanceMax}}}},
7074
{"tpcDedxOutOfJet", "tpcDedxOutOfJet", {HistType::kTH2F, {{nBinsPForDedx, 0, pMax}, {nBinsTpcDedx, 0, 1000}}}},
7175
{"tofBeta", "tofBeta", {HistType::kTH2F, {{nBinsPForBeta, 0, pMax}, {nBinsTofBeta, 0.4, 1.1}}}},
72-
{"pVsPtForPr", "pVsPtForPr", {HistType::kTHnSparseD, {{70, 0, pMax}, {50, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}},
73-
{"pVsPtForPi", "pVsPtPi", {HistType::kTHnSparseD, {{70, 0, pMax}, {50, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}},
74-
{"pVsPtForPrOutOfJet", "pVsPtForPrOutOfJet", {HistType::kTH2F, {{70, 0, pMax}, {50, 0, ptMax}}}},
75-
{"pVsPtForPiOutOfJet", "pVsPtPionOutOfJet", {HistType::kTH2F, {{70, 0, pMax}, {50, 0, ptMax}}}},
76+
{"pVsPtForPr", "pVsPtForPr", {HistType::kTHnSparseD, {{nBinsP, 0, pMax}, {nBinsPt, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}},
77+
{"pVsPtForPi", "pVsPtPi", {HistType::kTHnSparseD, {{nBinsP, 0, pMax}, {nBinsPt, 0, ptMax}, {nBinsDistance, 0, distanceMax}}}},
78+
{"pVsPtForPrOutOfJet", "pVsPtForPrOutOfJet", {HistType::kTH2F, {{nBinsP, 0, pMax}, {nBinsPt, 0, ptMax}}}},
79+
{"pVsPtForPiOutOfJet", "pVsPtPionOutOfJet", {HistType::kTH2F, {{nBinsP, 0, pMax}, {nBinsPt, 0, ptMax}}}},
7680
{"tofMass", "tofMass", {HistType::kTH1F, {{300, 0, 3}}}},
7781
{"trackPhi", "trackPhi", {HistType::kTH1F, {{80, -1, 7}}}},
7882
{"trackEta", "trackEta", {HistType::kTH1F, {{100, -1, 1}}}},
@@ -94,7 +98,15 @@ struct JetShapeTask {
9498
{"ptSumBg1", "ptSumBg1", {HistType::kTH2F, {{14, 0, 0.7}, {300, 0, 300}}}},
9599
{"ptSumBg2", "ptSumBg2", {HistType::kTH2F, {{14, 0, 0.7}, {300, 0, 300}}}},
96100
{"event/vertexz", ";Vtx_{z} (cm);Entries", {HistType::kTH1F, {{100, -20, 20}}}},
97-
{"ptVsCentrality", "ptvscentrality", {HistType::kTH2F, {{100, 0, 100}, {300, 0, 300}}}}}};
101+
{"eventCounter", "eventCounter", {HistType::kTH1F, {{1, 0, +1, ""}}}},
102+
{"ptVsCentrality", "ptvscentrality", {HistType::kTH2F, {{100, 0, 100}, {300, 0, 300}}}},
103+
{"ptResolution", "ptResolution", {HistType::kTH2F, {{50, 0, ptMax}, {100, -1.0, +1.0}}}},
104+
{"ptHistogramPion", "ptHistogramPion", {HistType::kTH1F, {{50, 0, ptMax}}}},
105+
{"ptHistogramKaon", "ptHistogramKaon", {HistType::kTH1F, {{50, 0, ptMax}}}},
106+
{"ptHistogramProton", "ptHistogramProton", {HistType::kTH1F, {{50, 0, ptMax}}}},
107+
{"ptGeneratedPion", "ptGeneratedPion", {HistType::kTH1F, {{50, 0, ptMax}}}},
108+
{"ptGeneratedKaon", "ptGeneratedKaon", {HistType::kTH1F, {{50, 0, ptMax}}}},
109+
{"ptGeneratedProton", "ptGeneratedProton", {HistType::kTH1F, {{50, 0, ptMax}}}}}};
98110

99111
Configurable<float> vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"};
100112

@@ -119,6 +131,7 @@ struct JetShapeTask {
119131
Configurable<float> nclItsMin{"nclItsMin", 2.0f, "its # of cluster cut"};
120132
Configurable<float> nclTpcMin{"nclTpcMin", 100.0f, "tpc # if cluster cut"};
121133
Configurable<float> nclcrossTpcMin{"nclcrossTpcMin", 70.0f, "tpc # of crossedRows cut"};
134+
Configurable<float> mcRapidityMax{"mcRapidityMax", 0.5f, "maximum mctrack y"};
122135

123136
Configurable<std::string> triggerMasks{"triggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"};
124137

@@ -258,7 +271,7 @@ struct JetShapeTask {
258271
}
259272
}
260273
}
261-
PROCESS_SWITCH(JetShapeTask, processJetShape, "JetShape", true);
274+
PROCESS_SWITCH(JetShapeTask, processJetShape, "JetShape", false);
262275

263276
void processProductionRatio(soa::Filtered<aod::JetCollisions>::iterator const& collision, soa::Join<aod::JetTracks, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTPCFullPr, aod::pidTOFFullPr, aod::TracksExtra, aod::TracksDCA, aod::pidTOFbeta, aod::pidTOFmass> const& tracks, soa::Join<aod::ChargedJets, aod::ChargedJetConstituents> const& jets)
264277
{
@@ -366,7 +379,59 @@ struct JetShapeTask {
366379
}
367380
}
368381
}
369-
PROCESS_SWITCH(JetShapeTask, processProductionRatio, "production ratio", true);
382+
PROCESS_SWITCH(JetShapeTask, processProductionRatio, "production ratio", false);
383+
384+
void processReco(soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::McTrackLabels> const& tracks, aod::McParticles const&)
385+
{
386+
registry.fill(HIST("eventCounter"), 0.5);
387+
388+
for (const auto& track : tracks) {
389+
if (track.has_mcParticle()) {
390+
auto mcParticle = track.mcParticle();
391+
registry.fill(HIST("ptResolution"), track.pt(), track.pt() - mcParticle.pt());
392+
393+
if (std::abs(track.eta()) > etaTrUp)
394+
continue;
395+
if (track.tpcNClsCrossedRows() < nclcrossTpcMin)
396+
continue;
397+
if (std::abs(track.dcaXY()) > dcaxyMax)
398+
continue;
399+
if (track.itsChi2NCl() > chi2ItsMax)
400+
continue;
401+
if (track.tpcChi2NCl() > chi2TpcMax)
402+
continue;
403+
if (track.tpcNClsFound() < nclTpcMin)
404+
continue;
405+
if (track.itsNCls() < nclItsMin)
406+
continue;
407+
408+
if (mcParticle.isPhysicalPrimary() && std::fabs(mcParticle.y()) < mcRapidityMax) { // do this in the context of the track ! (context matters!!!)
409+
if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus)
410+
registry.fill(HIST("ptHistogramPion"), mcParticle.pt());
411+
if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus)
412+
registry.fill(HIST("ptHistogramKaon"), mcParticle.pt());
413+
if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton)
414+
registry.fill(HIST("ptHistogramProton"), mcParticle.pt());
415+
}
416+
}
417+
}
418+
}
419+
PROCESS_SWITCH(JetShapeTask, processReco, "process reconstructed information", true);
420+
421+
void processSim(aod::McParticles const& mcParticles)
422+
{
423+
for (const auto& mcParticle : mcParticles) {
424+
if (mcParticle.isPhysicalPrimary() && std::fabs(mcParticle.y()) < mcRapidityMax) {
425+
if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus)
426+
registry.fill(HIST("ptGeneratedPion"), mcParticle.pt());
427+
if (std::abs(mcParticle.pdgCode()) == PDG_t::kKPlus)
428+
registry.fill(HIST("ptGeneratedKaon"), mcParticle.pt());
429+
if (std::abs(mcParticle.pdgCode()) == PDG_t::kProton)
430+
registry.fill(HIST("ptGeneratedProton"), mcParticle.pt());
431+
}
432+
}
433+
}
434+
PROCESS_SWITCH(JetShapeTask, processSim, "process pure simulation information", true);
370435
};
371436

372437
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<JetShapeTask>(cfgc)}; }

0 commit comments

Comments
 (0)