Skip to content

Commit 61c672a

Browse files
author
jimun_lee
committed
[PWGLF] Added the TOF switch of KstarInOO.cxx
1 parent 8b1ca97 commit 61c672a

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
@@ -66,7 +66,10 @@ struct kstarInOO {
6666

6767
// Event Selection
6868
Configurable<float> cfgEventVtxCut{"cfgEventVtxCut", 10.0, "V_z cut selection"};
69-
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"};
69+
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"};
70+
Configurable<bool> cfgOccupancySel{"cfgOccupancySel", false, "Occupancy selection"};
71+
Configurable<int> cfgOccupancyMax{"cfgOccupancyMax", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range"};
72+
Configurable<int> cfgOccupancyMin{"cfgOccupancyMin", -100, "minimum occupancy of tracks in neighbouring collisions in a given time range"};
7073

7174
// Track Selection
7275
// General
@@ -90,6 +93,11 @@ struct kstarInOO {
9093
// PID
9194
Configurable<bool> cfgTrackTPCPID{"cfgTrackTPCPID", true, "Enables TPC PID"};
9295
Configurable<bool> cfgTrackTOFPID{"cfgTrackTOFPID", true, "Enables TOF PID"};
96+
Configurable<bool> cfgTrackSquarePIDCut{"cfgTrackSqurePIDCut", true, "Enables PID cut shape square switch"};
97+
Configurable<bool> cfgTrackCirclePIDCut{"cfgTrackCirclePIDCut", true, "Enables PID cut shape circle switch"};
98+
Configurable<int> cfgTrackCircleValue{"cfgTrackCircleValue", 2, "Enables TOF TPC PID circle cut value"};
99+
Configurable<bool> cfgTrackTOFHard{"cfgTrackTOFHard", false, "Enables TOF Hard"};
100+
93101
Configurable<float> cfgTrackTPCPIDnSig{"cfgTrackTPCPIDnSig", 4.0, "nTPC PID sigma"};
94102
Configurable<float> cfgTrackTOFPIDnSig{"cfgTrackTOFPIDnSig", 4.0, "nTOF PID sigma"};
95103
Configurable<int> cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"};
@@ -98,6 +106,7 @@ struct kstarInOO {
98106
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"};
99107
ConfigurableAxis cfgBinsMixVtx{"cfgBinsMixVtx", {VARIABLE_WIDTH, -10.0f, -5.f, 0.f, 5.f, 10.f}, "Mixing bins - z-vertex"};
100108
Configurable<int> cfgMixNMixedEvents{"cfgMixNMixedEvents", 10, "Number of mixed events per event"};
109+
Configurable<int> cfgVtxMixCut{"cfgVtxMixCut", 10, "Vertex Mix Cut"};
101110

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

183192
if (cfgMcHistos) {
184-
histos.add("hPion_PID_Purity", "hPion_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
185-
histos.add("hKaon_PID_Purity", "hKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
186-
histos.add("hSimplePion_PID_Purity", "hSimplePion_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
187-
histos.add("hSimpleKaon_PID_Purity", "hSimpleKaon_PID_Purity", kTH1F, {{3, -1.5, 1.5}});
188-
189193
histos.add("nEvents_MC", "nEvents_MC", kTH1F, {{4, 0.0, 4.0}});
190194
histos.add("nEvents_MC_True", "nEvents_MC_True", kTH1F, {{4, 0.0, 4.0}});
191-
192195
histos.add("hMC_kstar_True", "hMC_kstar_True", kTHnSparseF, {cfgCentAxis, ptAxis});
193196

194197
histos.add("hMC_USS_True", "hMC_USS_True", kTHnSparseF, {cfgCentAxis, ptAxis, minvAxis});
@@ -248,6 +251,10 @@ struct kstarInOO {
248251
return false;
249252
if (!event.selection_bit(aod::evsel::kNoCollInTimeRangeStandard))
250253
return false;
254+
if (!event.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll))
255+
return false;
256+
if (cfgOccupancySel && (event.trackOccupancyInTimeRange() > cfgOccupancyMax || event.trackOccupancyInTimeRange() < cfgOccupancyMin))
257+
return false;
251258

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

423479
std::vector<int> mcMemory;
424-
std::vector<int> PIDPurityKey_Kaon;
425-
std::vector<int> PIDPurityKey_Pion;
426480

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

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

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

630688
if (!goodEv1 || !goodEv2)
631689
continue;
690+
if (!CentMixFlag)
691+
continue;
692+
if (!VtxMixFlag)
693+
continue;
632694

633695
TrackSlicing(collision1, tracks1, collision2, tracks2, true, false);
634696
}
@@ -669,36 +731,6 @@ struct kstarInOO {
669731
if (!INELgt0)
670732
return;
671733

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

0 commit comments

Comments
 (0)