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);