Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-11 08:04:18

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2023 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/EventData/SpacePointData.hpp"
0012 #include "Acts/Seeding/CandidatesForMiddleSp.hpp"
0013 #include "Acts/Seeding/IExperimentCuts.hpp"
0014 #include "Acts/Seeding/InternalSeed.hpp"
0015 #include "Acts/Seeding/Seed.hpp"
0016 #include "Acts/Seeding/SeedFilterConfig.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(SeedFilterConfig config,
0042              IExperimentCuts<external_spacepoint_t>* expCuts = nullptr);
0043 
0044   SeedFilter() = delete;
0045   ~SeedFilter() = default;
0046 
0047   /// Create InternalSeeds for the all seeds with the same bottom and middle
0048   /// space point and discard all others.
0049   /// @param spacePointData Auxiliary variables used by the seeding
0050   /// @param bottomSP fixed bottom space point
0051   /// @param middleSP fixed middle space point
0052   /// @param topSpVec vector containing all space points that may be compatible
0053   ///                 with both bottom and middle space point
0054   /// @param invHelixDiameterVec vector containing 1/(2*r) values where r is the helix radius
0055   /// @param impactParametersVec vector containing the impact parameters
0056   /// @param seedFilterState holds quantities used in seed filter
0057   /// @param candidates_collector container for the seed candidates
0058   void filterSeeds_2SpFixed(
0059       Acts::SpacePointData& spacePointData,
0060       const InternalSpacePoint<external_spacepoint_t>& bottomSP,
0061       const InternalSpacePoint<external_spacepoint_t>& middleSP,
0062       const std::vector<const InternalSpacePoint<external_spacepoint_t>*>&
0063           topSpVec,
0064       const std::vector<float>& invHelixDiameterVec,
0065       const std::vector<float>& impactParametersVec,
0066       SeedFilterState& seedFilterState,
0067       CandidatesForMiddleSp<const InternalSpacePoint<external_spacepoint_t>>&
0068           candidates_collector) const;
0069 
0070   /// Filter seeds once all seeds for one middle space point have been created
0071   /// @param spacePointData Auxiliary variables used by the seeding
0072   /// @param candidates_collector collection of seed candidates
0073   /// @param outputCollection Output container for the seeds
0074   /// for all seeds with the same middle space point
0075   template <typename collection_t>
0076   void filterSeeds_1SpFixed(
0077       Acts::SpacePointData& spacePointData,
0078       CandidatesForMiddleSp<const InternalSpacePoint<external_spacepoint_t>>&
0079           candidates_collector,
0080       collection_t& outputCollection) const;
0081 
0082   /// Filter seeds once all seeds for one middle space point have been created
0083   /// @param spacePointData Auxiliary variables used by the seeding
0084   /// @param candidates collection of seed candidates
0085   /// @param numQualitySeeds number of high quality seeds in seed confirmation
0086   /// @param outputCollection Output container for the seeds
0087   /// for all seeds with the same middle space point
0088   template <typename collection_t>
0089   void filterSeeds_1SpFixed(
0090       Acts::SpacePointData& spacePointData,
0091       std::vector<typename CandidatesForMiddleSp<
0092           const InternalSpacePoint<external_spacepoint_t>>::value_type>&
0093           candidates,
0094       const std::size_t numQualitySeeds, collection_t& outputCollection) const;
0095 
0096   const SeedFilterConfig getSeedFilterConfig() const { return m_cfg; }
0097   const IExperimentCuts<external_spacepoint_t>* getExperimentCuts() const {
0098     return m_experimentCuts;
0099   }
0100 
0101  private:
0102   const SeedFilterConfig m_cfg;
0103   const IExperimentCuts<external_spacepoint_t>* m_experimentCuts;
0104 };
0105 }  // namespace Acts
0106 #include "Acts/Seeding/SeedFilter.ipp"