Skip to content

Commit aec9c5b

Browse files
authored
[PWGCF] Modified the Efficiency and the Purity correction. (#17841)
1 parent 1d2f0ca commit aec9c5b

1 file changed

Lines changed: 51 additions & 27 deletions

File tree

PWGCF/TwoParticleCorrelations/Tasks/longrangecorrDerived.cxx

Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ struct LongrangecorrDerived {
7575
SGSelector sgSelector;
7676
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
7777
TrackSelection myTrackFilter;
78-
Service<o2::framework::O2DatabasePDG> pdg;
79-
Service<o2::ccdb::BasicCCDBManager> ccdb;
78+
Service<o2::framework::O2DatabasePDG> pdg{};
79+
Service<o2::ccdb::BasicCCDBManager> ccdb{};
8080

8181
struct : ConfigurableGroup {
8282
Configurable<int> cfgNmixedevent{"cfgNmixedevent", 5, "how many events are mixed"};
@@ -115,6 +115,10 @@ struct LongrangecorrDerived {
115115
Configurable<float> cfgTofPidPtCut{"cfgTofPidPtCut", 0.4f, "Minimum pt to use TOF N-sigma"};
116116
Configurable<float> cfgPidNsigmaMax{"cfgPidNsigmaMax", 1.5f, "Maximum n-sigma for PID"};
117117
Configurable<float> cfgPidNsigmaMin{"cfgPidNsigmaMin", -1.5f, "Minimum n-sigma for PID"};
118+
Configurable<float> cfgCleanNsigmaTpcMax{"cfgCleanNsigmaTpcMax", 1.5f, "Max TPC n-sigma for clean templates"};
119+
Configurable<float> cfgCleanNsigmaTpcMin{"cfgCleanNsigmaTpcMin", -1.5f, "Min TPC n-sigma for clean templates"};
120+
Configurable<float> cfgCleanNsigmaTofMax{"cfgCleanNsigmaTofMax", 1.5f, "Max TOF n-sigma for clean templates"};
121+
Configurable<float> cfgCleanNsigmaTofMin{"cfgCleanNsigmaTofMin", -1.5f, "Min TOF n-sigma for clean templates"};
118122
Configurable<bool> cfgGetNsigmaQA{"cfgGetNsigmaQA", true, "Get QA histograms for PID selection"};
119123
Configurable<bool> cfgGetdEdx{"cfgGetdEdx", true, "Get dEdx histograms for TPC signal"};
120124

@@ -284,14 +288,18 @@ struct LongrangecorrDerived {
284288
histos.add("hMCGen_PidPtEtaPhi", "MC Gen Target", kTH3D, {cfgAxis.axisMcPt, cfgAxis.axisMcEta, cfgAxis.axisMcPhi});
285289
histos.add("hMCRec_PidPtEtaPhi", "MC Rec Target", kTH3D, {cfgAxis.axisMcPt, cfgAxis.axisMcEta, cfgAxis.axisMcPhi});
286290
}
291+
292+
if (cfgSel.cfgGetdEdx) {
293+
histos.add("MC_TpcdEdx_ptwise", "MC True TPC dE/dx;Particle Species;p_{T} (GeV/c);TPC dE/dx", kTHnSparseD, {{3, 0.5, 3.5}, cfgAxis.axisPtQA, cfgAxis.axisTpcSignal});
294+
}
287295
}
288296

289297
myTrackFilter = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny,
290298
TrackSelection::GlobalTrackRun3DCAxyCut::Default);
291299
myTrackFilter.SetPtRange(cfgSel.cfgPtCutMin, cfgSel.cfgPtCutMax);
292300
myTrackFilter.SetEtaRange(-cfgSel.cfgEtaCut, cfgSel.cfgEtaCut);
293-
myTrackFilter.SetMinNCrossedRowsTPC(cfgSel.cfgTpcMinNCrossedRows);
294-
myTrackFilter.SetMinNClustersTPC(cfgSel.cfgTpcMinNclsFound);
301+
myTrackFilter.SetMinNCrossedRowsTPC(static_cast<int>(cfgSel.cfgTpcMinNCrossedRows));
302+
myTrackFilter.SetMinNClustersTPC(static_cast<int>(cfgSel.cfgTpcMinNclsFound));
295303
myTrackFilter.SetMaxChi2PerClusterTPC(cfgSel.cfgTpcMaxChi2PerCluster);
296304
myTrackFilter.SetMaxDcaZ(cfgSel.cfgTpcMaxDcaZ);
297305
myTrackFilter.print();
@@ -507,7 +515,7 @@ struct LongrangecorrDerived {
507515
template <CorrelationContainer::CFStep step, typename TTarget, typename TTriggers, typename TAssocs>
508516
void fillCorrHist(TTarget target, TTriggers const& triggers, TAssocs const& assocs, bool mixing, float vz, float multiplicity, float eventWeight)
509517
{
510-
int fSampleIndex = gRandom->Uniform(0, cfgSel.cfgSampleSize);
518+
int fSampleIndex = static_cast<int>(gRandom->Uniform(0, cfgSel.cfgSampleSize));
511519
for (auto const& triggerTrack : triggers) {
512520
auto trigAmpl = 1.0f;
513521
auto trkeff = 1.0f;
@@ -1142,6 +1150,22 @@ struct LongrangecorrDerived {
11421150
if (particle.isPhysicalPrimary()) {
11431151
histos.fill(HIST("hRecMCdndpt"), mcCollision.posZ(), particle.eta(), particle.pt());
11441152

1153+
if (cfgSel.cfgGetdEdx) {
1154+
int pdgIdx = 0;
1155+
auto absPdg = std::abs(particle.pdgCode());
1156+
1157+
if (absPdg == PDG_t::kPiPlus)
1158+
pdgIdx = 1; // o2-linter: disable=pdg/explicit-code (histogram species index)
1159+
else if (absPdg == PDG_t::kKPlus)
1160+
pdgIdx = 2; // o2-linter: disable=pdg/explicit-code (histogram species index)
1161+
else if (absPdg == PDG_t::kProton)
1162+
pdgIdx = 3; // o2-linter: disable=pdg/explicit-code (histogram species index)
1163+
1164+
if (pdgIdx > 0) {
1165+
histos.fill(HIST("MC_TpcdEdx_ptwise"), static_cast<double>(pdgIdx), track.pt(), track.tpcSignal());
1166+
}
1167+
}
1168+
11451169
bool isTpcPion = (track.tpcNSigmaPi() > cfgSel.cfgPidNsigmaMin && track.tpcNSigmaPi() < cfgSel.cfgPidNsigmaMax);
11461170
bool isTpcKaon = (track.tpcNSigmaKa() > cfgSel.cfgPidNsigmaMin && track.tpcNSigmaKa() < cfgSel.cfgPidNsigmaMax);
11471171
bool isTpcProton = (track.tpcNSigmaPr() > cfgSel.cfgPidNsigmaMin && track.tpcNSigmaPr() < cfgSel.cfgPidNsigmaMax);
@@ -1167,9 +1191,11 @@ struct LongrangecorrDerived {
11671191
}
11681192

11691193
if (cfgSel.cfgPidMask == KPidMaskPion || cfgSel.cfgPidMask == KPidMaskKaon || cfgSel.cfgPidMask == KPidMaskProton) {
1170-
bool isTargetRec = (cfgSel.cfgPidMask == KPidMaskPion && isPion) ||
1171-
(cfgSel.cfgPidMask == KPidMaskKaon && isKaon) ||
1172-
(cfgSel.cfgPidMask == KPidMaskProton && isProton);
1194+
1195+
auto pdgcodeRec = std::abs(particle.pdgCode());
1196+
bool isTargetRec = (cfgSel.cfgPidMask == KPidMaskPion && isPion && pdgcodeRec == PDG_t::kPiPlus) ||
1197+
(cfgSel.cfgPidMask == KPidMaskKaon && isKaon && pdgcodeRec == PDG_t::kKPlus) ||
1198+
(cfgSel.cfgPidMask == KPidMaskProton && isProton && pdgcodeRec == PDG_t::kProton);
11731199

11741200
if (isTargetRec) {
11751201
histos.fill(HIST("hMCRec_PidPtEtaPhi"), particle.pt(), particle.eta(), particle.phi());
@@ -1210,6 +1236,9 @@ struct LongrangecorrDerived {
12101236
if (!myTrackFilter.IsSelected(track))
12111237
continue;
12121238

1239+
if (!track.hasTOF())
1240+
continue;
1241+
12131242
float tpcNsig = 0.0f, tofNsig = 0.0f;
12141243
if (cfgSel.cfgPidMask & KPidMaskPion) {
12151244
tpcNsig = track.tpcNSigmaPi();
@@ -1230,30 +1259,25 @@ struct LongrangecorrDerived {
12301259
}
12311260
}
12321261

1233-
bool isTpcPion = (track.tpcNSigmaPi() > cfgSel.cfgPidNsigmaMin && track.tpcNSigmaPi() < cfgSel.cfgPidNsigmaMax);
1234-
bool isTpcKaon = (track.tpcNSigmaKa() > cfgSel.cfgPidNsigmaMin && track.tpcNSigmaKa() < cfgSel.cfgPidNsigmaMax);
1235-
bool isTpcProton = (track.tpcNSigmaPr() > cfgSel.cfgPidNsigmaMin && track.tpcNSigmaPr() < cfgSel.cfgPidNsigmaMax);
1236-
1237-
bool isTofPion = (track.tofNSigmaPi() > cfgSel.cfgPidNsigmaMin && track.tofNSigmaPi() < cfgSel.cfgPidNsigmaMax);
1238-
bool isTofKaon = (track.tofNSigmaKa() > cfgSel.cfgPidNsigmaMin && track.tofNSigmaKa() < cfgSel.cfgPidNsigmaMax);
1239-
bool isTofProton = (track.tofNSigmaPr() > cfgSel.cfgPidNsigmaMin && track.tofNSigmaPr() < cfgSel.cfgPidNsigmaMax);
1240-
1241-
bool isPion = false, isKaon = false, isProton = false;
1242-
if (track.pt() > cfgSel.cfgTofPidPtCut && track.hasTOF()) {
1243-
isPion = isTofPion && isTpcPion;
1244-
isKaon = isTofKaon && isTpcKaon;
1245-
isProton = isTofProton && isTpcProton;
1246-
} else if (!(track.pt() > cfgSel.cfgTofPidPtCut && !track.hasTOF())) {
1247-
isPion = isTpcPion;
1248-
isKaon = isTpcKaon;
1249-
isProton = isTpcProton;
1250-
}
1262+
bool isTpcPion = (track.tpcNSigmaPi() > cfgSel.cfgCleanNsigmaTpcMin && track.tpcNSigmaPi() < cfgSel.cfgCleanNsigmaTpcMax);
1263+
bool isTpcKaon = (track.tpcNSigmaKa() > cfgSel.cfgCleanNsigmaTpcMin && track.tpcNSigmaKa() < cfgSel.cfgCleanNsigmaTpcMax);
1264+
bool isTpcProton = (track.tpcNSigmaPr() > cfgSel.cfgCleanNsigmaTpcMin && track.tpcNSigmaPr() < cfgSel.cfgCleanNsigmaTpcMax);
1265+
1266+
bool isTofPion = (track.tofNSigmaPi() > cfgSel.cfgCleanNsigmaTofMin && track.tofNSigmaPi() < cfgSel.cfgCleanNsigmaTofMax);
1267+
bool isTofKaon = (track.tofNSigmaKa() > cfgSel.cfgCleanNsigmaTofMin && track.tofNSigmaKa() < cfgSel.cfgCleanNsigmaTofMax);
1268+
bool isTofProton = (track.tofNSigmaPr() > cfgSel.cfgCleanNsigmaTofMin && track.tofNSigmaPr() < cfgSel.cfgCleanNsigmaTofMax);
1269+
1270+
bool isPion = isTofPion && isTpcPion;
1271+
bool isKaon = isTofKaon && isTpcKaon;
1272+
bool isProton = isTofProton && isTpcProton;
12511273

12521274
if ((isPion && isKaon) || (isPion && isProton) || (isKaon && isProton)) {
12531275
isPion = isKaon = isProton = false;
12541276
}
12551277

1256-
bool isTargetParticle = ((cfgSel.cfgPidMask & KPidMaskPion) && isPion) || ((cfgSel.cfgPidMask & KPidMaskKaon) && isKaon) || ((cfgSel.cfgPidMask & KPidMaskProton) && isProton);
1278+
bool isTargetParticle = ((cfgSel.cfgPidMask & KPidMaskPion) && isPion) ||
1279+
((cfgSel.cfgPidMask & KPidMaskKaon) && isKaon) ||
1280+
((cfgSel.cfgPidMask & KPidMaskProton) && isProton);
12571281

12581282
// FILL AFTER CUTS
12591283
if (cfgSel.cfgGetNsigmaQA && isTargetParticle) {

0 commit comments

Comments
 (0)