Skip to content

Commit be9cb47

Browse files
committed
Add event loss histogram, add option to disbable ROF boarder cut
1 parent cd473c3 commit be9cb47

File tree

2 files changed

+73
-52
lines changed

2 files changed

+73
-52
lines changed

PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ struct decay3bodyBuilder {
121121
Configurable<int> useMatCorrType{"useMatCorrType", 0, "0: none, 1: TGeo, 2: LUT"};
122122
Configurable<bool> doTrackQA{"doTrackQA", false, "Flag to fill QA histograms for daughter tracks of (selected) decay3body candidates."};
123123
Configurable<bool> doVertexQA{"doVertexQA", false, "Flag to fill QA histograms for PV of (selected) events."};
124-
Configurable<bool> doSel8selection{"doSel8selection", true, "flag for sel8 event selection"};
125-
Configurable<bool> doPosZselection{"doPosZselection", true, "flag for posZ event selection"};
124+
Configurable<bool> disableITSROFCut{"disableITSROFCut", false, "Disable ITS ROF border cut"};
126125

127126
// data processing options
128127
Configurable<bool> doSkimmedProcessing{"doSkimmedProcessing", false, "Apply Zoroo counting in case of skimmed data input"};
@@ -433,13 +432,19 @@ struct decay3bodyBuilder {
433432

434433
// Add histograms separately for different process functions
435434
if (doprocessRealData == true || doprocessMonteCarlo == true) {
436-
auto hEventCounter = registry.add<TH1>("Counters/hEventCounter", "hEventCounter", HistType::kTH1D, {{3, 0.0f, 3.0f}});
437-
hEventCounter->GetXaxis()->SetBinLabel(1, "total");
438-
hEventCounter->GetXaxis()->SetBinLabel(2, "sel8");
439-
hEventCounter->GetXaxis()->SetBinLabel(3, "vertexZ");
435+
auto hEventCounter = registry.add<TH1>("Counters/hEventCounter", "hEventCounter", HistType::kTH1D, {{2, 0.0f, 2.0f}});
436+
hEventCounter->GetXaxis()->SetBinLabel(1, "all");
437+
hEventCounter->GetXaxis()->SetBinLabel(2, "selected");
440438
hEventCounter->LabelsOption("v");
441439
}
442440

441+
if (doprocessMonteCarlo == true) {
442+
auto hMcEventCounter = registry.add<TH1>("Counters/hMcEventCounter", "hMcEventCounter", HistType::kTH1D, {{2, 0.0f, 2.0f}});
443+
hMcEventCounter->GetXaxis()->SetBinLabel(1, "all");
444+
hMcEventCounter->GetXaxis()->SetBinLabel(2, "reconstructed");
445+
hMcEventCounter->LabelsOption("v");
446+
}
447+
443448
if (doprocessRealData == true || doprocessRealDataReduced == true || doprocessMonteCarlo == true) {
444449
if (doTrackQA) { // histograms for all daughter tracks of (selected) 3body candidates
445450
registry.add("QA/Tracks/hTrackProtonTPCNcls", "hTrackProtonTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}});
@@ -618,26 +623,31 @@ struct decay3bodyBuilder {
618623
// Loop over collisions for vertex QA
619624
for (const auto& collision : collisions) {
620625
if constexpr (soa::is_table<TBCs>) { // only do if NOT running over reduced data (already done in reducedCreator)
626+
627+
// all events
628+
registry.fill(HIST("Counters/hEventCounter"), 0.5);
629+
630+
// ITS ROF boarder cut if not disabled
631+
if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) {
632+
continue;
633+
}
634+
621635
// Zorro event counting
622636
bool isZorroSelected = false;
623637
if (doSkimmedProcessing) {
624638
isZorroSelected = zorro.isSelected(collision.template bc_as<TBCs>().globalBC());
625-
if (!isZorroSelected && onlyKeepInterestedTrigger) {
626-
continue;
639+
if (isZorroSelected) {
640+
isTriggeredCollision[collision.globalIndex()] = true;
627641
}
628642
}
629643

630-
isTriggeredCollision[collision.globalIndex()] = true;
631-
// event counting
632-
registry.fill(HIST("Counters/hEventCounter"), 0.5);
633-
if (doSel8selection && !collision.sel8()) {
644+
// event selection
645+
if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {
634646
continue;
635647
}
648+
649+
// selected events
636650
registry.fill(HIST("Counters/hEventCounter"), 1.5);
637-
if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {
638-
continue;
639-
}
640-
registry.fill(HIST("Counters/hEventCounter"), 2.5);
641651
}
642652

643653
// vertex QA and counting
@@ -656,7 +666,7 @@ struct decay3bodyBuilder {
656666

657667
// In case of MC: reco collision survived event selection filter --> fill value for MC collision if collision is "true" MC collision
658668
if constexpr (soa::is_table<TMCParticles>) {
659-
if (collision.mcCollisionId() >= 0) {
669+
if (collision.has_mcCollision()) {
660670
isGoodCollision[collision.mcCollisionId()] = true;
661671
}
662672
}
@@ -680,26 +690,27 @@ struct decay3bodyBuilder {
680690
// aquire collision
681691
auto const& collision = collisions.rawIteratorAt(decay3body.collisionId());
682692

683-
// initialise CCDB from run number saved in reduced collisions table when running over reduced data
684-
if constexpr (!soa::is_table<TBCs>) { // only do if running over reduced data (otherwise CCDB is initialised in process function)
685-
if (collision.runNumber() != lastRunNumber) {
686-
initFittersWithMagField(collision.runNumber(), getMagFieldFromRunNumber(collision.runNumber()));
687-
lastRunNumber = collision.runNumber(); // Update the last run number
688-
LOG(debug) << "CCDB initialized for run " << lastRunNumber;
689-
}
690-
}
691-
692693
// event selection
693694
if constexpr (soa::is_table<TBCs>) { // only when NOT running over reduced data
694-
if (doSel8selection && !collision.sel8()) {
695+
if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) { // ITS ROF boarder cut if not disabled
696+
continue;
697+
}
698+
if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {
695699
continue;
696700
}
697-
if (onlyKeepInterestedTrigger && !isTriggeredCollision[collision.globalIndex()]) {
701+
// Zorro
702+
if (doSkimmedProcessing && onlyKeepInterestedTrigger && !isTriggeredCollision[collision.globalIndex()]) {
698703
continue;
699704
}
700705
}
701-
if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {
702-
continue;
706+
707+
// initialise CCDB from run number saved in reduced collisions table when running over reduced data
708+
if constexpr (!soa::is_table<TBCs>) { // only do if running over reduced data (otherwise CCDB is initialised in process function)
709+
if (collision.runNumber() != lastRunNumber) {
710+
initFittersWithMagField(collision.runNumber(), getMagFieldFromRunNumber(collision.runNumber()));
711+
lastRunNumber = collision.runNumber(); // Update the last run number
712+
LOG(debug) << "CCDB initialized for run " << lastRunNumber;
713+
}
703714
}
704715

705716
// aquire tracks
@@ -775,7 +786,7 @@ struct decay3bodyBuilder {
775786
this3BodyMCInfo.isReco = true;
776787

777788
// set flag if selected reco collision has matched gen collision
778-
if (collision.mcCollisionId() >= 0) { // reco collision is matched to gen collision
789+
if (collision.has_mcCollision()) { // reco collision is matched to gen collision
779790
this3BodyMCInfo.survivedEventSel = isGoodCollision[collision.mcCollisionId()];
780791
} else {
781792
this3BodyMCInfo.survivedEventSel = false; // false if reco collision not matched to gen collision
@@ -1327,6 +1338,14 @@ struct decay3bodyBuilder {
13271338
fTrackedClSizeVector[tvtx3body.decay3BodyId()] = tvtx3body.itsClsSize();
13281339
}
13291340

1341+
// MC collision counting for event loss
1342+
registry.fill(HIST("Counters/hMcEventCounter"), 0.5, mcCollisions.size());
1343+
for (const auto& collision : collisions) {
1344+
if (collision.has_mcCollision()) {
1345+
registry.fill(HIST("Counters/hMcEventCounter"), 1.5);
1346+
}
1347+
}
1348+
13301349
// do candidate analysis with MC processing
13311350
buildCandidates<TracksExtPIDIUwithEvTimesLabeled>(bcs, // bc table
13321351
collisions, // collision table

PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ struct reduced3bodyCreator {
9191
o2::vertexing::DCAFitterN<3> fitter3body;
9292
o2::aod::pidtofgeneric::TofPidNewCollision<TrackExtPIDIUwithEvTimes::iterator> bachelorTOFPID;
9393

94-
Configurable<bool> doSel8selection{"doSel8selection", true, "flag for sel8 event selection"};
95-
Configurable<bool> doPosZselection{"doPosZselection", true, "flag for posZ event selection"};
94+
Configurable<bool> disableITSROFCut{"disableITSROFCut", false, "Disable ITS ROF border cut"};
9695
// CCDB options
9796
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
9897
Configurable<std::string> grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"};
@@ -152,11 +151,10 @@ struct reduced3bodyCreator {
152151

153152
registry.add("hAllSelEventsVtxZ", "hAllSelEventsVtxZ", HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}});
154153

155-
auto hEventCounter = registry.add<TH1>("hEventCounter", "hEventCounter", HistType::kTH1D, {{4, 0.0f, 4.0f}});
156-
hEventCounter->GetXaxis()->SetBinLabel(1, "total");
157-
hEventCounter->GetXaxis()->SetBinLabel(2, "sel8");
158-
hEventCounter->GetXaxis()->SetBinLabel(3, "vertexZ");
159-
hEventCounter->GetXaxis()->SetBinLabel(4, "reduced");
154+
auto hEventCounter = registry.add<TH1>("hEventCounter", "hEventCounter", HistType::kTH1D, {{3, 0.0f, 3.0f}});
155+
hEventCounter->GetXaxis()->SetBinLabel(1, "all");
156+
hEventCounter->GetXaxis()->SetBinLabel(2, "selected");
157+
hEventCounter->GetXaxis()->SetBinLabel(3, "reduced");
160158
hEventCounter->LabelsOption("v");
161159

162160
auto hEventCounterZorro = registry.add<TH1>("hEventCounterZorro", "hEventCounterZorro", HistType::kTH1D, {{2, 0, 2}});
@@ -259,6 +257,14 @@ struct reduced3bodyCreator {
259257
lastRunNumber = bc.runNumber(); // Update the last run number
260258
}
261259

260+
// all events
261+
registry.fill(HIST("hEventCounter"), 0.5);
262+
263+
// ITS ROF boarder cut if not disabled
264+
if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) {
265+
continue;
266+
}
267+
262268
// Zorro event counting
263269
bool isZorroSelected = false;
264270
if (cfgSkimmedProcessing) {
@@ -269,16 +275,13 @@ struct reduced3bodyCreator {
269275
}
270276
}
271277

272-
// Event selection
273-
registry.fill(HIST("hEventCounter"), 0.5);
274-
if (doSel8selection && !collision.sel8()) {
278+
// event selection
279+
if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {
275280
continue;
276281
}
282+
283+
// selected events
277284
registry.fill(HIST("hEventCounter"), 1.5);
278-
if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { // 10cm
279-
continue;
280-
}
281-
registry.fill(HIST("hEventCounter"), 2.5);
282285
registry.fill(HIST("hAllSelEventsVtxZ"), collision.posZ());
283286

284287
if (cfgSkimmedProcessing && isZorroSelected) {
@@ -300,19 +303,18 @@ struct reduced3bodyCreator {
300303

301304
auto collision = d3body.template collision_as<ColwithEvTimesMultsCents>();
302305

303-
if (doSel8selection && !collision.sel8()) {
306+
// event selection
307+
if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) { // ITS ROF boarder cut if not disabled
304308
continue;
305309
}
306-
if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { // 10cm
310+
if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) {
307311
continue;
308312
}
309313

310314
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
311315
initCCDB(bc);
312-
if (cfgSkimmedProcessing && cfgOnlyKeepInterestedTrigger) {
313-
if (isTriggeredCollision[collision.globalIndex()] == false) {
314-
continue;
315-
}
316+
if (cfgSkimmedProcessing && cfgOnlyKeepInterestedTrigger && !isTriggeredCollision[collision.globalIndex()]) {
317+
continue;
316318
}
317319

318320
// Save the collision
@@ -411,7 +413,7 @@ struct reduced3bodyCreator {
411413
reduced3BodyInfo(radius, phi, posZ, rVtx, phiVtx, zVtx, fTrackedClSizeVector[d3body.globalIndex()]);
412414
} // end decay3body loop
413415

414-
registry.fill(HIST("hEventCounter"), 3.5, reducedCollisions.lastIndex() + 1);
416+
registry.fill(HIST("hEventCounter"), 2.5, reducedCollisions.lastIndex() + 1);
415417
}
416418
};
417419

0 commit comments

Comments
 (0)