From ebfff6d6d23c43b060475e3c0d9b0fa4ad0e562f 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 7bc5d77d76f..a86918b176e 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -3485,8 +3485,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 1c7a30f743420bcab948dedbf503a89fb9b14cc5 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index a86918b176e..6f623f3469f 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -3472,7 +3472,7 @@ struct AnalysisAsymmetricPairing { // Template function to run same event pairing with asymmetric pairs (e.g. kaon-pion) template - void runAsymmetricPairing(TEvents const& events, Preslice& preslice, TTrackAssocs const& assocs, TTracks const& /*tracks*/) + void runAsymmetricPairing(TEvents const& events, Preslice& preslice, TTrackAssocs const& /*assocs*/, TTracks const& /*tracks*/) { fPairCount.clear(); @@ -3486,19 +3486,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);