From 3e06d51c422bf9bb61a589509b496b0b787ee0bd Mon Sep 17 00:00:00 2001 From: Jifeng Deng Date: Tue, 28 Jul 2026 15:59:56 +0800 Subject: [PATCH 1/2] Fix the reserve size problem in asymmetric pairing of tableReader_withAssoc In the original code, ditrack table reserves based on the number of tracks rather than on the number of pairs, which may cause the crash of the program. Adapt the similar strategy as what has been done in same event pairing to fix the problem. --- PWGDQ/Tasks/tableReader_withAssoc.cxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index aba3686f2e8..5b298f1a857 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -3471,8 +3471,23 @@ struct AnalysisAsymmetricPairing { int sign1 = 0; int sign2 = 0; - ditrackList.reserve(assocs.size()); - ditrackExtraList.reserve(assocs.size()); + + //Reserve capacity for the output tables + int64_t reserveSize = 0; + for (auto const& event : events) { + if (!event.isEventSelected_bit(0)) { + continue; + } + if (fConfigRemoveCollSplittingCandidates.value && event.isEventSelected_bit(2)) { + continue; + } + auto groupedLegAAssocs = legACandidateAssocs.sliceBy(preslice, event.globalIndex()); + auto groupedLegBAssocs = legBCandidateAssocs.sliceBy(preslice, event.globalIndex()); + reserveSize += static_cast(groupedLegAAssocs.size()) * + static_cast(groupedLegBAssocs.size()); + } + ditrackList.reserve(reserveSize); + ditrackExtraList.reserve(reserveSize); constexpr bool trackHasCov = ((TTrackFillMap & VarManager::ObjTypes::TrackCov) > 0 || (TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelCov) > 0); From 6de15c5a10a1fa40d38f03a238c428bc3516f7f6 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 28 Jul 2026 10:35:53 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- PWGDQ/Tasks/tableReader_withAssoc.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index 5b298f1a857..34eaef40c8e 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -3472,19 +3472,19 @@ struct AnalysisAsymmetricPairing { int sign1 = 0; int sign2 = 0; - //Reserve capacity for the output tables + // Reserve capacity for the output tables int64_t reserveSize = 0; for (auto const& event : events) { if (!event.isEventSelected_bit(0)) { continue; } if (fConfigRemoveCollSplittingCandidates.value && event.isEventSelected_bit(2)) { - continue; + continue; } auto groupedLegAAssocs = legACandidateAssocs.sliceBy(preslice, event.globalIndex()); auto groupedLegBAssocs = legBCandidateAssocs.sliceBy(preslice, event.globalIndex()); reserveSize += static_cast(groupedLegAAssocs.size()) * - static_cast(groupedLegBAssocs.size()); + static_cast(groupedLegBAssocs.size()); } ditrackList.reserve(reserveSize); ditrackExtraList.reserve(reserveSize);