Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-13 09:39:02

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/SpacePointMutableData.hpp"
0012 #include "Acts/Seeding/CandidatesForMiddleSp.hpp"
0013 #include "Acts/Seeding/IExperimentCuts.hpp"
0014 #include "Acts/Seeding/SeedFilterConfig.hpp"
0015 #include "Acts/Utilities/Logger.hpp"
0016 
0017 #include <memory>
0018 #include <vector>
0019 
0020 namespace Acts {
0021 
0022 struct SeedFilterState {
0023   // longitudinal impact parameter as defined by bottom and middle space point
0024   float zOrigin = 0;
0025   // number of minimum top SPs in seed confirmation
0026   std::size_t nTopSeedConf = 0;
0027   // radius of bottom component of seed that is used to define the number of
0028   // compatible top required
0029   float rMaxSeedConf = std::numeric_limits<float>::max();  // UnitConstants::mm
0030 };
0031 
0032 /// Filter seeds at various stages with the currently
0033 /// available information.
0034 template <typename external_spacepoint_t>
0035 class SeedFilter final {
0036  public:
0037   /// Constructor with configuration and optional experimental cuts
0038   /// @param config Seed filter configuration
0039   /// @param expCuts Optional experimental cuts (defaults to nullptr)
0040   explicit SeedFilter(
0041       const SeedFilterConfig& config,
0042       IExperimentCuts<external_spacepoint_t>* expCuts = nullptr);
0043   /// Constructor with configuration, logger, and optional experimental cuts
0044   /// @param config Seed filter configuration
0045   /// @param logger Logger for output messages
0046   /// @param expCuts Optional experimental cuts (defaults to nullptr)
0047   explicit SeedFilter(
0048       const SeedFilterConfig& config, std::unique_ptr<const Logger> logger,
0049       IExperimentCuts<external_spacepoint_t>* expCuts = nullptr);
0050 
0051   /// Create Seeds for the all seeds with the same bottom and middle
0052   /// space point and discard all others.
0053   /// @param mutableData Container for mutable variables used in the seeding
0054   /// @param bottomSp fixed bottom space point
0055   /// @param middleSp fixed middle space point
0056   /// @param topSpVec vector containing all space points that may be compatible
0057   ///                 with both bottom and middle space point
0058   /// @param invHelixDiameterVec vector containing 1/(2*r) values where r is the helix radius
0059   /// @param impactParametersVec vector containing the impact parameters
0060   /// @param seedFilterState holds quantities used in seed filter
0061   /// @param candidatesCollector container for the seed candidates
0062   void filterSeeds_2SpFixed(
0063       const SpacePointMutableData& mutableData,
0064       const external_spacepoint_t& bottomSp,
0065       const external_spacepoint_t& middleSp,
0066       const std::vector<const external_spacepoint_t*>& topSpVec,
0067       const std::vector<float>& invHelixDiameterVec,
0068       const std::vector<float>& impactParametersVec,
0069       SeedFilterState& seedFilterState,
0070       CandidatesForMiddleSp<const external_spacepoint_t>& candidatesCollector)
0071       const;
0072 
0073   /// Filter seeds once all seeds for one middle space point have been created
0074   /// @param mutableData Container for mutable variables used in the seeding
0075   /// @param candidatesCollector collection of seed candidates
0076   /// @param outputCollection Output container for the seeds
0077   /// for all seeds with the same middle space point
0078   template <typename collection_t>
0079   void filterSeeds_1SpFixed(
0080       SpacePointMutableData& mutableData,
0081       CandidatesForMiddleSp<const external_spacepoint_t>& candidatesCollector,
0082       collection_t& outputCollection) const;
0083 
0084   /// Filter seeds once all seeds for one middle space point have been created
0085   /// @param mutableData Container for mutable variables used in the seeding
0086   /// @param candidates collection of seed candidates
0087   /// @param numQualitySeeds number of high quality seeds in seed confirmation
0088   /// @param outputCollection Output container for the seeds
0089   /// for all seeds with the same middle space point
0090   template <typename collection_t>
0091   void filterSeeds_1SpFixed(
0092       SpacePointMutableData& mutableData,
0093       std::vector<typename CandidatesForMiddleSp<
0094           const external_spacepoint_t>::value_type>& candidates,
0095       const std::size_t numQualitySeeds, collection_t& outputCollection) const;
0096 
0097   /// Get the seed filter configuration
0098   /// @return Copy of the seed filter configuration
0099   const SeedFilterConfig getSeedFilterConfig() const { return m_cfg; }
0100   /// Get the experimental cuts pointer
0101   /// @return Pointer to experimental cuts (may be nullptr)
0102   const IExperimentCuts<external_spacepoint_t>* getExperimentCuts() const {
0103     return m_experimentCuts;
0104   }
0105 
0106  private:
0107   const Logger& logger() const { return *m_logger; }
0108 
0109   const SeedFilterConfig m_cfg;
0110   std::unique_ptr<const Logger> m_logger =
0111       getDefaultLogger("Filter", Logging::Level::INFO);
0112   const IExperimentCuts<external_spacepoint_t>* m_experimentCuts;
0113 };
0114 
0115 }  // namespace Acts
0116 
0117 #include "Acts/Seeding/SeedFilter.ipp"