From 88a67a0baa6b7ec560ccc041f8e2a7efb87a7ef5 Mon Sep 17 00:00:00 2001 From: lucasjsilva Date: Thu, 15 Jan 2026 14:37:24 -0300 Subject: [PATCH 1/4] Added treatment for outliers in MC tracks --- .../Tasks/GlobalEventProperties/studyPnch.cxx | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx b/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx index 0392059fa1e..625143efb9d 100644 --- a/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx @@ -251,6 +251,28 @@ struct StudyPnch { return nTrk; } + template + int countNTracksMcCol(countTrk const& tracks, McColType const& McCol) + { + auto nTrk = 0; + for (const auto& track : tracks) { + if (!isTrackSelected(track)) { + continue; + } + + // Verify that the track belongs to the given MC collision + if (track.has_mcParticle()) { + auto particle = track.mcParticle(); + if (particle.mcCollisionId() != McCol.mcCollisionId()) { + continue; + } + } + histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); + nTrk++; + } + return nTrk; + } + Filter fTrackSelectionITS = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && ncheckbit(aod::track::trackCutFlag, TrackSelectionIts); Filter fTrackSelectionTPC = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), @@ -287,7 +309,7 @@ struct StudyPnch { continue; } auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex()); - auto multrec = countNTracks(recTracksPart); + auto multrec = countNTracksMcCol(recTracksPart, RecCol); histos.fill(HIST("hMultiplicityMCrec"), multrec); auto multgen = countGenTracks(GenParticles); histos.fill(HIST("hMultiplicityMCgen"), multgen); From ea902fd37bcdca5aee640f634e161c25a395e423 Mon Sep 17 00:00:00 2001 From: lucasjsilva Date: Wed, 28 Jan 2026 14:19:29 -0300 Subject: [PATCH 2/4] Treatment for outliers in generated MC tracks --- .../Tasks/GlobalEventProperties/studyPnch.cxx | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx b/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx index 625143efb9d..2de6c449d93 100644 --- a/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx @@ -237,16 +237,21 @@ struct StudyPnch { return nTrk; } - template - int countGenTracks(countTrk const& tracks) + template + int countGenTracks(countTrk const& tracks, McColType const& McCol) { auto nTrk = 0; for (const auto& track : tracks) { if (!isGenTrackSelected(track)) { continue; } - histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); - nTrk++; + // Verify that the track belongs to the given MC collision + if (track.mcCollisionId() != McCol.globalIndex()) { + continue; + } + + histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); + nTrk++; } return nTrk; } @@ -302,7 +307,7 @@ struct StudyPnch { histos.fill(HIST("NPVtracks_vs_GlobalMult"), cols.multNTracksPV(), mult); } - void processMonteCarlo(ColMCTrueTable::iterator const&, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) + void processMonteCarlo(ColMCTrueTable::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { for (const auto& RecCol : RecCols) { if (!isEventSelected(RecCol)) { @@ -311,7 +316,7 @@ struct StudyPnch { auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex()); auto multrec = countNTracksMcCol(recTracksPart, RecCol); histos.fill(HIST("hMultiplicityMCrec"), multrec); - auto multgen = countGenTracks(GenParticles); + auto multgen = countGenTracks(GenParticles, mcCollision); histos.fill(HIST("hMultiplicityMCgen"), multgen); histos.fill(HIST("hResponseMatrix"), multrec, multgen); } @@ -327,7 +332,7 @@ struct StudyPnch { } // All generated events histos.fill(HIST("MCEventHist"), 1); - auto multAll = countGenTracks(GenParticles); + auto multAll = countGenTracks(GenParticles, mcCollision); histos.fill(HIST("hMultiplicityMCgenAll"), multAll); bool atLeastOne = false; @@ -346,7 +351,7 @@ struct StudyPnch { if (atLeastOne) { histos.fill(HIST("MCEventHist"), 2); - auto multSel = countGenTracks(GenParticles); + auto multSel = countGenTracks(GenParticles, mcCollision); histos.fill(HIST("hMultiplicityMCgenSel"), multSel); } } From 32a4ca5e393cc07ec747e70ee9db3dbf9c0598f1 Mon Sep 17 00:00:00 2001 From: lucasjsilva Date: Fri, 30 Jan 2026 18:37:21 -0300 Subject: [PATCH 3/4] Process Monte Carlo with correct count of generated tracks --- .../Tasks/GlobalEventProperties/studyPnch.cxx | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx b/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx index 2de6c449d93..87ef6dafb66 100644 --- a/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx @@ -125,7 +125,7 @@ struct StudyPnch { x->SetBinLabel(6, "INEL > 0"); x->SetBinLabel(7, "|vz| < 10"); - if (doprocessData || doprocessCorrelation || doprocessMonteCarlo) { + if (doprocessData || doprocessCorrelation || doprocessMonteCarlo || doprocessTreatedMonteCarlo) { histos.add("PhiVsEtaHist", "PhiVsEtaHist", kTH2F, {axisPhi, axisEta}, false); } if (doprocessData) { @@ -143,6 +143,11 @@ struct StudyPnch { histos.add("hMultiplicityMCgen", "hMultiplicityMCgen", kTH1F, {axisMult}, true); histos.add("hResponseMatrix", "hResponseMatrix", kTH2F, {axisMult, axisMult}, true); } + if (doprocessTreatedMonteCarlo) { + histos.add("hMultiplicityTreatMCrec", "hMultiplicityTreatMCrec", kTH1F, {axisMult}, true); + histos.add("hMultiplicityTreatMCgen", "hMultiplicityTreatMCgen", kTH1F, {axisMult}, true); + histos.add("hResponseMatrixTreat", "hResponseMatrixTreat", kTH2F, {axisMult, axisMult}, true); + } if (doprocessEvtLossSigLossMC) { histos.add("MCEventHist", "MCEventHist", kTH1F, {axisEvent}, false); auto hstat = histos.get(HIST("MCEventHist")); @@ -249,7 +254,6 @@ struct StudyPnch { if (track.mcCollisionId() != McCol.globalIndex()) { continue; } - histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); nTrk++; } @@ -264,7 +268,6 @@ struct StudyPnch { if (!isTrackSelected(track)) { continue; } - // Verify that the track belongs to the given MC collision if (track.has_mcParticle()) { auto particle = track.mcParticle(); @@ -322,6 +325,26 @@ struct StudyPnch { } } + void processTreatedMonteCarlo(ColMCTrueTable::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) + { + // Count generated tracks at each iterator + auto multgen = countGenTracks(GenParticles, mcCollision); + histos.fill(HIST("hMultiplicityTreatMCgen"), multgen); + for (const auto& RecCol : RecCols) { + if (!isEventSelected(RecCol)) { + continue; + } + // Verify that the reconstructed collision corresponds to the given MC collision + if (RecCol.mcCollisionId() != mcCollision.globalIndex()) { + continue; + } + auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex()); + auto multrec = countNTracksMcCol(recTracksPart, RecCol); + histos.fill(HIST("hMultiplicityTreatMCrec"), multrec); + histos.fill(HIST("hResponseMatrixTreat"), multrec, multgen); + } + } + void processEvtLossSigLossMC(soa::Join::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles) { if (isApplyInelgt0 && !mcCollision.isInelGt0()) { @@ -359,6 +382,7 @@ struct StudyPnch { PROCESS_SWITCH(StudyPnch, processData, "process data CentFT0C", false); PROCESS_SWITCH(StudyPnch, processCorrelation, "do correlation study in data", false); PROCESS_SWITCH(StudyPnch, processMonteCarlo, "process MC CentFT0C", false); + PROCESS_SWITCH(StudyPnch, processTreatedMonteCarlo, "process Treated MC CentFT0C", false); PROCESS_SWITCH(StudyPnch, processEvtLossSigLossMC, "process Signal Loss, Event Loss", false); }; From 8c1debc885c1e53f6f6edbd6be120fcb5eb67a7b Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Fri, 30 Jan 2026 21:46:40 +0000 Subject: [PATCH 4/4] Please consider the following formatting changes --- PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx b/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx index 87ef6dafb66..28843ed3f95 100644 --- a/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx +++ b/PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx @@ -254,8 +254,8 @@ struct StudyPnch { if (track.mcCollisionId() != McCol.globalIndex()) { continue; } - histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); - nTrk++; + histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); + nTrk++; } return nTrk; }