Skip to content

Commit d159b8a

Browse files
[PWGLF] Add option to apply evt sel in efficiency denominator + remove deprecated event selection (#9590)
1 parent 38f7831 commit d159b8a

File tree

1 file changed

+45
-23
lines changed

1 file changed

+45
-23
lines changed

PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ struct derivedlambdakzeroanalysis {
102102

103103
Configurable<float> maxZVtxPosition{"maxZVtxPosition", 10., "max Z vtx position"};
104104

105+
Configurable<bool> useEvtSelInDenomEff{"useEvtSelInDenomEff", false, "Consider event selections in the recoed <-> gen collision association for the denominator (or numerator) of the acc. x eff. (or signal loss)?"};
106+
Configurable<bool> applyZVtxSelOnMCPV{"applyZVtxSelOnMCPV", false, "Apply Z-vtx cut on the PV of the generated collision?"};
105107
Configurable<bool> useFT0CbasedOccupancy{"useFT0CbasedOccupancy", false, "Use sum of FT0-C amplitudes for estimating occupancy? (if not, use track-based definition)"};
106108
// fast check on occupancy
107109
Configurable<float> minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"};
@@ -414,29 +416,28 @@ struct derivedlambdakzeroanalysis {
414416
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(12, "kNoCollInTimeRangeStd");
415417
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(13, "kNoCollInTimeRangeStrict");
416418
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(14, "kNoCollInTimeRangeNarrow");
417-
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "kNoCollInTimeRangeVzDep");
418-
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(16, "kNoCollInRofStd");
419-
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "kNoCollInRofStrict");
419+
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "kNoCollInRofStd");
420+
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(16, "kNoCollInRofStrict");
420421
if (doPPAnalysis) {
421-
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "INEL>0");
422-
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(19, "INEL>1");
422+
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "INEL>0");
423+
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "INEL>1");
423424
} else {
424-
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "Below min occup.");
425-
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(19, "Above max occup.");
425+
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(17, "Below min occup.");
426+
histos.get<TH1>(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(18, "Above max occup.");
426427
}
427428

428429
histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{101, 0.0f, 101.0f}});
429-
histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2F, {axisCentrality, axisNch});
430+
histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2F, {{101, 0.0f, 101.0f}, axisNch});
430431

431432
histos.add("hEventPVz", "hEventPVz", kTH1F, {{100, -20.0f, +20.0f}});
432-
histos.add("hCentralityVsPVz", "hCentralityVsPVz", kTH2F, {axisCentrality, {100, -20.0f, +20.0f}});
433+
histos.add("hCentralityVsPVz", "hCentralityVsPVz", kTH2F, {{101, 0.0f, 101.0f}, {100, -20.0f, +20.0f}});
433434
if (doprocessGenerated) {
434435
histos.add("hEventPVzMC", "hEventPVzMC", kTH1F, {{100, -20.0f, +20.0f}});
435-
histos.add("hCentralityVsPVzMC", "hCentralityVsPVzMC", kTH2F, {axisCentrality, {100, -20.0f, +20.0f}});
436+
histos.add("hCentralityVsPVzMC", "hCentralityVsPVzMC", kTH2F, {{101, 0.0f, 101.0f}, {100, -20.0f, +20.0f}});
436437
}
437438

438439
histos.add("hEventOccupancy", "hEventOccupancy", kTH1F, {axisOccupancy});
439-
histos.add("hCentralityVsOccupancy", "hCentralityVsOccupancy", kTH2F, {axisCentrality, axisOccupancy});
440+
histos.add("hCentralityVsOccupancy", "hCentralityVsOccupancy", kTH2F, {{101, 0.0f, 101.0f}, axisOccupancy});
440441

441442
histos.add("hGapSide", "Gap side; Entries", kTH1F, {{5, -0.5, 4.5}});
442443
histos.add("hSelGapSide", "Selected gap side; Entries", kTH1F, {axisSelGap});
@@ -1534,50 +1535,44 @@ struct derivedlambdakzeroanalysis {
15341535
if (fillHists)
15351536
histos.fill(HIST("hEventSelection"), 13 /* No other collision within +/- 2 microseconds */);
15361537

1537-
if (eventSelections.requireNoCollInTimeRangeVzDep && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeVzDependent)) {
1538-
return false;
1539-
}
1540-
if (fillHists)
1541-
histos.fill(HIST("hEventSelection"), 14 /* No other collision with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ */);
1542-
15431538
if (eventSelections.requireNoCollInROFStd && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) {
15441539
return false;
15451540
}
15461541
if (fillHists)
1547-
histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF with mult. above a certain threshold */);
1542+
histos.fill(HIST("hEventSelection"), 14 /* No other collision within the same ITS ROF with mult. above a certain threshold */);
15481543

