Skip to content

Commit 018fba7

Browse files
author
Marcello Di Costanzo
committed
Fix reserve in D0 tree creator
1 parent 46d0248 commit 018fba7

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

PWGHF/TableProducer/treeCreatorD0ToKPi.cxx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,14 @@ struct HfTreeCreatorD0ToKPi {
423423

424424
// Filling candidate properties
425425
if (fillCandidateLiteTable) {
426-
rowCandidateLite.reserve(candidates.size());
426+
// Account for candidates passing both D0 and D0bar
427+
// selection, which will be stored twice in the lite table
428+
rowCandidateLite.reserve(candidates.size() * 2);
427429
} else {
428-
rowCandidateFull.reserve(candidates.size());
430+
rowCandidateFull.reserve(candidates.size() * 2);
429431
}
430432
if constexpr (ApplyMl) {
431-
rowCandidateMl.reserve(candidates.size());
433+
rowCandidateMl.reserve(candidates.size() * 2);
432434
}
433435
for (const auto& candidate : candidates) {
434436
if (downSampleBkgFactor < 1.) {
@@ -511,12 +513,12 @@ struct HfTreeCreatorD0ToKPi {
511513

512514
// Filling candidate properties
513515
if (fillCandidateLiteTable) {
514-
rowCandidateLite.reserve(candidates.size());
516+
rowCandidateLite.reserve(candidates.size() * 2);
515517
} else {
516-
rowCandidateFull.reserve(candidates.size());
518+
rowCandidateFull.reserve(candidates.size() * 2);
517519
}
518520
if constexpr (ApplyMl) {
519-
rowCandidateMl.reserve(candidates.size());
521+
rowCandidateMl.reserve(candidates.size() * 2);
520522
}
521523
for (const auto& candidate : candidates) {
522524
if constexpr (OnlyBkg) {

0 commit comments

Comments
 (0)