Skip to content

Commit 39b133f

Browse files
authored
added condition on ambi tracks loop to avoid crashes
added condition on ambi tracks loop to avoid crashes (in particular, for some Pb-Pb MC)
1 parent 54c4a4b commit 39b133f

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

DPG/Tasks/AOTEvent/eventSelectionQa.cxx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,17 +1000,19 @@ struct EventSelectionQaTask {
10001000
auto mapAmbTrIdsIt = mapAmbTrIds.find(track.globalIndex());
10011001
int ambTrId = mapAmbTrIdsIt == mapAmbTrIds.end() ? -1 : mapAmbTrIdsIt->second;
10021002
int indexBc = ambTrId < 0 ? track.collision_as<ColEvSels>().bc_as<BCsRun3>().globalIndex() : ambTracks.iteratorAt(ambTrId).bc_as<BCsRun3>().begin().globalIndex();
1003-
auto bc = bcs.iteratorAt(indexBc);
1004-
int64_t globalBC = bc.globalBC() + floor(track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS);
1003+
if (ambTrId < 0) { // temprorary limitation, to avoid crashes, in particular, on MC Pb-Pb datasets
1004+
auto bc = bcs.iteratorAt(indexBc);
1005+
int64_t globalBC = bc.globalBC() + floor(track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS);
10051006

1006-
int32_t indexClosestTVX = findClosest(globalBC, mapGlobalBcWithTVX);
1007-
int bcDiff = static_cast<int>(globalBC - vGlobalBCs[indexClosestTVX]);
1008-
if (track.hasTOF() || track.hasTRD() || !track.hasITS() || !track.hasTPC() || track.pt() < 1)
1009-
continue;
1010-
histos.fill(HIST("hTrackBcDiffVsEtaAll"), track.eta(), bcDiff);
1011-
if (track.eta() < -0.2 || track.eta() > 0.2)
1012-
continue;
1013-
histos.fill(HIST("hSecondsTVXvsBcDifAll"), bc.timestamp() / 1000., bcDiff);
1007+
int32_t indexClosestTVX = findClosest(globalBC, mapGlobalBcWithTVX);
1008+
int bcDiff = static_cast<int>(globalBC - vGlobalBCs[indexClosestTVX]);
1009+
if (track.hasTOF() || track.hasTRD() || !track.hasITS() || !track.hasTPC() || track.pt() < 1)
1010+
continue;
1011+
histos.fill(HIST("hTrackBcDiffVsEtaAll"), track.eta(), bcDiff);
1012+
if (track.eta() < -0.2 || track.eta() > 0.2)
1013+
continue;
1014+
histos.fill(HIST("hSecondsTVXvsBcDifAll"), bc.timestamp() / 1000., bcDiff);
1015+
}
10141016
}
10151017

10161018
// collision-based event selection qa

0 commit comments

Comments
 (0)