diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index 812e288f71a..024ad6fb6f7 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -121,8 +121,7 @@ struct decay3bodyBuilder { Configurable useMatCorrType{"useMatCorrType", 0, "0: none, 1: TGeo, 2: LUT"}; Configurable doTrackQA{"doTrackQA", false, "Flag to fill QA histograms for daughter tracks of (selected) decay3body candidates."}; Configurable doVertexQA{"doVertexQA", false, "Flag to fill QA histograms for PV of (selected) events."}; - Configurable doSel8selection{"doSel8selection", true, "flag for sel8 event selection"}; - Configurable doPosZselection{"doPosZselection", true, "flag for posZ event selection"}; + Configurable disableITSROFCut{"disableITSROFCut", false, "Disable ITS ROF border cut"}; // data processing options Configurable doSkimmedProcessing{"doSkimmedProcessing", false, "Apply Zoroo counting in case of skimmed data input"}; @@ -433,13 +432,19 @@ struct decay3bodyBuilder { // Add histograms separately for different process functions if (doprocessRealData == true || doprocessMonteCarlo == true) { - auto hEventCounter = registry.add("Counters/hEventCounter", "hEventCounter", HistType::kTH1D, {{3, 0.0f, 3.0f}}); - hEventCounter->GetXaxis()->SetBinLabel(1, "total"); - hEventCounter->GetXaxis()->SetBinLabel(2, "sel8"); - hEventCounter->GetXaxis()->SetBinLabel(3, "vertexZ"); + auto hEventCounter = registry.add("Counters/hEventCounter", "hEventCounter", HistType::kTH1D, {{2, 0.0f, 2.0f}}); + hEventCounter->GetXaxis()->SetBinLabel(1, "all"); + hEventCounter->GetXaxis()->SetBinLabel(2, "selected"); hEventCounter->LabelsOption("v"); } + if (doprocessMonteCarlo == true) { + auto hMcEventCounter = registry.add("Counters/hMcEventCounter", "hMcEventCounter", HistType::kTH1D, {{2, 0.0f, 2.0f}}); + hMcEventCounter->GetXaxis()->SetBinLabel(1, "all"); + hMcEventCounter->GetXaxis()->SetBinLabel(2, "reconstructed"); + hMcEventCounter->LabelsOption("v"); + } + if (doprocessRealData == true || doprocessRealDataReduced == true || doprocessMonteCarlo == true) { if (doTrackQA) { // histograms for all daughter tracks of (selected) 3body candidates registry.add("QA/Tracks/hTrackProtonTPCNcls", "hTrackProtonTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); @@ -618,26 +623,31 @@ struct decay3bodyBuilder { // Loop over collisions for vertex QA for (const auto& collision : collisions) { if constexpr (soa::is_table) { // only do if NOT running over reduced data (already done in reducedCreator) + + // all events + registry.fill(HIST("Counters/hEventCounter"), 0.5); + + // ITS ROF boarder cut if not disabled + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) { + continue; + } + // Zorro event counting bool isZorroSelected = false; if (doSkimmedProcessing) { isZorroSelected = zorro.isSelected(collision.template bc_as().globalBC()); - if (!isZorroSelected && onlyKeepInterestedTrigger) { - continue; + if (isZorroSelected) { + isTriggeredCollision[collision.globalIndex()] = true; } } - isTriggeredCollision[collision.globalIndex()] = true; - // event counting - registry.fill(HIST("Counters/hEventCounter"), 0.5); - if (doSel8selection && !collision.sel8()) { + // event selection + if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { continue; } + + // selected events registry.fill(HIST("Counters/hEventCounter"), 1.5); - if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { - continue; - } - registry.fill(HIST("Counters/hEventCounter"), 2.5); } // vertex QA and counting @@ -656,7 +666,7 @@ struct decay3bodyBuilder { // In case of MC: reco collision survived event selection filter --> fill value for MC collision if collision is "true" MC collision if constexpr (soa::is_table) { - if (collision.mcCollisionId() >= 0) { + if (collision.has_mcCollision()) { isGoodCollision[collision.mcCollisionId()] = true; } } @@ -680,6 +690,20 @@ struct decay3bodyBuilder { // aquire collision auto const& collision = collisions.rawIteratorAt(decay3body.collisionId()); + // event selection + if constexpr (soa::is_table) { // only when NOT running over reduced data + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) { // ITS ROF boarder cut if not disabled + continue; + } + if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { + continue; + } + // Zorro + if (doSkimmedProcessing && onlyKeepInterestedTrigger && !isTriggeredCollision[collision.globalIndex()]) { + continue; + } + } + // initialise CCDB from run number saved in reduced collisions table when running over reduced data if constexpr (!soa::is_table) { // only do if running over reduced data (otherwise CCDB is initialised in process function) if (collision.runNumber() != lastRunNumber) { @@ -689,19 +713,6 @@ struct decay3bodyBuilder { } } - // event selection - if constexpr (soa::is_table) { // only when NOT running over reduced data - if (doSel8selection && !collision.sel8()) { - continue; - } - if (onlyKeepInterestedTrigger && !isTriggeredCollision[collision.globalIndex()]) { - continue; - } - } - if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { - continue; - } - // aquire tracks auto trackPos = decay3body.template track0_as(); auto trackNeg = decay3body.template track1_as(); @@ -775,7 +786,7 @@ struct decay3bodyBuilder { this3BodyMCInfo.isReco = true; // set flag if selected reco collision has matched gen collision - if (collision.mcCollisionId() >= 0) { // reco collision is matched to gen collision + if (collision.has_mcCollision()) { // reco collision is matched to gen collision this3BodyMCInfo.survivedEventSel = isGoodCollision[collision.mcCollisionId()]; } else { this3BodyMCInfo.survivedEventSel = false; // false if reco collision not matched to gen collision @@ -1327,6 +1338,14 @@ struct decay3bodyBuilder { fTrackedClSizeVector[tvtx3body.decay3BodyId()] = tvtx3body.itsClsSize(); } + // MC collision counting for event loss + registry.fill(HIST("Counters/hMcEventCounter"), 0.5, mcCollisions.size()); + for (const auto& collision : collisions) { + if (collision.has_mcCollision()) { + registry.fill(HIST("Counters/hMcEventCounter"), 1.5); + } + } + // do candidate analysis with MC processing buildCandidates(bcs, // bc table collisions, // collision table diff --git a/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx b/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx index a307a947902..8e13e91a04e 100644 --- a/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx +++ b/PWGLF/TableProducer/Nuspex/reduced3bodyCreator.cxx @@ -91,8 +91,7 @@ struct reduced3bodyCreator { o2::vertexing::DCAFitterN<3> fitter3body; o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; - Configurable doSel8selection{"doSel8selection", true, "flag for sel8 event selection"}; - Configurable doPosZselection{"doPosZselection", true, "flag for posZ event selection"}; + Configurable disableITSROFCut{"disableITSROFCut", false, "Disable ITS ROF border cut"}; // CCDB options Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"}; @@ -152,11 +151,10 @@ struct reduced3bodyCreator { registry.add("hAllSelEventsVtxZ", "hAllSelEventsVtxZ", HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}}); - auto hEventCounter = registry.add("hEventCounter", "hEventCounter", HistType::kTH1D, {{4, 0.0f, 4.0f}}); - hEventCounter->GetXaxis()->SetBinLabel(1, "total"); - hEventCounter->GetXaxis()->SetBinLabel(2, "sel8"); - hEventCounter->GetXaxis()->SetBinLabel(3, "vertexZ"); - hEventCounter->GetXaxis()->SetBinLabel(4, "reduced"); + auto hEventCounter = registry.add("hEventCounter", "hEventCounter", HistType::kTH1D, {{3, 0.0f, 3.0f}}); + hEventCounter->GetXaxis()->SetBinLabel(1, "all"); + hEventCounter->GetXaxis()->SetBinLabel(2, "selected"); + hEventCounter->GetXaxis()->SetBinLabel(3, "reduced"); hEventCounter->LabelsOption("v"); auto hEventCounterZorro = registry.add("hEventCounterZorro", "hEventCounterZorro", HistType::kTH1D, {{2, 0, 2}}); @@ -259,6 +257,14 @@ struct reduced3bodyCreator { lastRunNumber = bc.runNumber(); // Update the last run number } + // all events + registry.fill(HIST("hEventCounter"), 0.5); + + // ITS ROF boarder cut if not disabled + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) { + continue; + } + // Zorro event counting bool isZorroSelected = false; if (cfgSkimmedProcessing) { @@ -269,16 +275,13 @@ struct reduced3bodyCreator { } } - // Event selection - registry.fill(HIST("hEventCounter"), 0.5); - if (doSel8selection && !collision.sel8()) { + // event selection + if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { continue; } + + // selected events registry.fill(HIST("hEventCounter"), 1.5); - if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { // 10cm - continue; - } - registry.fill(HIST("hEventCounter"), 2.5); registry.fill(HIST("hAllSelEventsVtxZ"), collision.posZ()); if (cfgSkimmedProcessing && isZorroSelected) { @@ -300,19 +303,18 @@ struct reduced3bodyCreator { auto collision = d3body.template collision_as(); - if (doSel8selection && !collision.sel8()) { + // event selection + if (!collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && !disableITSROFCut) { // ITS ROF boarder cut if not disabled continue; } - if (doPosZselection && (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { // 10cm + if (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || (collision.posZ() >= 10.0f || collision.posZ() <= -10.0f)) { continue; } auto bc = collision.bc_as(); initCCDB(bc); - if (cfgSkimmedProcessing && cfgOnlyKeepInterestedTrigger) { - if (isTriggeredCollision[collision.globalIndex()] == false) { - continue; - } + if (cfgSkimmedProcessing && cfgOnlyKeepInterestedTrigger && !isTriggeredCollision[collision.globalIndex()]) { + continue; } // Save the collision @@ -411,7 +413,7 @@ struct reduced3bodyCreator { reduced3BodyInfo(radius, phi, posZ, rVtx, phiVtx, zVtx, fTrackedClSizeVector[d3body.globalIndex()]); } // end decay3body loop - registry.fill(HIST("hEventCounter"), 3.5, reducedCollisions.lastIndex() + 1); + registry.fill(HIST("hEventCounter"), 2.5, reducedCollisions.lastIndex() + 1); } };