15491544
if (eventSelections.requireNoCollInROFStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) {
15501545
return false;
15511546
}
15521547
if (fillHists)
1553-
histos.fill(HIST("hEventSelection"), 16 /* No other collision within the same ITS ROF */);
1548+
histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF */);
15541549

15551550
if (doPPAnalysis) { // we are in pp
15561551
if (eventSelections.requireINEL0 && collision.multNTracksPVeta1() < 1) {
15571552
return false;
15581553
}
15591554
if (fillHists)
1560-
histos.fill(HIST("hEventSelection"), 17 /* INEL > 0 */);
1555+
histos.fill(HIST("hEventSelection"), 16 /* INEL > 0 */);
15611556

15621557
if (eventSelections.requireINEL1 && collision.multNTracksPVeta1() < 2) {
15631558
return false;
15641559
}
15651560
if (fillHists)
1566-
histos.fill(HIST("hEventSelection"), 18 /* INEL > 1 */);
1561+
histos.fill(HIST("hEventSelection"), 17 /* INEL > 1 */);
15671562

15681563
} else { // we are in Pb-Pb
15691564
float collisionOccupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange();
15701565
if (eventSelections.minOccupancy >= 0 && collisionOccupancy < eventSelections.minOccupancy) {
15711566
return false;
15721567
}
15731568
if (fillHists)
1574-
histos.fill(HIST("hEventSelection"), 17 /* Below min occupancy */);
1569+
histos.fill(HIST("hEventSelection"), 16 /* Below min occupancy */);
15751570

15761571
if (eventSelections.maxOccupancy >= 0 && collisionOccupancy > eventSelections.maxOccupancy) {
15771572
return false;
15781573
}
15791574
if (fillHists)
1580-
histos.fill(HIST("hEventSelection"), 18 /* Above max occupancy */);
1575+
histos.fill(HIST("hEventSelection"), 17 /* Above max occupancy */);
15811576
}
15821577

15831578
return true;
@@ -1596,6 +1591,13 @@ struct derivedlambdakzeroanalysis {
15961591
int biggestNContribs = -1;
15971592
int bestCollisionIndex = -1;
15981593
for (auto const& collision : groupedCollisions) {
1594+
// consider event selections in the recoed <-> gen collision association, for the denominator (or numerator) of the efficiency (or signal loss)?
1595+
if (eventSelections.useEvtSelInDenomEff) {
1596+
if (!IsEventAccepted(collision, false)) {
1597+
continue;
1598+
}
1599+
}
1600+
15991601
if (biggestNContribs < collision.multPVTotalContributors()) {
16001602
biggestNContribs = collision.multPVTotalContributors();
16011603
bestCollisionIndex = collision.globalIndex();
@@ -1613,6 +1615,20 @@ struct derivedlambdakzeroanalysis {
16131615
{
16141616
std::vector<int> listBestCollisionIdx(mcCollisions.size());
16151617
for (auto const& mcCollision : mcCollisions) {
1618+
// Apply selections on MC collisions
1619+
if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) {
1620+
continue;
1621+
}
1622+
if (doPPAnalysis) { // we are in pp
1623+
if (eventSelections.requireINEL0 && mcCollision.multMCNParticlesEta10() < 1) {
1624+
continue;
1625+
}
1626+
1627+
if (eventSelections.requireINEL1 && mcCollision.multMCNParticlesEta10() < 2) {
1628+
continue;
1629+
}
1630+
}
1631+
16161632
histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 0 /* all gen. events*/);
16171633

16181634
auto groupedCollisions = collisions.sliceBy(perMcCollision, mcCollision.globalIndex());
@@ -1869,6 +1885,9 @@ struct derivedlambdakzeroanalysis {
18691885
continue;
18701886

18711887
auto mcCollision = v0MC.straMCCollision_as<soa::Join<aod::StraMCCollisions, aod::StraMCCollMults>>();
1888+
if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) {
1889+
continue;
1890+
}
18721891
if (doPPAnalysis) { // we are in pp
18731892
if (eventSelections.requireINEL0 && mcCollision.multMCNParticlesEta10() < 1) {
18741893
continue;
@@ -1935,6 +1954,9 @@ struct derivedlambdakzeroanalysis {
19351954
continue;
19361955

19371956
auto mcCollision = cascMC.straMCCollision_as<soa::Join<aod::StraMCCollisions, aod::StraMCCollMults>>();
1957+
if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) {
1958+
continue;
1959+
}
19381960
if (doPPAnalysis) { // we are in pp
19391961
if (eventSelections.requireINEL0 && mcCollision.multMCNParticlesEta10() < 1) {
19401962
continue;

0 commit comments

Comments
 (0)