Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions PWGDQ/Tasks/dqEfficiency_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3818,8 +3818,28 @@ struct AnalysisAsymmetricPairing {
int sign1 = 0;
int sign2 = 0;
uint32_t mcDecision = 0;
ditrackList.reserve(1);
ditrackExtraList.reserve(1);

// estimate reserved size
int64_t reserveSize = 0;
for (auto const& event : events) {
auto groupedLegAAssocs = legACandidateAssocs.sliceBy(preslice, event.globalIndex());
auto groupedLegBAssocs = legBCandidateAssocs.sliceBy(preslice, event.globalIndex());
size_t nGoodA = 0;
size_t nGoodB = 0;
for (auto const& t : groupedLegAAssocs) {
if (t.isBarrelSelected_raw()) {
nGoodA++;
}
}
for (auto const& t : groupedLegBAssocs) {
if (t.isBarrelSelected_raw()) {
nGoodB++;
}
}
reserveSize += nGoodA * nGoodB;
}
ditrackList.reserve(reserveSize);
ditrackExtraList.reserve(reserveSize);

constexpr bool trackHasCov = ((TTrackFillMap & VarManager::ObjTypes::TrackCov) > 0 || (TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelCov) > 0);

Expand Down
21 changes: 13 additions & 8 deletions PWGDQ/Tasks/tableReader_withAssoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3574,16 +3574,21 @@ struct AnalysisAsymmetricPairing {
// 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<int64_t>(groupedLegAAssocs.size()) *
static_cast<int64_t>(groupedLegBAssocs.size());
size_t nGoodA = 0;
size_t nGoodB = 0;
for (auto const& t : groupedLegAAssocs) {
if (t.isBarrelSelected_raw()) {
nGoodA++;
}
}
for (auto const& t : groupedLegBAssocs) {
if (t.isBarrelSelected_raw()) {
nGoodB++;
}
}
reserveSize += nGoodA * nGoodB;
}
ditrackList.reserve(reserveSize);
ditrackExtraList.reserve(reserveSize);
Expand Down
Loading