|
|
|||
Warning, file /acts/Core/include/Acts/Seeding/GraphBasedTrackSeeder.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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/SeedContainer.hpp" 0013 #include "Acts/EventData/SpacePointContainer.hpp" 0014 #include "Acts/Seeding/GbtsDataStorage.hpp" 0015 #include "Acts/Seeding/GbtsGeometry.hpp" 0016 #include "Acts/Seeding/GbtsRoiDescriptor.hpp" 0017 #include "Acts/Seeding/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 /// optional validation for abrrel triplets 0055 bool validateTriplets = true; 0056 /// widens allowed variation in tau ratio 0057 /// if layer is missed in edge connecting 0058 bool useAdaptiveCuts = true; 0059 /// optionally add 3 sp seeds within a cirtain eta range 0060 bool addTriplets = false; 0061 /// Tau ratio cut threshold. 0062 float tauRatioCut = 0.007; 0063 /// Tau ratio precut threshold. 0064 float tauRatioPrecut = 0.009f; 0065 /// correction applied to tau acceptance 0066 /// if a layer is missed during edge connecting 0067 float tauRatioCorr = 0.006; 0068 /// the maximum allowed eta value in which 0069 /// three spacepoint seeds are passed through 0070 float maxAbsEtaAddTripelts = 1.5; 0071 /// Eta bin width override (0 uses default from connection file). 0072 /// specify non-zero to override eta bin width from connection file (default 0073 /// 0.2 in createLinkingScheme.py) 0074 float etaBinWidthOverride = 0.0f; 0075 0076 /// Maximum number of phi slices. 0077 float nMaxPhiSlice = 53; // used to calculate phi slices 0078 /// Minimum transverse momentum. 0079 float minPt = 1.0f * UnitConstants::GeV; 0080 0081 // graph building options 0082 /// Use eta binning from geometry structure. 0083 bool useEtaBinning = true; 0084 /// Apply RZ cuts on doublets. 0085 bool doubletFilterRZ = true; 0086 /// Maximum number of Gbts edges/doublets. 0087 std::uint32_t nMaxEdges = 2000000; 0088 /// Minimum delta radius between layers. 0089 float minDeltaRadius = 2.0 * Acts::UnitConstants::mm; 0090 /// Maximum d0 impact parameter when validating edge connection triplet 0091 float d0Max = 3.0 * UnitConstants::mm; 0092 /// Maximum difference in allowed tangent between candidate edge connection 0093 float cutDPhiMax = 0.012f; 0094 /// Maximum allowed curvature tolerance for candidate edge connections 0095 float cutDCurvMax = 0.001f; 0096 /// Minimum z0 value, set as optionl as if in pixel mode, 0097 /// The value is picked from the ROI 0098 float minZ0 = -600; 0099 /// Minimum z0 value, set as optionl as if in pixel mode, 0100 /// The value is picked from the ROI 0101 float maxZ0 = 600; 0102 /// When old tunings are used, this defines the minimum phi window used 0103 float minDeltaPhi = 0.001f; 0104 /// Maximum radius of pixel detector 0105 float maxOuterRadius = 550.0f; 0106 0107 // Seed extraction options 0108 /// Minimum eta for edge masking. 0109 float edgeMaskMinEta = 1.5; 0110 /// Threshold for hit sharing between seeds. 0111 float hitShareThreshold = 0.49; 0112 /// Max seed eta value considered for splitting. 0113 float maxSeedSplitEta = 0.6; 0114 /// Max allowed curvature for seed self consistency check. 0115 float maxInvRadDiff = 0.7e-2 / UnitConstants::m; 0116 // GbtsDataStorage options 0117 /// Maximum endcap cluster width. 0118 float maxEndcapClusterWidth = 0.35 * Acts::UnitConstants::mm; 0119 }; 0120 0121 /// Derived configuration struct that contains calculated parameters based on 0122 /// the configuration. 0123 struct DerivedConfig : public Config { 0124 /// Construct derived configuration from base configuration. 0125 /// @param config Base configuration to derive from 0126 explicit DerivedConfig(const Config& config); 0127 0128 /// Phi slice width 0129 float phiSliceWidth = std::numeric_limits<float>::quiet_NaN(); 0130 }; 0131 0132 /// Optional inputs for variables passed in 0133 /// or derived during runtime. 0134 struct Options { 0135 /// @param bFieldInZ_ the magnetic field in z 0136 explicit Options(float bFieldInZ_); 0137 0138 /// Magnetic field in z 0139 /// units of GeV/(e*mm). 0140 float bFieldInZ{}; 0141 0142 /// Transverse momentum coefficient (~0.3*B/2 - assumes nominal field of 0143 /// 2*T). 0144 double ptCoeff{}; 0145 }; 0146 0147 /// candidate seed metadata produced by the GBTS algorithm. 0148 struct SeedCandidateProperties { 0149 /// @param quality Seed quality score 0150 /// @param clone Clone flag 0151 /// @param sps Vector of pointers to actual space points 0152 /// @param splitFlag used to flag if seed needs to be split in two 0153 SeedCandidateProperties(float quality, std::int32_t clone, 0154 std::vector<const GbtsNode*> sps, 0155 std::uint32_t splitFlag) 0156 : seedQuality(quality), 0157 isClone(clone), 0158 spacePoints(std::move(sps)), 0159 forSeedSplitting(splitFlag) {} 0160 0161 /// Seed quality score. 0162 float seedQuality{}; 0163 /// Clone flag. 0164 std::int32_t isClone{}; 0165 /// Space point indices. 0166 std::vector<const GbtsNode*> spacePoints; 0167 /// Flag for seed splitting. 0168 std::uint32_t forSeedSplitting{}; 0169 }; 0170 0171 /// Output seed metadata 0172 struct OutputSeedProperties { 0173 /// @param quality Seed quality score 0174 /// @param sps Vector of space point indices in the seed 0175 OutputSeedProperties(float quality, std::vector<std::uint32_t> sps) 0176 : seedQuality(quality), spacePoints(std::move(sps)) {} 0177 0178 /// Quality of seed. 0179 float seedQuality{}; 0180 /// Index of spacepoints in seed. 0181 std::vector<std::uint32_t> spacePoints; 0182 }; 0183 0184 /// Sliding window in phi used to define range used for edge creation 0185 struct SlidingWindow { 0186 /// sliding window position 0187 std::uint32_t firstIt{}; 0188 /// window half-width; 0189 float deltaPhi{}; 0190 /// active or not 0191 bool hasNodes{}; 0192 /// associated eta bin 0193 const GbtsEtaBin* bin{}; 0194 }; 0195 0196 /// @param config Configuration for the seed finder 0197 /// @param geometry GBTS geometry 0198 /// @param logger Logging instance 0199 GraphBasedTrackSeeder(const DerivedConfig& config, 0200 std::shared_ptr<GbtsGeometry> geometry, 0201 std::unique_ptr<const Acts::Logger> logger = 0202 Acts::getDefaultLogger("Finder", 0203 Acts::Logging::Level::INFO)); 0204 0205 /// Create seeds from space points in a region of interest. 0206 /// @param spacePoints Space point container 0207 /// @param roi Region of interest descriptor 0208 /// @param isPixelLayer Information on if a layer is pixel or strip 0209 /// @param maxLayers Maximum number of layers 0210 /// @param filter Tracking filter to be applied 0211 /// @param options Event based options such as magnetic field strength 0212 /// @param outputSeeds Container with generated seeds 0213 void createSeeds(const SpacePointContainer& spacePoints, 0214 const GbtsRoiDescriptor& roi, 0215 const std::vector<bool>& isPixelLayer, 0216 std::uint32_t maxLayers, const GbtsTrackingFilter& filter, 0217 const Options& options, SeedContainer& outputSeeds) const; 0218 0219 /// Create graph nodes from space points. 0220 /// @param spacePoints Space point container 0221 /// @param maxLayers Maximum number of layers 0222 /// @return Vector of node vectors organized by layer 0223 std::vector<std::vector<GbtsNode>> createNodes( 0224 const SpacePointContainer& spacePoints, std::uint32_t maxLayers) const; 0225 0226 /// Create seeds from space points in a region of interest. 0227 /// @param nodesPerLayer Vector of node vectors organized by layer 0228 /// @param isPixelLayer Information on if a layer is pixel or strip 0229 /// @param roi Region of interest descriptor 0230 /// @param filter Tracking filter to be applied 0231 /// @param options Event based options such as magnetic field strength 0232 /// @param outputSeeds Container with generated seeds 0233 void createSeeds(const std::vector<std::vector<GbtsNode>>& nodesPerLayer, 0234 const std::vector<bool>& isPixelLayer, 0235 const GbtsRoiDescriptor& roi, 0236 const GbtsTrackingFilter& filter, const Options& options, 0237 SeedContainer& outputSeeds) const; 0238 0239 private: 0240 DerivedConfig m_cfg; 0241 0242 std::shared_ptr<const GbtsGeometry> m_geometry; 0243 0244 GbtsMlLookupTable m_mlLut; 0245 0246 std::unique_ptr<const Acts::Logger> m_logger = 0247 Acts::getDefaultLogger("Finder", Acts::Logging::Level::INFO); 0248 0249 const Acts::Logger& logger() const { return *m_logger; } 0250 0251 /// Parse machine learning lookup table from file. 0252 /// @param lutInputFile Path to the lookup table input file 0253 /// @return Parsed machine learning lookup table 0254 GbtsMlLookupTable parseGbtsMlLookupTable(const std::string& lutInputFile); 0255 0256 /// Build doublet graph from nodes. 0257 /// @param roi Region of interest descriptor 0258 /// @param nodeStorage Data storage containing nodes 0259 /// @param edgeStorage Storage for generated edges 0260 /// @param options Event based options such as magnetic field strength 0261 /// @return Pair of edge count and maximum level 0262 std::pair<std::int32_t, std::int32_t> buildTheGraph( 0263 const GbtsRoiDescriptor& roi, GbtsNodeStorage& nodeStorage, 0264 std::vector<GbtsEdge>& edgeStorage, const Options& options) const; 0265 0266 /// Run connected component analysis on the graph. 0267 /// @param nEdges Number of edges in the graph 0268 /// @param edgeStorage Storage containing graph edges 0269 /// @return Number of connected components found 0270 std::int32_t runCCA(std::uint32_t nEdges, 0271 std::vector<GbtsEdge>& edgeStorage) const; 0272 0273 /// Extract seed candidates from the graph. 0274 /// @param maxLevel Maximum level in the graph 0275 /// @param nEdges Number of edges 0276 /// @param nHits Number of hits 0277 /// @param edgeStorage Storage containing edges 0278 /// @param vOutputSeeds Output vector for seed candidates 0279 /// @param filter Tracking filter to be applied 0280 void extractSeedsFromTheGraph(std::uint32_t maxLevel, std::uint32_t nEdges, 0281 std::int32_t nHits, 0282 std::vector<GbtsEdge>& edgeStorage, 0283 std::vector<OutputSeedProperties>& vOutputSeeds, 0284 const GbtsTrackingFilter& filter) const; 0285 0286 /// Check to see if z0 of segment is within the expected z range of the 0287 /// beamspot 0288 /// @param z0BitMask Sets allowed bins of allowed z value 0289 /// @param z0 Estimated z0 of segments z value at beamspot 0290 /// @param minZ0 Minimum value of beam spot z coordinate 0291 /// @param z0HistoCoeff Scalfactor that converts z coodindate into bin index 0292 /// @return Whether segment is within beamspot range 0293 bool checkZ0BitMask(std::uint16_t z0BitMask, float z0, float minZ0, 0294 float z0HistoCoeff) const; 0295 0296 float estimateCurvature(const std::array<const GbtsNode*, 3>& nodes) const; 0297 0298 bool validateTriplet(const std::array<const GbtsNode*, 3> candidateTriplet, 0299 float tripletMinPt, float tauRatio, float tauRatioCut, 0300 const Options& options) const; 0301 }; 0302 0303 } // 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 |
|