Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-30 08:09:56

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/EventData/Seed.hpp"
0012 #include "Acts/EventData/SpacePointMutableData.hpp"
0013 #include "Acts/Seeding/CandidatesForMiddleSp.hpp"
0014 #include "Acts/Seeding/IExperimentCuts.hpp"
0015 #include "Acts/Seeding/SeedFilterConfig.hpp"
0016 #include "Acts/Utilities/Logger.hpp"
0017 
0018 #include <memory>
0019 #include <mutex>
0020 #include <queue>
0021 #include <tuple>
0022 #include <vector>
0023 
0024 namespace Acts {
0025 struct SeedFilterState {
0026   // longitudinal impact parameter as defined by bottom and middle space point
0027   float zOrigin = 0;
0028   // number of minimum top SPs in seed confirmation
0029   std::size_t nTopSeedConf = 0;
0030   // radius of bottom component of seed that is used to define the number of
0031   // compatible top required
0032   float rMaxSeedConf =
0033       std::numeric_limits<float>::max();  // Acts::UnitConstants::mm
0034 };
0035 
0036 /// Filter seeds at various stages with the currently
0037 /// available information.
0038 template <typename external_spacepoint_t>
0039 class SeedFilter final {
0040  public:
0041   SeedFilter(const SeedFilterConfig& config,
0042              IExperimentCuts<external_spacepoint_t>* expCuts = nullptr);
0043   SeedFilter(const SeedFilterConfig& config,
0044              std::unique_ptr<const Acts::Logger> logger,
0045              IExperimentCuts<external_spacepoint_t>* expCuts = nullptr);
0046   SeedFilter(const SeedFilter<external_spacepoint_t>&) = delete;
0047   SeedFilter& operator=(const SeedFilter<external_spacepoint_t>&) = delete;
0048   SeedFilter(SeedFilter<external_spacepoint_t>&&) noexcept = default;
0049   SeedFilter& operator=(SeedFilter<external_spacepoint_t>&&) noexcept = default;
0050 
0051   SeedFilter() = delete;
0052   ~SeedFilter() = default;
0053 
0054   /// Create Seeds for the all seeds with the same bottom and middle
0055   /// space point and discard all others.
0056   /// @param mutableData Container for mutable variables used in the seeding
0057   /// @param bottomSP fixed bottom space point
0058   /// @param middleSP fixed middle space point
0059   /// @param topSpVec vector containing all space points that may be compatible
0060   ///                 with both bottom and middle space point
0061   /// @param invHelixDiameterVec vector containing 1/(2*r) values where r is the helix radius
0062   /// @param impactParametersVec vector containing the impact parameters
0063   /// @param seedFilterState holds quantities used in seed filter
0064   /// @param candidates_collector container for the seed candidates
0065   void filterSeeds_2SpFixed(
0066       const Acts::SpacePointMutableData& mutableData,
0067       const external_spacepoint_t& bottomSP,
0068       const external_spacepoint_t& middleSP,
0069       const std::vector<const external_spacepoint_t*>& topSpVec,
0070       const std::vector<float>& invHelixDiameterVec,
0071       const std::vector<float>& impactParametersVec,
0072       SeedFilterState& seedFilterState,
0073       CandidatesForMiddleSp<const external_spacepoint_t>& candidates_collector)
0074       const;
0075 
0076   /// Filter seeds once all seeds for one middle space point have been created
0077   /// @param mutableData Container for mutable variables used in the seeding
0078   /// @param candidates_collector collection of seed candidates
0079   /// @param outputCollection Output container for the seeds
0080   /// for all seeds with the same middle space point
0081   template <typename collection_t>
0082   void filterSeeds_1SpFixed(
0083       Acts::SpacePointMutableData& mutableData,
0084       CandidatesForMiddleSp<const external_spacepoint_t>& candidates_collector,
0085       collection_t& outputCollection) const;
0086 
0087   /// Filter seeds once all seeds for one middle space point have been created
0088   /// @param mutableData Container for mutable variables used in the seeding
0089   /// @param candidates collection of seed candidates
0090   /// @param numQualitySeeds number of high quality seeds in seed confirmation
0091   /// @param outputCollection Output container for the seeds
0092   /// for all seeds with the same middle space point
0093   template <typename collection_t>
0094   void filterSeeds_1SpFixed(
0095       Acts::SpacePointMutableData& mutableData,
0096       std::vector<typename CandidatesForMiddleSp<
0097           const external_spacepoint_t>::value_type>& candidates,
0098       const std::size_t numQualitySeeds, collection_t& outputCollection) const;
0099 
0100   const SeedFilterConfig getSeedFilterConfig() const { return m_cfg; }
0101   const IExperimentCuts<external_spacepoint_t>* getExperimentCuts() const {
0102     return m_experimentCuts;
0103   }
0104 
0105  private:
0106   const Logger& logger() const { return *m_logger; }
0107 
0108   const SeedFilterConfig m_cfg;
0109   std::unique_ptr<const Acts::Logger> m_logger =
0110       Acts::getDefaultLogger("Filter", Logging::Level::INFO);
0111   const IExperimentCuts<external_spacepoint_t>* m_experimentCuts;
0112 };
0113 }  // namespace Acts
0114 #include "Acts/Seeding/SeedFilter.ipp"