Skip to content

Commit 8056b79

Browse files
JimunLeejimun_lee
andauthored
[PWGLF] Added the TOF switch of KstarInOO.cxx (#13695)
Co-authored-by: jimun_lee <jimun.lee@cern.ch>
1 parent 87cc8e3 commit 8056b79

File tree

1 file changed

+91
-59
lines changed

1 file changed

+91
-59
lines changed

PWGLF/Tasks/Resonances/kstarInOO.cxx

Lines changed: 91 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ struct kstarInOO {
6767

6868
// Event Selection
6969
Configurable<float> cfgEventVtxCut{"cfgEventVtxCut", 10.0, "V_z cut selection"};
70-
ConfigurableAxis cfgCentAxis{"cfgCentAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"};
70+
ConfigurableAxis cfgCentAxis{"cfgCentAxis", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the centrality axis"};
71+
Configurable<bool> cfgOccupancySel{"cfgOccupancySel", false, "Occupancy selection"};
72+
Configurable<int> cfgOccupancyMax{"cfgOccupancyMax", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"};
73+
Configurable<int> cfgOccupancyMin{"cfgOccupancyMin", -100, "minimum occupancy of tracks in neighbouring collisions in a given time range"};
7174

7275
// Track Selection
7376
// General
@@ -91,6 +94,11 @@ struct kstarInOO {
9194
// PID
9295
Configurable<bool> cfgTrackTPCPID{"cfgTrackTPCPID", true, "Enables TPC PID"};
9396
Configurable<bool> cfgTrackTOFPID{"cfgTrackTOFPID", true, "Enables TOF PID"};
97+
Configurable<bool> cfgTrackSquarePIDCut{"cfgTrackSqurePIDCut", true, "Enables PID cut shape square switch"};
98+
Configurable<bool> cfgTrackCirclePIDCut{"cfgTrackCirclePIDCut", true, "Enables PID cut shape circle switch"};
99+
Configurable<int> cfgTrackCircleValue{"cfgTrackCircleValue", 2, "Enables TOF TPC PID circle cut value"};
100+
Configurable<bool> cfgTrackTOFHard{"cfgTrackTOFHard", false, "Enables TOF Hard"};
101+
94102
Configurable<float> cfgTrackTPCPIDnSig{"cfgTrackTPCPIDnSig", 4.0, "nTPC PID sigma"};
95103
Configurable<float> cfgTrackTOFPIDnSig{"cfgTrackTOFPIDnSig", 4.0, "nTOF PID sigma"};
96104
Configurable<int> cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"};
@@ -99,6 +107,7 @@ struct kstarInOO {
99107
ConfigurableAxis cfgBinsMixMult{"cfgBinsCent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"};
100108
ConfigurableAxis cfgBinsMixVtx{"cfgBinsMixVtx", {VARIABLE_WIDTH, -10.0f, -5.f, 0.f, 5.f, 10.f}, "Mixing bins - z-vertex"};
101109
Configurable<int> cfgMixNMixedEvents{"cfgMixNMixedEvents", 10, "Number of mixed events per event"};
110+
Configurable<int> cfgVtxMixCut{"cfgVtxMixCut", 10, "Vertex Mix Cut"};
102111

103112
// MCGen
104113
Configurable<bool> cfgForceGenReco{"cfgForceGenReco", false, "Only consider events which are reconstructed (neglect event-loss)"};
@@ -182,14 +191,8 @@ struct kstarInOO {
182191
}
183192

184193
if (cfgMcHistos) {
185-
histos.add("hPion_PID_Purity", "hPion_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
186-
histos.add("hKaon_PID_Purity", "hKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
187-
histos.add("hSimplePion_PID_Purity", "hSimplePion_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
188-
histos.add("hSimpleKaon_PID_Purity", "hSimpleKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
189-
190194
histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}});
191195
histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}});
192-
193196
histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis});
194197

195198
histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
@@ -249,6 +252,10 @@ struct kstarInOO {
249252
return false;
250253
if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))
251254
return false;
255+
if (!event.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll))
256+
return false;
257+
if (cfgOccupancySel && (event.trackOccupancyInTimeRange() > cfgOccupancyMax || event.trackOccupancyInTimeRange() < cfgOccupancyMin))
258+
return false;
252259

253260
if (cfgEventCutQA) {
254261
histos.fill(HIST("hPosZ_AC"), event.posZ());
@@ -323,19 +330,42 @@ struct kstarInOO {
323330
histos.fill(HIST("QA_nSigma_kaon_TOF_BC"), candidate.pt(), candidate.tofNSigmaKa());
324331
histos.fill(HIST("QA_kaon_TPC_TOF_BC"), candidate.tpcNSigmaKa(), candidate.tofNSigmaKa());
325332
}
326-
333+
double tpcpid = 0;
334+
double tofpid = 0;
327335
bool tpcPIDPassed{false}, tofPIDPassed{false};
328336
// TPC
329-
if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig)
330-
tpcPIDPassed = true;
331-
// TOF
332-
if (candidate.hasTOF()) {
333-
if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) {
337+
if (cfgTrackSquarePIDCut) {
338+
if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig)
339+
tpcPIDPassed = true;
340+
if (candidate.hasTOF()) {
341+
if (std::abs(candidate.tofNSigmaKa()) < cfgTrackTOFPIDnSig) {
342+
tofPIDPassed = true;
343+
}
344+
} else {
345+
if (!cfgTrackTOFHard) {
346+
tofPIDPassed = true;
347+
} else {
348+
tofPIDPassed = false;
349+
}
350+
}
351+
} // end of square cut
352+
if (cfgTrackCirclePIDCut) {
353+
if (std::abs(candidate.tpcNSigmaKa()) < cfgTrackTPCPIDnSig)
354+
tpcpid = std::abs(candidate.tpcNSigmaKa());
355+
tofpid = 0;
356+
357+
if (candidate.hasTOF()) {
358+
tofpid = std::abs(candidate.tofNSigmaKa());
359+
} else {
360+
if (cfgTrackTOFHard) {
361+
tofpid = 999;
362+
}
363+
}
364+
if (std::sqrt(tpcpid * tpcpid + tofpid * tofpid) < cfgTrackCircleValue) {
365+
tpcPIDPassed = true;
334366
tofPIDPassed = true;
335367
}
336-
} else {
337-
tofPIDPassed = true;
338-
}
368+
} // circular cut
339369
// TPC & TOF
340370
if (tpcPIDPassed && tofPIDPassed) {
341371
if (cfgTrackCutQA && QA) {
@@ -356,18 +386,44 @@ struct kstarInOO {
356386
histos.fill(HIST("QA_nSigma_pion_TOF_BC"), candidate.pt(), candidate.tofNSigmaPi());
357387
histos.fill(HIST("QA_pion_TPC_TOF_BC"), candidate.tpcNSigmaPi(), candidate.tofNSigmaPi());
358388
}
389+
double tpcpid = 0;
390+
double tofpid = 0;
359391
bool tpcPIDPassed{false}, tofPIDPassed{false};
360392
// TPC
361-
if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig)
362-
tpcPIDPassed = true;
363-
if (candidate.hasTOF()) {
364-
if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) {
393+
if (cfgTrackSquarePIDCut) {
394+
if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig)
395+
tpcPIDPassed = true;
396+
if (candidate.hasTOF()) {
397+
if (std::abs(candidate.tofNSigmaPi()) < cfgTrackTOFPIDnSig) {
398+
tofPIDPassed = true;
399+
}
400+
} else {
401+
if (!cfgTrackTOFHard) {
402+
tofPIDPassed = true;
403+
} else {
404+
tofPIDPassed = false;
405+
}
406+
}
407+
} // end of square cut
408+
if (cfgTrackCirclePIDCut) {
409+
if (std::abs(candidate.tpcNSigmaPi()) < cfgTrackTPCPIDnSig)
410+
tpcpid = std::abs(candidate.tpcNSigmaPi());
411+
tofpid = 0;
412+
413+
if (candidate.hasTOF()) {
414+
tofpid = std::abs(candidate.tofNSigmaPi());
415+
} else {
416+
if (cfgTrackTOFHard) {
417+
tofpid = 999;
418+
}
419+
}
420+
if (std::sqrt(tpcpid * tpcpid + tofpid * tofpid) < cfgTrackCircleValue) {
421+
tpcPIDPassed = true;
365422
tofPIDPassed = true;
366423
}
367-
} else {
368-
tofPIDPassed = true;
369-
}
370-
// TPC & TOF
424+
} // circular cut
425+
426+
// TPC & TOF
371427
if (tpcPIDPassed && tofPIDPassed) {
372428
if (cfgTrackCutQA && QA) {
373429
histos.fill(HIST("QA_nSigma_pion_TPC_AC"), candidate.pt(), candidate.tpcNSigmaPi());
@@ -422,8 +478,6 @@ struct kstarInOO {
422478
auto centrality = collision1.centFT0C();
423479

424480
std::vector<int> mcMemory;
425-
std::vector<int> PIDPurityKey_Kaon;
426-
std::vector<int> PIDPurityKey_Pion;
427481

428482
for (const auto& [trk1, trk2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) {
429483
if (!trk1.has_mcParticle() || !trk2.has_mcParticle())
@@ -545,9 +599,6 @@ struct kstarInOO {
545599
if (!trackPIDKaon(trk1, QA) || !trackPIDPion(trk2, QA))
546600
return {-1.0, -1.0};
547601

548-
// if (trk1.index() >= trk2.index())
549-
// return {-1.0, -1.0};
550-
// I checked that index and globalIndex was same function
551602
if (trk1.globalIndex() >= trk2.globalIndex())
552603
return {-1.0, -1.0};
553604

@@ -627,9 +678,20 @@ struct kstarInOO {
627678
}
628679
auto goodEv1 = eventSelection(collision1);
629680
auto goodEv2 = eventSelection(collision2);
681+
bool VtxMixFlag = false;
682+
bool CentMixFlag = false;
683+
// bool OccupanacyMixFlag = false;
684+
if (std::fabs(collision1.posZ() - collision2.posZ()) <= cfgVtxMixCut) // set default to maybe 10
685+
VtxMixFlag = true;
686+
if (std::fabs(collision1.centFT0C() - collision2.centFT0C()) <= cfgVtxMixCut) // set default to maybe 10
687+
CentMixFlag = true;
630688

631689
if (!goodEv1 || !goodEv2)
632690
continue;
691+
if (!CentMixFlag)
692+
continue;
693+
if (!VtxMixFlag)
694+
continue;
633695

634696
TrackSlicing(collision1, tracks1, collision2, tracks2, true, false);
635697
}
@@ -670,36 +732,6 @@ struct kstarInOO {
670732
if (!INELgt0)
671733
return;
672734

673-
auto tracks1 = kaonMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
674-
for (const auto& kaon : tracks1) {
675-
if (!trackSelection(kaon, false))
676-
continue;
677-
if (!trackPIDKaon(kaon, false))
678-
continue;
679-
auto particle1 = kaon.mcParticle();
680-
if (std::fabs(particle1.pdgCode()) == 321)
681-
histos.fill(HIST("hSimpleKaon_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
682-
else if (std::fabs(particle1.pdgCode()) == 211)
683-
histos.fill(HIST("hSimpleKaon_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
684-
else
685-
histos.fill(HIST("hSimpleKaon_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1
686-
}
687-
688-
auto tracks2 = pionMC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
689-
for (const auto& pion : tracks2) {
690-
if (!trackSelection(pion, false))
691-
continue;
692-
if (!trackPIDPion(pion, false))
693-
continue;
694-
auto particle2 = pion.mcParticle();
695-
if (std::fabs(particle2.pdgCode()) == 211)
696-
histos.fill(HIST("hSimplePion_PID_Purity"), 1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
697-
else if (std::fabs(particle2.pdgCode()) == 321)
698-
histos.fill(HIST("hSimplePion_PID_Purity"), -1); // histogram with two bins, -1.5, 1.5 fill 1 or -1
699-
else
700-
histos.fill(HIST("hSimplePion_PID_Purity"), 0); // histogram with two bins, -1.5, 1.5 fill 1 or -1
701-
}
702-
703735
if (cfgMcHistos) {
704736
histos.fill(HIST("nEvents_MC"), 1.5);
705737
}

0 commit comments

Comments
 (0)