|
|
|||
File indexing completed on 2026-03-28 07:45:25
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/Definitions/Units.hpp" 0012 #include "Acts/EventData/SeedContainer2.hpp" 0013 #include "Acts/EventData/SpacePointContainer2.hpp" 0014 #include "Acts/Seeding2/GbtsDataStorage.hpp" 0015 #include "Acts/Seeding2/GbtsGeometry.hpp" 0016 #include "Acts/Seeding2/GbtsRoiDescriptor.hpp" 0017 #include "Acts/Seeding2/GbtsTrackingFilter.hpp" 0018 #include "Acts/Utilities/Logger.hpp" 0019 0020 #include <cstdint> 0021 #include <memory> 0022 #include <string> 0023 #include <utility> 0024 #include <vector> 0025 0026 namespace Acts::Experimental { 0027 0028 /// Seed finder implementing the GBTS seeding workflow. 0029 class GraphBasedTrackSeeder { 0030 public: 0031 /// Configuration struct for the GBTS seeding algorithm. 0032 struct Config { 0033 // GbtsSeedingAlgorithm options 0034 /// Enable beam spot correction. 0035 bool beamSpotCorrection = false; 0036 0037 // Path to the connector configuration file that defines the layer 0038 // connections 0039 /// Connector configuration file path. 0040 std::string connectorInputFile; 0041 0042 /// Look-up table input file path. 0043 std::string lutInputFile; 0044 0045 // SeedFinderGbts option 0046 /// Enable Large Radius Tracking mode. 0047 bool lrtMode = false; 0048 /// Use machine learning features (e.g., cluster width). 0049 bool useMl = false; 0050 /// Match seeds before creating them. 0051 bool matchBeforeCreate = false; 0052 /// Use legacy tuning parameters. 0053 bool useOldTunings = false; 0054 /// Tau ratio cut threshold. 0055 float tauRatioCut = 0.007; 0056 /// Tau ratio precut threshold. 0057 float tauRatioPrecut = 0.009f; 0058 /// Eta bin width override (0 uses default from connection file). 0059 // specify non-zero to override eta bin width from connection file (default 0060 // 0.2 in createLinkingScheme.py) 0061 float etaBinWidthOverride = 0.0f; 0062 0063 /// Maximum number of phi slices. 0064 float nMaxPhiSlice = 53; // used to calculate phi slices 0065 /// Minimum transverse momentum. 0066 float minPt = 1.0f * UnitConstants::GeV; 0067 0068 // graph building options 0069 /// Transverse momentum coefficient (~0.3*B/2 - assumes nominal field of 0070 /// 2*T). 0071 double ptCoeff = 0.29997 * 1.9972 / 2.0; 0072 /// Use eta binning from geometry structure. 0073 bool useEtaBinning = true; 0074 /// Apply RZ cuts on doublets. 0075 bool doubletFilterRZ = true; 0076 /// Maximum number of Gbts edges/doublets. 0077 std::uint32_t nMaxEdges = 2000000; 0078 /// Minimum delta radius between layers. 0079 float minDeltaRadius = 2.0; 0080 0081 // Seed extraction options 0082 /// Minimum eta for edge masking. 0083 float edgeMaskMinEta = 1.5; 0084 /// Threshold for hit sharing between seeds. 0085 float hitShareThreshold = 0.49; 0086 0087 // GbtsDataStorage options 0088 /// Maximum endcap cluster width. 0089 float maxEndcapClusterWidth = 0.35; 0090 }; 0091 0092 /// Derived configuration struct that contains calculated parameters based on 0093 /// the configuration. 0094 struct DerivedConfig : public Config { 0095 /// Construct derived configuration from base configuration. 0096 /// @param config Base configuration to derive from 0097 explicit DerivedConfig(const Config& config); 0098 0099 /// Phi slice width 0100 float phiSliceWidth = std::numeric_limits<float>::quiet_NaN(); 0101 }; 0102 0103 /// Seed metadata produced by the GBTS algorithm. 0104 struct SeedProperties { 0105 /// Constructor. 0106 /// @param quality Seed quality score 0107 /// @param clone Clone flag 0108 /// @param sps Space point indices 0109 SeedProperties(float quality, std::int32_t clone, 0110 std::vector<std::uint32_t> sps) 0111 : seedQuality(quality), isClone(clone), spacePoints(std::move(sps)) {} 0112 0113 /// Seed quality score. 0114 float seedQuality{}; 0115 /// Clone flag. 0116 std::int32_t isClone{}; 0117 /// Space point indices. 0118 std::vector<std::uint32_t> spacePoints; 0119 0120 /// Comparison operator. 0121 /// @param o Other seed properties to compare 0122 /// @return True if this is less than other 0123 auto operator<=>(const SeedProperties& o) const = default; 0124 }; 0125 0126 /// Sliding window in phi used to define range used for edge creation 0127 struct SlidingWindow { 0128 /// sliding window position 0129 std::uint32_t firstIt{}; 0130 /// window half-width; 0131 float deltaPhi{}; 0132 /// active or not 0133 bool hasNodes{}; 0134 /// associated eta bin 0135 const GbtsEtaBin* bin{}; 0136 }; 0137 0138 /// Constructor. 0139 /// @param config Configuration for the seed finder 0140 /// @param geometry GBTS geometry 0141 /// @param logger Logging instance 0142 GraphBasedTrackSeeder(const DerivedConfig& config, 0143 std::shared_ptr<GbtsGeometry> geometry, 0144 std::unique_ptr<const Acts::Logger> logger = 0145 Acts::getDefaultLogger("Finder", 0146 Acts::Logging::Level::INFO)); 0147 0148 /// Create seeds from space points in a region of interest. 0149 /// @param spacePoints Space point container 0150 /// @param roi Region of interest descriptor 0151 /// @param maxLayers Maximum number of layers 0152 /// @param filter Tracking filter to be applied 0153 /// @return Container with generated seeds 0154 SeedContainer2 createSeeds(const SpacePointContainer2& spacePoints, 0155 const GbtsRoiDescriptor& roi, 0156 std::uint32_t maxLayers, 0157 const GbtsTrackingFilter& filter) const; 0158 0159 private: 0160 DerivedConfig m_cfg; 0161 0162 std::shared_ptr<const GbtsGeometry> m_geometry; 0163 0164 GbtsMlLookupTable m_mlLut; 0165 0166 std::unique_ptr<const Acts::Logger> m_logger = 0167 Acts::getDefaultLogger("Finder", Acts::Logging::Level::INFO); 0168 0169 const Acts::Logger& logger() const { return *m_logger; } 0170 0171 /// Create graph nodes from space points. 0172 /// @param spacePoints Space point container 0173 /// @param maxLayers Maximum number of layers 0174 /// @return Vector of node vectors organized by layer 0175 std::vector<std::vector<GbtsNode>> createNodes( 0176 const SpacePointContainer2& spacePoints, std::uint32_t maxLayers) const; 0177 0178 /// Parse machine learning lookup table from file. 0179 /// @param lutInputFile Path to the lookup table input file 0180 /// @return Parsed machine learning lookup table 0181 GbtsMlLookupTable parseGbtsMlLookupTable(const std::string& lutInputFile); 0182 0183 /// Build doublet graph from nodes. 0184 /// @param roi Region of interest descriptor 0185 /// @param nodeStorage Data storage containing nodes 0186 /// @param edgeStorage Storage for generated edges 0187 /// @return Pair of edge count and maximum level 0188 std::pair<std::int32_t, std::int32_t> buildTheGraph( 0189 const GbtsRoiDescriptor& roi, GbtsNodeStorage& nodeStorage, 0190 std::vector<GbtsEdge>& edgeStorage) const; 0191 0192 /// Run connected component analysis on the graph. 0193 /// @param nEdges Number of edges in the graph 0194 /// @param edgeStorage Storage containing graph edges 0195 /// @return Number of connected components found 0196 std::int32_t runCCA(std::uint32_t nEdges, 0197 std::vector<GbtsEdge>& edgeStorage) const; 0198 0199 /// Extract seed candidates from the graph. 0200 /// @param maxLevel Maximum level in the graph 0201 /// @param nEdges Number of edges 0202 /// @param nHits Number of hits 0203 /// @param edgeStorage Storage containing edges 0204 /// @param vSeedCandidates Output vector for seed candidates 0205 /// @param filter Tracking filter to be applied 0206 void extractSeedsFromTheGraph(std::uint32_t maxLevel, std::uint32_t nEdges, 0207 std::int32_t nHits, 0208 std::vector<GbtsEdge>& edgeStorage, 0209 std::vector<SeedProperties>& vSeedCandidates, 0210 const GbtsTrackingFilter& filter) const; 0211 0212 /// Check to see if z0 of segment is within the expected z range of the 0213 /// beamspot 0214 /// @param z0BitMask Sets allowed bins of allowed z value 0215 /// @param z0 Estimated z0 of segments z value at beamspot 0216 /// @param minZ0 Minimum value of beam spot z coordinate 0217 /// @param z0HistoCoeff Scalfactor that converts z coodindate into bin index 0218 /// @return Whether segment is within beamspot range 0219 bool checkZ0BitMask(std::uint16_t z0BitMask, float z0, float minZ0, 0220 float z0HistoCoeff) const; 0221 }; 0222 0223 } // 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 |
|