From 251f0d07bb0023edfd9bd440e90f22bf3375da13 Mon Sep 17 00:00:00 2001 From: Sahil Upadhyaya Date: Tue, 7 Oct 2025 17:36:53 +0200 Subject: [PATCH 1/2] Adding processMCGenWithGrouping for 1st generation 2-prong MC Signal --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 47 +++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index fee7cc0356f..b7544ddb007 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -1386,7 +1386,7 @@ struct AnalysisSameEventPairing { if (context.mOptions.get("processDummy")) { return; } - bool isMCGen = context.mOptions.get("processMCGen"); + bool isMCGen = context.mOptions.get("processMCGen") || context.mOptions.get("processMCGenWithGrouping"); VarManager::SetDefaultVarNames(); fEnableBarrelHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processBarrelOnlySkimmed") || context.mOptions.get("processBarrelOnlyWithCollSkimmed"); @@ -2318,6 +2318,50 @@ struct AnalysisSameEventPairing { } // end loop over reconstructed events } + void processMCGenWithGrouping(soa::Filtered const& events, + ReducedMCEvents const& /*mcEvents*/, ReducedMCTracks const& mcTracks) + { + uint32_t mcDecision = 0; + int isig = 0; + for (auto& event : events) { + if (!event.isEventSelected_bit(0)) { + continue; + } + if (!event.has_reducedMCevent()) { + continue; + } + + if (fHasTwoProngGenMCsignals) { + auto groupedMCTracks = mcTracks.sliceBy(perReducedMcEvent, event.reducedMCeventId()); + groupedMCTracks.bindInternalIndicesTo(&mcTracks); + for (auto& [t1, t2] : combinations(groupedMCTracks, groupedMCTracks)) + { + auto t1_raw = groupedMCTracks.rawIteratorAt(t1.globalIndex()); + auto t2_raw = groupedMCTracks.rawIteratorAt(t2.globalIndex()); + if (t1_raw.reducedMCeventId() == t2_raw.reducedMCeventId()) { + mcDecision = 0; + isig = 0; + for (auto& sig : fGenMCSignals) { + if (sig->GetNProngs() != 2) { // NOTE: 2-prong signals required here + continue; + } + if (sig->CheckSignal(true, t1_raw, t2_raw)) { + mcDecision |= (static_cast(1) << isig); + VarManager::FillPairMC(t1, t2); // NOTE: This feature will only work for muons + fHistMan->FillHistClass(Form("MCTruthGenPairSel_%s", sig->GetName()), VarManager::fgValues); + if (useMiniTree.fConfigMiniTree) { + // WARNING! To be checked + dileptonMiniTreeGen(mcDecision, -999, t1.pt(), t1.eta(), t1.phi(), t2.pt(), t2.eta(), t2.phi()); + } + } + isig++; + } + } + } + } // end loop over reconstructed events + } + } + void processDummy(MyEvents&) { // do nothing @@ -2328,6 +2372,7 @@ struct AnalysisSameEventPairing { PROCESS_SWITCH(AnalysisSameEventPairing, processBarrelOnlyWithCollSkimmed, "Run barrel only pairing, with skimmed tracks and with collision information", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMuonOnlySkimmed, "Run muon only pairing, with skimmed tracks", false); PROCESS_SWITCH(AnalysisSameEventPairing, processMCGen, "Loop over MC particle stack and fill generator level histograms", false); + PROCESS_SWITCH(AnalysisSameEventPairing, processMCGenWithGrouping, "Loop over MC particle stack (grouped MCTracks) and fill generator level histograms", false); PROCESS_SWITCH(AnalysisSameEventPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", true); }; From 3917d5b800a5eb4f4a603457eb547ef81c238ab8 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 8 Oct 2025 08:31:53 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- PWGDQ/Tasks/dqEfficiency_withAssoc.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index b7544ddb007..3c815a01edd 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -2319,7 +2319,7 @@ struct AnalysisSameEventPairing { } void processMCGenWithGrouping(soa::Filtered const& events, - ReducedMCEvents const& /*mcEvents*/, ReducedMCTracks const& mcTracks) + ReducedMCEvents const& /*mcEvents*/, ReducedMCTracks const& mcTracks) { uint32_t mcDecision = 0; int isig = 0; @@ -2330,12 +2330,11 @@ struct AnalysisSameEventPairing { if (!event.has_reducedMCevent()) { continue; } - + if (fHasTwoProngGenMCsignals) { auto groupedMCTracks = mcTracks.sliceBy(perReducedMcEvent, event.reducedMCeventId()); groupedMCTracks.bindInternalIndicesTo(&mcTracks); - for (auto& [t1, t2] : combinations(groupedMCTracks, groupedMCTracks)) - { + for (auto& [t1, t2] : combinations(groupedMCTracks, groupedMCTracks)) { auto t1_raw = groupedMCTracks.rawIteratorAt(t1.globalIndex()); auto t2_raw = groupedMCTracks.rawIteratorAt(t2.globalIndex()); if (t1_raw.reducedMCeventId() == t2_raw.reducedMCeventId()) {