![]() |
|
|||
File indexing completed on 2025-07-12 07:51:39
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/SeedContainer2.hpp" 0012 #include "Acts/EventData/SpacePointContainer2.hpp" 0013 #include "Acts/Seeding2/BroadTripletSeedFilter.hpp" 0014 #include "Acts/Seeding2/DoubletSeedFinder.hpp" 0015 #include "Acts/Seeding2/detail/CandidatesForMiddleSp2.hpp" 0016 #include "Acts/Utilities/Logger.hpp" 0017 0018 #include <cstdint> 0019 #include <vector> 0020 0021 namespace Acts::Experimental { 0022 0023 /// @brief Triplet seeding algorithm front-end 0024 /// 0025 /// This class implements the triplet seeding algorithm, which is typical 0026 /// procedure to find track seeds using space points in a cylindrical detector. 0027 /// It is designed to be fast, flexible, and configurable. 0028 /// 0029 /// The algorithm works by first finding compatible doublets of space points, 0030 /// two space points that can be connected by a track coming from the 0031 /// interaction region, and then forming triplets by combinding these 0032 /// doublets at a common middle space point. The triplets are then filtered 0033 /// using a seed filter to produce a set of track seeds. 0034 /// 0035 /// Note that this algorithm is designed and tuned for cylindrical detectors and 0036 /// uses R-Z coordinates for the space points. 0037 class BroadTripletSeedFinder { 0038 public: 0039 struct Options { 0040 float bFieldInZ = 2 * UnitConstants::T; 0041 0042 /// Delegates for accessors to detailed information on double measurement 0043 /// that produced the space point. This is mainly referring to space points 0044 /// produced when combining measurement from strips on back-to-back modules. 0045 /// Enables setting of the following delegates. 0046 bool useStripMeasurementInfo = false; 0047 }; 0048 0049 struct TripletCuts { 0050 /// Minimum transverse momentum (pT) used to check the r-z slope 0051 /// compatibility of triplets with maximum multiple scattering effect 0052 /// (produced by the minimum allowed pT particle) + a certain uncertainty 0053 /// term. Check the documentation for more information 0054 /// https://acts.readthedocs.io/en/latest/core/reconstruction/pattern_recognition/seeding.html 0055 float minPt = 400 * UnitConstants::MeV; 0056 /// Number of sigmas of scattering angle to be considered in the minimum pT 0057 /// scattering term 0058 float sigmaScattering = 5; 0059 /// Term that accounts for the thickness of scattering medium in radiation 0060 /// lengths in the Lynch & Dahl correction to the Highland equation default 0061 /// is 5% 0062 float radLengthPerSeed = 0.05; 0063 /// Maximum transverse momentum for scattering calculation 0064 float maxPtScattering = 10 * UnitConstants::GeV; 0065 /// Maximum value of impact parameter estimation of the seed candidates 0066 float impactMax = 20 * UnitConstants::mm; 0067 /// Parameter which can loosen the tolerance of the track seed to form a 0068 /// helix. This is useful for e.g. misaligned seeding. 0069 float helixCutTolerance = 1; 0070 0071 /// Tolerance parameter used to check the compatibility of space-point 0072 /// coordinates in xyz. This is only used in a detector specific check for 0073 /// strip modules 0074 float toleranceParam = 1.1 * UnitConstants::mm; 0075 }; 0076 0077 struct DerivedTripletCuts : public TripletCuts { 0078 DerivedTripletCuts(const TripletCuts& cuts, float bFieldInZ); 0079 0080 float bFieldInZ = 0; 0081 float highland = 0; 0082 float pTPerHelixRadius = std::numeric_limits<float>::quiet_NaN(); 0083 float minHelixDiameter2 = std::numeric_limits<float>::quiet_NaN(); 0084 float sigmapT2perRadius = std::numeric_limits<float>::quiet_NaN(); 0085 float multipleScattering2 = std::numeric_limits<float>::quiet_NaN(); 0086 }; 0087 0088 struct TripletCache { 0089 std::vector<std::uint32_t> sortedBottoms; 0090 std::vector<std::uint32_t> sortedTops; 0091 }; 0092 0093 struct TripletTopCandidates { 0094 std::vector<SpacePointIndex2> topSpacePoints; 0095 std::vector<float> curvatures; 0096 std::vector<float> impactParameters; 0097 0098 std::size_t size() const { return topSpacePoints.size(); } 0099 0100 void resize(std::size_t size) { 0101 topSpacePoints.resize(size); 0102 curvatures.resize(size); 0103 impactParameters.resize(size); 0104 } 0105 0106 void clear() { 0107 topSpacePoints.clear(); 0108 curvatures.clear(); 0109 impactParameters.clear(); 0110 } 0111 0112 void emplace_back(SpacePointIndex2 spT, float curvature, 0113 float impactParameter) { 0114 topSpacePoints.emplace_back(spT); 0115 curvatures.emplace_back(curvature); 0116 impactParameters.emplace_back(impactParameter); 0117 } 0118 }; 0119 0120 struct Cache { 0121 std::vector<std::size_t> bottomSpOffsets; 0122 std::vector<std::size_t> topSpOffsets; 0123 0124 DoubletSeedFinder::DoubletsForMiddleSp bottomDoublets; 0125 DoubletSeedFinder::DoubletsForMiddleSp topDoublets; 0126 0127 TripletCache tripletCache; 0128 TripletTopCandidates tripletTopCandidates; 0129 0130 BroadTripletSeedFilter::Cache filter; 0131 0132 CandidatesForMiddleSp2 candidatesCollector; 0133 std::vector<TripletCandidate2> sortedCandidates; 0134 }; 0135 0136 struct State { 0137 BroadTripletSeedFilter::State filter; 0138 }; 0139 0140 explicit BroadTripletSeedFinder(std::unique_ptr<const Logger> logger = 0141 getDefaultLogger("BroadTripletSeedFinder", 0142 Logging::Level::INFO)); 0143 0144 /// Create all possible seeds from bottom, middle, and top space points. No 0145 /// assumptions on the order of the space points are made. 0146 /// 0147 /// @param options Configuration options for the seed finder 0148 /// @param state State of the seed finder 0149 /// @param cache Cache object to store intermediate results 0150 /// @param bottomFinder Finder for bottom doublets 0151 /// @param topFinder Finder for top doublets 0152 /// @param tripletCuts Derived cuts for the triplet space points 0153 /// @param filter Triplet seed filter that defines the filtering criteria 0154 /// @param spacePoints Space point container 0155 /// @param bottomSps Group of space points to be used as innermost SP in a seed 0156 /// @param middleSp Space point candidate to be used as middle SP in a seed 0157 /// @param topSps Group of space points to be used as outermost SP in a seed 0158 /// @param outputSeeds Output container for the seeds 0159 void createSeedsFromGroup(const Options& options, State& state, Cache& cache, 0160 const DoubletSeedFinder& bottomFinder, 0161 const DoubletSeedFinder& topFinder, 0162 const DerivedTripletCuts& tripletCuts, 0163 const BroadTripletSeedFilter& filter, 0164 const SpacePointContainer2& spacePoints, 0165 std::span<const SpacePointIndex2> bottomSps, 0166 SpacePointIndex2 middleSp, 0167 std::span<const SpacePointIndex2> topSps, 0168 SeedContainer2& outputSeeds) const; 0169 0170 /// Create all possible seeds from bottom, middle, and top space points. This 0171 /// requires all space points within their groups to be sorted by radius. 0172 /// 0173 /// @param options Configuration options for the seed finder 0174 /// @param state State of the seed finder 0175 /// @param cache Cache object to store intermediate results 0176 /// @param bottomFinder Finder for bottom doublets 0177 /// @param topFinder Finder for top doublets 0178 /// @param tripletCuts Derived cuts for the triplet space points 0179 /// @param filter Triplet seed filter that defines the filtering criteria 0180 /// @param spacePoints Space point container 0181 /// @param bottomSpGroups Groups of space points to be used as innermost SP in a seed 0182 /// @param middleSps Group of space points to be used as middle SP in a seed 0183 /// @param topSpGroups Groups of space points to be used as outermost SP in a seed 0184 /// @param radiusRangeForMiddle Range of radii for the middle space points 0185 /// @param outputSeeds Output container for the seeds 0186 void createSeedsFromSortedGroups( 0187 const Options& options, State& state, Cache& cache, 0188 const DoubletSeedFinder& bottomFinder, const DoubletSeedFinder& topFinder, 0189 const DerivedTripletCuts& tripletCuts, 0190 const BroadTripletSeedFilter& filter, 0191 const SpacePointContainer2& spacePoints, 0192 const std::vector<std::span<const SpacePointIndex2>>& bottomSpGroups, 0193 std::span<const SpacePointIndex2> middleSps, 0194 const std::vector<std::span<const SpacePointIndex2>>& topSpGroups, 0195 const std::pair<float, float>& radiusRangeForMiddle, 0196 SeedContainer2& outputSeeds) const; 0197 0198 private: 0199 std::unique_ptr<const Logger> m_logger; 0200 0201 const Logger& logger() const { return *m_logger; } 0202 0203 /// Create triplets from the bottom, middle, and top space points. 0204 /// 0205 /// @param cache Cache object to store intermediate results 0206 /// @param cuts Triplet cuts that define the compatibility of space points 0207 /// @param rMaxSeedConf Maximum radius of bottom space point to use seed confirmation 0208 /// @param filter Triplet seed filter that defines the filtering criteria 0209 /// @param filterState State object that holds the state of the filter 0210 /// @param filterCache Cache object that holds memory used in SeedFilter 0211 /// @param spacePoints Space point container 0212 /// @param spM Space point candidate to be used as middle SP in a seed 0213 /// @param bottomDoublets Bottom doublets to be used for triplet creation 0214 /// @param topDoublets Top doublets to be used for triplet creation 0215 /// @param tripletTopCandidates Cache for triplet top candidates 0216 /// @param candidatesCollector Collector for candidates for middle space points 0217 static void createTriplets( 0218 TripletCache& cache, const DerivedTripletCuts& cuts, float rMaxSeedConf, 0219 const BroadTripletSeedFilter& filter, 0220 BroadTripletSeedFilter::State& filterState, 0221 BroadTripletSeedFilter::Cache& filterCache, 0222 const SpacePointContainer2& spacePoints, const ConstSpacePointProxy2& spM, 0223 const DoubletSeedFinder::DoubletsForMiddleSp& bottomDoublets, 0224 const DoubletSeedFinder::DoubletsForMiddleSp& topDoublets, 0225 TripletTopCandidates& tripletTopCandidates, 0226 CandidatesForMiddleSp2& candidatesCollector); 0227 0228 /// Create triplets from the bottom, middle, and top space points. 0229 /// 0230 /// @param cuts Triplet cuts that define the compatibility of space points 0231 /// @param rMaxSeedConf Maximum radius of bottom space point to use seed confirmation 0232 /// @param filter Triplet seed filter that defines the filtering criteria 0233 /// @param filterState State object that holds the state of the filter 0234 /// @param filterCache Cache object that holds memory used in SeedFilter 0235 /// @param spacePoints Space point container 0236 /// @param spM Space point candidate to be used as middle SP in a seed 0237 /// @param bottomDoublets Bottom doublets to be used for triplet creation 0238 /// @param topDoublets Top doublets to be used for triplet creation 0239 /// @param tripletTopCandidates Cache for triplet top candidates 0240 /// @param candidatesCollector Collector for candidates for middle space points 0241 static void createStripTriplets( 0242 const DerivedTripletCuts& cuts, float rMaxSeedConf, 0243 const BroadTripletSeedFilter& filter, 0244 BroadTripletSeedFilter::State& filterState, 0245 BroadTripletSeedFilter::Cache& filterCache, 0246 const SpacePointContainer2& spacePoints, const ConstSpacePointProxy2& spM, 0247 const DoubletSeedFinder::DoubletsForMiddleSp& bottomDoublets, 0248 const DoubletSeedFinder::DoubletsForMiddleSp& topDoublets, 0249 TripletTopCandidates& tripletTopCandidates, 0250 CandidatesForMiddleSp2& candidatesCollector); 0251 }; 0252 0253 } // namespace Acts::Experimental
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |