diff --git a/algo/ca/core/tracking/CaTrackFinderWindow.cxx b/algo/ca/core/tracking/CaTrackFinderWindow.cxx index ed2b455cd479537cdacf0899d663043af8616ee7..ab40955282594fe8e049d994ecf767ef9b832db2 100644 --- a/algo/ca/core/tracking/CaTrackFinderWindow.cxx +++ b/algo/ca/core/tracking/CaTrackFinderWindow.cxx @@ -504,7 +504,8 @@ void TrackFinderWindow::CreateTrackCandidates(WindowData& wData, TripletArray_t& ca::Branch& tr = fvTrackCandidates.back(); tr.SetStation(istaF); tr.SetId(fvTrackCandidates.size() - 1); - tr.SetAlive(true); + // Mark the candidate as dead. To became alive it should first pass the competition in DoCompetitionLoop + tr.SetAlive(false); if constexpr (fDebug) { std::stringstream s; s << "iter " << wData.CurrentIteration()->GetName() << ", track candidate " << fvTrackCandidates.size() - 1 @@ -517,15 +518,14 @@ void TrackFinderWindow::CreateTrackCandidates(WindowData& wData, TripletArray_t& } } // itrip } // istaF - - for (ca::Branch& tr : fvTrackCandidates) { - tr.SetAlive(false); - } } // --------------------------------------------------------------------------------------------------------------------- void TrackFinderWindow::DoCompetitionLoop(const WindowData& wData) { + + // look at the dead track candidates in fvTrackCandidates pool; select the best ones and make them alive + for (int iComp = 0; (iComp < 100); ++iComp) { bool repeatCompetition = false; @@ -540,7 +540,7 @@ void TrackFinderWindow::DoCompetitionLoop(const WindowData& wData) auto updateStrip = [&](int& strip) { if ((strip >= 0) && (strip != tr.Id())) { // strip is used by other candidate const auto& other = fvTrackCandidates[strip]; - if (!other.IsAlive() || tr.IsBetterThan(other)) { + if (!other.IsAlive() && tr.IsBetterThan(other)) { strip = tr.Id(); } else {