File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3884,8 +3884,28 @@ struct AnalysisAsymmetricPairing {
38843884 int sign1 = 0 ;
38853885 int sign2 = 0 ;
38863886 uint32_t mcDecision = 0 ;
3887- ditrackList.reserve (1 );
3888- ditrackExtraList.reserve (1 );
3887+
3888+ // estimate reserved size
3889+ int64_t reserveSize = 0 ;
3890+ for (auto const & event : events) {
3891+ auto groupedLegAAssocs = legACandidateAssocs.sliceBy (preslice, event.globalIndex ());
3892+ auto groupedLegBAssocs = legBCandidateAssocs.sliceBy (preslice, event.globalIndex ());
3893+ size_t nGoodA = 0 ;
3894+ size_t nGoodB = 0 ;
3895+ for (auto const & t : groupedLegAAssocs) {
3896+ if (t.isBarrelSelected_raw ()) {
3897+ nGoodA++;
3898+ }
3899+ }
3900+ for (auto const & t : groupedLegBAssocs) {
3901+ if (t.isBarrelSelected_raw ()) {
3902+ nGoodB++;
3903+ }
3904+ }
3905+ reserveSize += nGoodA * nGoodB;
3906+ }
3907+ ditrackList.reserve (reserveSize);
3908+ ditrackExtraList.reserve (reserveSize);
38893909
38903910 constexpr bool trackHasCov = ((TTrackFillMap & VarManager::ObjTypes::TrackCov) > 0 || (TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelCov) > 0 );
38913911
Original file line number Diff line number Diff line change @@ -3661,16 +3661,21 @@ struct AnalysisAsymmetricPairing {
36613661 // Reserve capacity for the output tables
36623662 int64_t reserveSize = 0 ;
36633663 for (auto const & event : events) {
3664- if (!event.isEventSelected_bit (0 )) {
3665- continue ;
3666- }
3667- if (fConfigRemoveCollSplittingCandidates .value && event.isEventSelected_bit (2 )) {
3668- continue ;
3669- }
36703664 auto groupedLegAAssocs = legACandidateAssocs.sliceBy (preslice, event.globalIndex ());
36713665 auto groupedLegBAssocs = legBCandidateAssocs.sliceBy (preslice, event.globalIndex ());
3672- reserveSize += static_cast <int64_t >(groupedLegAAssocs.size ()) *
3673- static_cast <int64_t >(groupedLegBAssocs.size ());
3666+ size_t nGoodA = 0 ;
3667+ size_t nGoodB = 0 ;
3668+ for (auto const & t : groupedLegAAssocs) {
3669+ if (t.isBarrelSelected_raw ()) {
3670+ nGoodA++;
3671+ }
3672+ }
3673+ for (auto const & t : groupedLegBAssocs) {
3674+ if (t.isBarrelSelected_raw ()) {
3675+ nGoodB++;
3676+ }
3677+ }
3678+ reserveSize += nGoodA * nGoodB;
36743679 }
36753680 ditrackList.reserve (reserveSize);
36763681 ditrackExtraList.reserve (reserveSize);
You can’t perform that action at this time.
0 commit comments