From 3c1ae434e8fcd359eff1392a879b0ea0684fb51f Mon Sep 17 00:00:00 2001 From: Sandro Wenzel Date: Tue, 22 Sep 2026 22:26:36 +0200 Subject: [PATCH] Skip ambiguous tracks with an empty BC slice in the event selection QA This fixes a crash of the event selection QA task on MC AODs. - An ambiguous track can carry the BC slice (-1, -1), which means it has no associated BC at all. - The existing guard only rejected slices at or beyond the end of the BC table, so (-1, -1) passed it and bc_as().begin().globalIndex() was called on an empty slice, which segfaults. - The guard now uses has_bc(), which tests both slice ends for being negative, as CollisionAssociation.h already does, and checks the upper end as well. - Reproduced on LHC26a5a_gp_2025_v10 with O2Physics daily-20260729-0000-1, where the task exits 128; with this change the same file is processed and the QA histograms are filled. --- DPG/Tasks/AOTEvent/eventSelectionQa.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx index 13278810e0c..c5da0ee0076 100644 --- a/DPG/Tasks/AOTEvent/eventSelectionQa.cxx +++ b/DPG/Tasks/AOTEvent/eventSelectionQa.cxx @@ -1009,8 +1009,12 @@ struct EventSelectionQaTask { // special check to avoid crashes (in particular, on some MC Pb-Pb datasets) // (related to shifts in ambiguous tracks association to bc slices (off by 1) - see https://mattermost.web.cern.ch/alice/pl/g9yaaf3tn3g4pgn7c1yex9copy - if (ambTrId >= 0 && (ambTracks.iteratorAt(ambTrId).bcIds()[0] >= bcs.size())) - continue; + // an empty slice (-1, -1) passes the upper check, so test it as well + if (ambTrId >= 0) { + const auto& ambTrack = ambTracks.iteratorAt(ambTrId); + if (!ambTrack.has_bc() || ambTrack.bcIds()[0] >= bcs.size() || ambTrack.bcIds()[1] >= bcs.size()) + continue; + } int indexBc = ambTrId < 0 ? track.collision_as().bc_as().globalIndex() : ambTracks.iteratorAt(ambTrId).bc_as().begin().globalIndex(); auto bc = bcs.iteratorAt(indexBc);