diff --git a/Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp b/Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp index be50a0546ed..521e62e9009 100644 --- a/Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp +++ b/Core/include/Acts/Seeding/CandidatesForMiddleSp.hpp @@ -107,6 +107,14 @@ class CandidatesForMiddleSp { /// @returns The comparison result static bool ascendingByQuality(const value_type& i1, const value_type& i2); + /// @brief Retrieve the number of Low quality candidates + /// @returns The number of Low quality candidates + std::size_t nLowQualityCandidates() const; + + /// @brief Retrieve the number of High quality candidates + /// @returns The number of High quality candidates + std::size_t nHighQualityCandidates() const; + private: /// @brief dding a new triplet candidate to the collection, should it satisfy the /// selection criteria diff --git a/Core/include/Acts/Seeding/CandidatesForMiddleSp.ipp b/Core/include/Acts/Seeding/CandidatesForMiddleSp.ipp index 883e827868c..509f0855fa6 100644 --- a/Core/include/Acts/Seeding/CandidatesForMiddleSp.ipp +++ b/Core/include/Acts/Seeding/CandidatesForMiddleSp.ipp @@ -298,4 +298,16 @@ bool CandidatesForMiddleSp::ascendingByQuality( return !descendingByQuality(i1, i2); } +template +std::size_t +CandidatesForMiddleSp::nLowQualityCandidates() const { + return m_n_low; +} + +template +std::size_t +CandidatesForMiddleSp::nHighQualityCandidates() const { + return m_n_high; +} + } // namespace Acts diff --git a/Core/include/Acts/Seeding/SeedFilter.hpp b/Core/include/Acts/Seeding/SeedFilter.hpp index c1b8ab3542d..95a7b81aa0e 100644 --- a/Core/include/Acts/Seeding/SeedFilter.hpp +++ b/Core/include/Acts/Seeding/SeedFilter.hpp @@ -31,12 +31,6 @@ struct SeedFilterState { // compatible top required float rMaxSeedConf = std::numeric_limits::max(); // Acts::UnitConstants::mm - // number of high quality seeds in seed confirmation - std::size_t numQualitySeeds = 0; - // number of seeds that did not pass the quality confirmation but were still - // accepted, if quality confirmation is not used this is the total number of - // seeds - std::size_t numSeeds = 0; }; /// Filter seeds at various stages with the currently @@ -76,7 +70,6 @@ class SeedFilter final { /// Filter seeds once all seeds for one middle space point have been created /// @param spacePointData Auxiliary variables used by the seeding /// @param candidates_collector collection of seed candidates - /// @param numQualitySeeds number of high quality seeds in seed confirmation /// @param outputCollection Output container for the seeds /// for all seeds with the same middle space point template @@ -84,7 +77,7 @@ class SeedFilter final { Acts::SpacePointData& spacePointData, CandidatesForMiddleSp>& candidates_collector, - const std::size_t numQualitySeeds, collection_t& outputCollection) const; + collection_t& outputCollection) const; /// Filter seeds once all seeds for one middle space point have been created /// @param spacePointData Auxiliary variables used by the seeding diff --git a/Core/include/Acts/Seeding/SeedFilter.ipp b/Core/include/Acts/Seeding/SeedFilter.ipp index a282637654e..71d2a6250ce 100644 --- a/Core/include/Acts/Seeding/SeedFilter.ipp +++ b/Core/include/Acts/Seeding/SeedFilter.ipp @@ -172,7 +172,8 @@ void SeedFilter::filterSeeds_2SpFixed( int deltaSeedConf = compatibleSeedR.size() + 1 - seedFilterState.nTopSeedConf; if (deltaSeedConf < 0 || - (seedFilterState.numQualitySeeds != 0 && deltaSeedConf == 0)) { + (candidates_collector.nHighQualityCandidates() != 0 && + deltaSeedConf == 0)) { continue; } bool seedRangeCuts = @@ -204,11 +205,6 @@ void SeedFilter::filterSeeds_2SpFixed( // If this is reached, we remove the seed with the lowest weight. candidates_collector.push(bottomSP, middleSP, *topSpVec[topSPIndex], weight, zOrigin, true); - if (seedFilterState.numQualitySeeds < m_cfg.maxQualitySeedsPerSpMConf) { - // fill high quality seed - seedFilterState.numQualitySeeds++; - } - } else if (weight > weightMax) { // store weight and index of the best "lower quality" seed weightMax = weight; @@ -222,25 +218,17 @@ void SeedFilter::filterSeeds_2SpFixed( candidates_collector.push(bottomSP, middleSP, *topSpVec[topSPIndex], weight, zOrigin, false); - if (seedFilterState.numSeeds < m_cfg.maxSeedsPerSpMConf) { - // fill seed - seedFilterState.numSeeds++; - } } } // loop on tops // if no high quality seed was found for a certain middle+bottom SP pair, // lower quality seeds can be accepted if (m_cfg.seedConfirmation && maxWeightSeed && - seedFilterState.numQualitySeeds == 0) { + candidates_collector.nHighQualityCandidates() == 0) { // if we have not yet reached our max number of seeds we add the new seed to // outCont candidates_collector.push(bottomSP, middleSP, *topSpVec[maxWeightSeedIndex], weightMax, zOrigin, false); - if (seedFilterState.numSeeds < m_cfg.maxSeedsPerSpMConf) { - // fill seed - seedFilterState.numSeeds++; - } } } @@ -252,10 +240,11 @@ void SeedFilter::filterSeeds_1SpFixed( Acts::SpacePointData& spacePointData, CandidatesForMiddleSp>& candidates_collector, - const std::size_t numQualitySeeds, collection_t& outputCollection) const { + collection_t& outputCollection) const { // retrieve all candidates // this collection is already sorted // higher weights first + std::size_t numQualitySeeds = candidates_collector.nHighQualityCandidates(); auto extended_collection = candidates_collector.storage(); filterSeeds_1SpFixed(spacePointData, extended_collection, numQualitySeeds, outputCollection); diff --git a/Core/include/Acts/Seeding/SeedFinder.ipp b/Core/include/Acts/Seeding/SeedFinder.ipp index f699820e91a..ba36b260909 100644 --- a/Core/include/Acts/Seeding/SeedFinder.ipp +++ b/Core/include/Acts/Seeding/SeedFinder.ipp @@ -199,8 +199,7 @@ void SeedFinder::createSeedsForGroup( } m_config.seedFilter->filterSeeds_1SpFixed( - state.spacePointData, state.candidates_collector, - seedFilterState.numQualitySeeds, outputCollection); + state.spacePointData, state.candidates_collector, outputCollection); } // loop on mediums } @@ -572,7 +571,8 @@ SeedFinder::filterCandidates( state.compatBottomSP[b]->radius() > seedFilterState.rMaxSeedConf) { minCompatibleTopSPs = 1; } - if (m_config.seedConfirmation && seedFilterState.numQualitySeeds) { + if (m_config.seedConfirmation && + state.candidates_collector.nHighQualityCandidates()) { minCompatibleTopSPs++; } diff --git a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp index 7b4663dac72..31757e3e72a 100644 --- a/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp +++ b/Core/include/Acts/Seeding/SeedFinderOrthogonal.ipp @@ -363,7 +363,8 @@ void SeedFinderOrthogonal::filterCandidates( bottom[b]->radius() > seedFilterState.rMaxSeedConf) { minCompatibleTopSPs = 1; } - if (m_config.seedConfirmation && seedFilterState.numQualitySeeds) { + if (m_config.seedConfirmation && + candidates_collector.nHighQualityCandidates()) { minCompatibleTopSPs++; } @@ -676,9 +677,8 @@ void SeedFinderOrthogonal::processFromMiddleSP( */ if ((!bottom_lh_v.empty() && !top_lh_v.empty()) || (!bottom_hl_v.empty() && !top_hl_v.empty())) { - m_config.seedFilter->filterSeeds_1SpFixed( - spacePointData, candidates_collector, seedFilterState.numQualitySeeds, - out_cont); + m_config.seedFilter->filterSeeds_1SpFixed(spacePointData, + candidates_collector, out_cont); } } diff --git a/docs/core/reconstruction/pattern_recognition/seeding.md b/docs/core/reconstruction/pattern_recognition/seeding.md index 4ee17e98c6d..67fe50c6748 100644 --- a/docs/core/reconstruction/pattern_recognition/seeding.md +++ b/docs/core/reconstruction/pattern_recognition/seeding.md @@ -223,7 +223,7 @@ The seed confirmation also sets a limit on the number of seeds produced for each which retains only the higher quality seeds. If this limit is exceeded, the algorithm checks if there is any low-quality seed in the seed container of this middle SP that can be removed. -:::{doxygenfunction} Acts::SeedFilter::filterSeeds_1SpFixed (Acts::SpacePointData &spacePointData, CandidatesForMiddleSp>&, const std::size_t, collection_t&) const +:::{doxygenfunction} Acts::SeedFilter::filterSeeds_1SpFixed (Acts::SpacePointData &spacePointData, CandidatesForMiddleSp>&, collection_t&) const :outline: :::