From 9dcd2f56d9fd276d9dc0a6c6f0aee53aee26fa5e Mon Sep 17 00:00:00 2001 From: creetz16 Date: Tue, 1 Dec 2026 21:06:06 +0100 Subject: [PATCH] Allow parallel processing of data and MC process functions --- .../Nuspex/trackedHypertritonRecoTask.cxx | 60 ++++++++++++++----- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/PWGLF/TableProducer/Nuspex/trackedHypertritonRecoTask.cxx b/PWGLF/TableProducer/Nuspex/trackedHypertritonRecoTask.cxx index 0140ce61a3f..c30f575bbd0 100644 --- a/PWGLF/TableProducer/Nuspex/trackedHypertritonRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/trackedHypertritonRecoTask.cxx @@ -314,13 +314,15 @@ struct TrackedHypertritonRecoTask { selections.minCosPA = threeBody.minCosPA; selections.maxChi2 = threeBody.maxChi2; - registry.add("events", "Event selection;selection;events", HistType::kTH1D, {{5, -0.5, 4.5}}); - auto events = registry.get(HIST("events")); - events->GetXaxis()->SetBinLabel(1, "all"); - events->GetXaxis()->SetBinLabel(2, "sel8"); - events->GetXaxis()->SetBinLabel(3, "z_{vtx}"); - events->GetXaxis()->SetBinLabel(4, "kNoSameBunchPileup"); - events->GetXaxis()->SetBinLabel(5, "kIsGoodZvtxFT0vsPV"); + if (doprocessData) { + registry.add("hEventCounter", "Event selection;selection;events", HistType::kTH1D, {{5, -0.5, 4.5}}); + auto hEventCounter = registry.get(HIST("hEventCounter")); + hEventCounter->GetXaxis()->SetBinLabel(1, "all"); + hEventCounter->GetXaxis()->SetBinLabel(2, "sel8"); + hEventCounter->GetXaxis()->SetBinLabel(3, "z_{vtx}"); + hEventCounter->GetXaxis()->SetBinLabel(4, "kNoSameBunchPileup"); + hEventCounter->GetXaxis()->SetBinLabel(5, "kIsGoodZvtxFT0vsPV"); + } registry.add("zorroEvents", "Zorro accounting;trigger;selection", HistType::kTH2D, {{2, -0.5, 1.5}, {2, -0.5, 1.5}}); auto zorroEvents = registry.get(HIST("zorroEvents")); @@ -330,6 +332,13 @@ struct TrackedHypertritonRecoTask { zorroEvents->GetYaxis()->SetBinLabel(2, "after sel8"); if (doprocessMC) { + registry.add("hRecEventCounter", "Event selection;selection;events", HistType::kTH1D, {{5, -0.5, 4.5}}); + auto hRecEventCounter = registry.get(HIST("hRecEventCounter")); + hRecEventCounter->GetXaxis()->SetBinLabel(1, "all"); + hRecEventCounter->GetXaxis()->SetBinLabel(2, "sel8"); + hRecEventCounter->GetXaxis()->SetBinLabel(3, "z_{vtx}"); + hRecEventCounter->GetXaxis()->SetBinLabel(4, "kNoSameBunchPileup"); + hRecEventCounter->GetXaxis()->SetBinLabel(5, "kIsGoodZvtxFT0vsPV"); auto hMcEventCounter = registry.add("hMcEventCounter", "hMcEventCounter; Selection; Counts", HistType::kTH1D, {{3, 0.0f, 3.0f}}); hMcEventCounter->GetXaxis()->SetBinLabel(1, "all"); hMcEventCounter->GetXaxis()->SetBinLabel(2, "reconstructed"); @@ -377,13 +386,18 @@ struct TrackedHypertritonRecoTask { runNumber = bc.runNumber(); } - template + template void selectCollisions(TCollision const& collisions, bool applyZorro) { goodCollision.assign(collisions.size(), false); zorroDecision.assign(collisions.size(), {}); for (const auto& collision : collisions) { - registry.fill(HIST("events"), 0.); + if constexpr (isMC) { + registry.fill(HIST("hRecEventCounter"), 0.); + } else { + registry.fill(HIST("hEventCounter"), 0.); + } + auto bc = collision.template bc_as(); initCCDB(bc); @@ -401,19 +415,35 @@ struct TrackedHypertritonRecoTask { if (requireSel8 && !collision.sel8()) { continue; } - registry.fill(HIST("events"), 1.); + if constexpr (isMC) { + registry.fill(HIST("hRecEventCounter"), 1.); + } else { + registry.fill(HIST("hEventCounter"), 1.); + } if (maxAbsZvtx >= 0.f && std::abs(collision.posZ()) > maxAbsZvtx) { continue; } - registry.fill(HIST("events"), 2.); + if constexpr (isMC) { + registry.fill(HIST("hRecEventCounter"), 2.); + } else { + registry.fill(HIST("hEventCounter"), 2.); + } if (requireNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { continue; } - registry.fill(HIST("events"), 3.); + if constexpr (isMC) { + registry.fill(HIST("hRecEventCounter"), 3.); + } else { + registry.fill(HIST("hEventCounter"), 3.); + } if (requireIsGoodZvtxFT0vsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { continue; } - registry.fill(HIST("events"), 4.); + if constexpr (isMC) { + registry.fill(HIST("hRecEventCounter"), 4.); + } else { + registry.fill(HIST("hEventCounter"), 4.); + } goodCollision[collision.globalIndex()] = true; if (applyZorro) { @@ -937,7 +967,7 @@ struct TrackedHypertritonRecoTask { Tracks const& /*tracks*/, aod::BCsWithTimestamps const&) { - selectCollisions(collisions, skimmedProcessing); + selectCollisions(collisions, skimmedProcessing); for (const auto& trackedV0 : trackedV0s) { const auto inputV0 = trackedV0.v0_as(); @@ -1016,7 +1046,7 @@ struct TrackedHypertritonRecoTask { aod::BCsWithTimestamps const&, aod::McParticles const& mcParticles) { - selectCollisions(collisions, false); + selectCollisions(collisions, false); // MC collision counting for event loss and MC closure registry.fill(HIST("hMcEventCounter"), 0.5, mcCollisions.size());