Skip to content

Commit d78573e

Browse files
committed
Avoid pushing junk in the trackSeeds vector
1 parent 019bce2 commit d78573e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Detectors/ITSMFT/ITS/tracking/src/TrackerTraits.cxx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,21 +581,23 @@ void TrackerTraits::findRoads(const int iteration)
581581
for (int iLayer{startLayer - 1}; iLayer > 0 && level > 2; --iLayer) {
582582
lastCellSeed.swap(updatedCellSeed);
583583
lastCellId.swap(updatedCellId);
584-
updatedCellSeed.clear();
584+
std::vector<CellSeed>().swap(updatedCellSeed); /// tame the memory peaks
585585
updatedCellId.clear();
586586
processNeighbours(iLayer, --level, lastCellSeed, lastCellId, updatedCellSeed, updatedCellId);
587587
}
588-
trackSeeds.insert(trackSeeds.end(), updatedCellSeed.begin(), updatedCellSeed.end());
588+
for (auto& seed : updatedCellSeed) {
589+
if (seed.getQ2Pt() > 1.e3 || seed.getChi2() > mTrkParams[0].MaxChi2NDF * ((startLevel + 2) * 2 - 5)) {
590+
continue;
591+
}
592+
trackSeeds.push_back(seed);
593+
}
589594
}
590595

591596
std::vector<TrackITSExt> tracks(trackSeeds.size());
592597
std::atomic<size_t> trackIndex{0};
593598
#pragma omp parallel for num_threads(mNThreads)
594599
for (size_t seedId = 0; seedId < trackSeeds.size(); ++seedId) {
595600
const CellSeed& seed{trackSeeds[seedId]};
596-
if (seed.getQ2Pt() > 1.e3 || seed.getChi2() > mTrkParams[0].MaxChi2NDF * ((startLevel + 2) * 2 - 5)) {
597-
continue;
598-
}
599601
TrackITSExt temporaryTrack{seed};
600602
temporaryTrack.resetCovariance();
601603
temporaryTrack.setChi2(0);

0 commit comments

Comments
 (0)