Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Core/include/Acts/Seeding/GbtsGraphBuilder.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/Seeding/GbtsGeometry.hpp"
0013 #include "Acts/Seeding/GbtsLayerDescription.hpp"
0014 #include "Acts/Seeding/GbtsNodeStorage.hpp"
0015 #include "Acts/Seeding/GbtsRoiDescriptor.hpp"
0016 #include "Acts/Seeding/detail/GbtsGraphTypes.hpp"
0017 #include "Acts/Utilities/Logger.hpp"
0018 
0019 #include <cstdint>
0020 #include <memory>
0021 #include <utility>
0022 #include <vector>
0023 
0024 namespace Acts::Experimental {
0025 
0026 /// The doublet graph of the GBTS workflow, as built by `GbtsGraphBuilder`.
0027 struct GbtsGraph {
0028   /// The graph edges, i.e. the doublets.
0029   std::vector<detail::GbtsEdge> edgeStorage;
0030 
0031   /// Number of links between edges.
0032   std::uint32_t nConnections = 0;
0033 
0034   /// Run connected component analysis on the graph, updating the edge levels.
0035   /// @param maxIterations Maximum number of connected-component iterations
0036   /// @return The highest chain level any edge reached
0037   std::uint32_t runCCA(std::uint32_t maxIterations);
0038 
0039   /// extract edges that start a chain
0040   /// @param minSeedLevel Chain length a seed candidate must reach
0041   /// @param addTriplets Accept chains one level short within
0042   ///        `maxAbsEtaAddTriplets`
0043   /// @param maxAbsEtaAddTriplets The maximum |eta| at which `addTriplets`
0044   ///        applies
0045   /// @return The edges that start chains, ordered by length of chain, empty
0046   ///         if no chain reached the required level
0047   std::vector<detail::GbtsEdge*> extractChainHeads(std::uint8_t minSeedLevel,
0048                                                    bool addTriplets,
0049                                                    float maxAbsEtaAddTriplets);
0050 };
0051 
0052 /// Builds the doublet graph of the GBTS workflow.
0053 ///
0054 /// Turns a finalized `GbtsNodeStorage` into a graph whose edges are doublets
0055 /// and whose links are the doublet pairs that a triplet cut accepted.
0056 /// `GraphBasedTrackSeeder` grows chain levels over those links with
0057 /// `GbtsGraph::runCCA` and walks the result to produce seeds.
0058 ///
0059 /// The phi binning is the node storage's, so the sliding windows and the
0060 /// indexing they slide over cannot disagree.
0061 class GbtsGraphBuilder {
0062  public:
0063   /// Config for the prompt graph
0064   struct Config {
0065     /// Match seeds before creating them.
0066     bool matchBeforeCreate = false;
0067 
0068     /// Optional validation for barrel triplets.
0069     bool validateTriplets = true;
0070 
0071     /// Widens allowed variation in tau ratio if a layer is missed in edge
0072     /// connecting.
0073     bool useAdaptiveCuts = true;
0074 
0075     /// Tau ratio cut threshold.
0076     float tauRatioCut = 0.007f;
0077 
0078     /// Tau ratio precut threshold.
0079     float tauRatioPrecut = 0.009f;
0080 
0081     /// Correction applied to tau acceptance if a layer is missed during edge
0082     /// connecting.
0083     float tauRatioCorr = 0.006f;
0084 
0085     /// The same for a triplet any of whose three nodes a strip module made,
0086     /// whose two doublets resolved the shared node's along-strip coordinate
0087     /// separately. Reaches nothing without a strip in the triplet.
0088     float tauRatioCorrStrip = 0.03f;
0089 
0090     /// Minimum transverse momentum.
0091     float minPt = 1.0f * Acts::UnitConstants::GeV;
0092 
0093     /// Fraction of `minPt` a triplet may fall to, allowing for three-point
0094     /// pT resolution.
0095     float tripletPtFraction = 0.8f;
0096 
0097     // Graph-building options
0098 
0099     /// Use eta binning from geometry structure.
0100     bool useEtaBinning = true;
0101 
0102     /// Apply RZ cuts on doublets.
0103     bool doubletFilterRZ = true;
0104 
0105     /// Maximum number of GBTS edges/doublets per space point.
0106     float maxEdgesPerSP = 30.0f;
0107 
0108     /// Minimum delta radius between layers.
0109     float minDeltaRadius = 2.0f * Acts::UnitConstants::mm;
0110 
0111     /// Largest |cot(theta)| accepted for a doublet. The default corresponds to
0112     /// |eta| of about 4.3, beyond the acceptance of any current tracker.
0113     float maxAbsTau = 36.0f;
0114 
0115     /// Maximum d0 impact parameter when validating an edge-connection triplet.
0116     float d0Max = 3.0f * Acts::UnitConstants::mm;
0117 
0118     /// Maximum difference in allowed tangent between candidate edge
0119     /// connections.
0120     float cutDPhiMax = 0.012f;
0121 
0122     /// Maximum allowed curvature tolerance for candidate edge connections.
0123     float cutDCurvMax = 0.001f;
0124 
0125     /// Minimum z0 value. In pixel mode the value is picked from the RoI.
0126     float minZ0 = -600.0f;
0127 
0128     /// Maximum z0 value. In pixel mode the value is picked from the RoI.
0129     float maxZ0 = 600.0f;
0130 
0131     /// pT at which the default cut coefficients were tuned; they scale by
0132     /// `tuningPt / minPt`.
0133     float tuningPt = 0.9f * Acts::UnitConstants::GeV;
0134 
0135     /// Maximum |curvature| above `curvatureSplitAbsTau`, before that scaling.
0136     float maxCurvatureHighEta = 4.75e-4f / Acts::UnitConstants::mm;
0137 
0138     /// Maximum |curvature| below `curvatureSplitAbsTau`, before that scaling.
0139     float maxCurvatureLowEta = 3.75e-4f / Acts::UnitConstants::mm;
0140 
0141     /// |cot(theta)| separating the two curvature cuts, corresponding to |eta|
0142     /// of about 2.1.
0143     float curvatureSplitAbsTau = 4.0f;
0144 
0145     /// Radial separation splitting the two phi-window slopes below.
0146     float phiWindowSplitDeltaRadius = 60.0f * Acts::UnitConstants::mm;
0147 
0148     /// Phi window below `phiWindowSplitDeltaRadius`, as an offset plus a slope
0149     /// times the radial separation.
0150     float phiWindowNearOffset = 0.002f;
0151 
0152     /// Slope of the near phi window per unit radial separation. Scaled by
0153     /// `tuningPt / minPt`.
0154     float phiWindowNearSlope = 4.33e-4f / Acts::UnitConstants::mm;
0155 
0156     /// Phi window above `phiWindowSplitDeltaRadius`, in the same form.
0157     float phiWindowFarOffset = 0.015f;
0158 
0159     /// Slope of the far phi window per unit radial separation. Scaled by
0160     /// `tuningPt / minPt`.
0161     float phiWindowFarSlope = 2.2e-4f / Acts::UnitConstants::mm;
0162 
0163     /// Incoming edge count below which a node is accepted without a tau match.
0164     std::uint32_t matchBeforeCreateMaxEdges = 2;
0165 
0166     /// Highest pixel barrel layer, counted inside out, whose nodes are cut
0167     /// against the z0 histogram of their outer neighbourhood and whose isolated
0168     /// nodes are skipped. A negative value disables the cut.
0169     std::int32_t z0HistogramMaxBarrelOrder = 0;
0170 
0171     /// Highest pixel barrel layer, counted inside out, to which
0172     /// `matchBeforeCreate` applies when it is enabled. A negative value
0173     /// disables it.
0174     std::int32_t matchBeforeCreateMaxBarrelOrder = 1;
0175 
0176     /// Half-width of the z0 window against which a node is matched in the
0177     /// histogram.
0178     float z0Resolution = 2.5f * Acts::UnitConstants::mm;
0179 
0180     /// Maximum radius of the pixel detector.
0181     float maxOuterRadius = 550.0f;
0182 
0183     /// Resolve a doublet's strip endpoints against its own direction before
0184     /// cutting on them. Nothing is written back; the correction belongs to the
0185     /// pair.
0186     bool calibrateStrips = true;
0187 
0188     /// How far along a strip a crossing may land and still be recovered, as a
0189     /// multiple of the strip half-length, so 1 is the strip itself. This is the
0190     /// same quantity as `TripletSeedFinder::Config::toleranceParam`.
0191     float maxStripLengthFraction = 1.1f;
0192   };
0193 
0194   /// @param config Configuration for the graph
0195   /// @param geometry GBTS geometry
0196   /// @param logger Logging instance
0197   GbtsGraphBuilder(const Config& config,
0198                    std::shared_ptr<const GbtsGeometry> geometry,
0199                    std::unique_ptr<const Acts::Logger> logger =
0200                        Acts::getDefaultLogger("GbtsGraphBuilder",
0201                                               Acts::Logging::Level::INFO));
0202 
0203   /// Access the configuration.
0204   /// @return The configuration
0205   const Config& config() const { return m_cfg; }
0206 
0207   /// Build doublet graph from nodes.
0208   /// @param roi Region of interest descriptor
0209   /// @param nodeStorage Data storage containing nodes
0210   /// @param bFieldInZ Magnetic field in z, in GeV/(e*mm)
0211   /// @return The graph, with its edges and their link counts
0212   GbtsGraph buildTheGraph(const GbtsRoiDescriptor& roi,
0213                           GbtsNodeStorage& nodeStorage, float bFieldInZ) const;
0214 
0215  private:
0216   Config m_cfg;
0217 
0218   std::shared_ptr<const GbtsGeometry> m_geometry;
0219 
0220   std::unique_ptr<const Acts::Logger> m_logger;
0221 
0222   const Acts::Logger& logger() const { return *m_logger; }
0223 };
0224 
0225 }  // namespace Acts::Experimental