diff --git a/algo/detectors/tof/Clusterizer.cxx b/algo/detectors/tof/Clusterizer.cxx index b6b89733e516c25e96a3702a017dd75a87242389..640481411c1ac92c87f3c8cead0922dfbe133eb5 100644 --- a/algo/detectors/tof/Clusterizer.cxx +++ b/algo/detectors/tof/Clusterizer.cxx @@ -231,9 +231,10 @@ namespace cbm::algo::tof ROOT::Math::XYZVector pos(posX, posY, 0.); cluster.add(pos, time, totSum, totSum, i1->second, i2->second); - // remove selected digis from pool - storDigi.erase(i2); - storDigi.erase(i1); + // remove digis at positions i1 and i2 from pool in efficient way (replaces two vector::erase calls). + std::copy(i1 + 1, i2, i1); + std::copy(i2 + 1, storDigi.end(), i2 - 1); + storDigi.resize(storDigi.size() - 2); if (AddNextChan(input, chan, cluster, clustersOut)) { return true; // signal hit was already added