Skip to content

Commit 4473d84

Browse files
committed
Add protection for malformed ambiguous track table entries in AO2Ds
1 parent b63b8dd commit 4473d84

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Common/Core/CollisionAssociation.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class CollisionAssociation
127127
TTracksUnfiltered const& tracksUnfiltered,
128128
TTracks const& tracks,
129129
TAmbiTracks const& ambiguousTracks,
130-
o2::aod::BCs const&,
130+
o2::aod::BCs const& bcs,
131131
Assoc& association,
132132
RevIndices& reverseIndices)
133133
{
@@ -151,6 +151,11 @@ class CollisionAssociation
151151
for (const auto& ambTrack : ambiguousTracks) {
152152
if constexpr (isCentralBarrel) { // FIXME: to be removed as soon as it is possible to use getId<Table>() for joined tables
153153
if (ambTrack.trackId() == track.globalIndex()) {
154+
// special check to avoid crashes (in particular on some MC datasets)
155+
// related to shifts in ambiguous tracks association to bc slices (off by 1) - see https://mattermost.web.cern.ch/alice/pl/g9yaaf3tn3g4pgn7c1yex9copy
156+
if (ambTrack.bcIds()[0] >= bcs.size() || ambTrack.bcIds()[1] >= bcs.size()) {
157+
break;
158+
}
154159
if (!ambTrack.has_bc() || ambTrack.bc().size() == 0) {
155160
break;
156161
}

0 commit comments

Comments
 (0)