|
|
|||
File indexing completed on 2025-12-11 09:40:04
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/SpacePointContainer2.hpp" 0013 #include "Acts/Seeding/BinnedGroup.hpp" 0014 #include "Acts/Utilities/Grid.hpp" 0015 #include "Acts/Utilities/Logger.hpp" 0016 #include "Acts/Utilities/RangeXD.hpp" 0017 0018 #include <numbers> 0019 #include <vector> 0020 0021 namespace Acts { 0022 0023 /// A cylindrical space point grid used for seeding in a cylindrical detector 0024 /// geometry. 0025 /// The grid is defined in cylindrical coordinates (phi, z, r) and allows for 0026 /// efficient access to space points based on their azimuthal angle, 0027 /// z-coordinate, and radial distance. 0028 class CylindricalSpacePointGrid2 { 0029 public: 0030 /// Space point index type used in the grid. 0031 using SpacePointIndex = std::uint32_t; 0032 /// Type alias for bin container holding space point indices 0033 using BinType = std::vector<SpacePointIndex>; 0034 /// Type alias for phi axis with equidistant binning and closed boundaries 0035 using PhiAxisType = Axis<AxisType::Equidistant, AxisBoundaryType::Closed>; 0036 /// Type alias for z axis with variable binning and open boundaries 0037 using ZAxisType = Axis<AxisType::Variable, AxisBoundaryType::Open>; 0038 /// Type alias for r axis with variable binning and open boundaries 0039 using RAxisType = Axis<AxisType::Variable, AxisBoundaryType::Open>; 0040 /// Cylindrical space point grid type, which is a grid over `BinType` with 0041 /// axes defined by `PhiAxisType`, `ZAxisType`, and `RAxisType`. 0042 /// The grid is a 3D grid with the axes representing azimuthal angle (phi), 0043 /// z-coordinate, and radial distance (r). 0044 using GridType = Grid<BinType, PhiAxisType, ZAxisType, RAxisType>; 0045 /// Type alias for binned group over the cylindrical grid 0046 using BinnedGroupType = BinnedGroup<GridType>; 0047 0048 struct Config { 0049 /// minimum pT 0050 float minPt = 0 * UnitConstants::MeV; 0051 /// minimum extension of sensitive detector layer relevant for seeding as 0052 /// distance from x=y=0 (i.e. in r) 0053 /// WARNING: if rMin is smaller than impactMax, the bin size will be 2*pi, 0054 /// which will make seeding very slow! 0055 float rMin = 0 * UnitConstants::mm; 0056 /// maximum extension of sensitive detector layer relevant for seeding as 0057 /// distance from x=y=0 (i.e. in r) 0058 float rMax = 600 * UnitConstants::mm; 0059 /// minimum extension of sensitive detector layer relevant for seeding in 0060 /// negative direction in z 0061 float zMin = -2800 * UnitConstants::mm; 0062 /// maximum extension of sensitive detector layer relevant for seeding in 0063 /// positive direction in z 0064 float zMax = 2800 * UnitConstants::mm; 0065 /// maximum distance in r from middle space point to bottom or top 0066 /// spacepoint 0067 float deltaRMax = 270 * UnitConstants::mm; 0068 /// maximum forward direction expressed as cot(theta) 0069 float cotThetaMax = 10.01788; // equivalent to eta = 3 (pseudorapidity) 0070 /// maximum impact parameter in mm 0071 float impactMax = 0 * UnitConstants::mm; 0072 /// minimum phi value for phiAxis construction 0073 float phiMin = -std::numbers::pi_v<float>; 0074 /// maximum phi value for phiAxis construction 0075 float phiMax = std::numbers::pi_v<float>; 0076 /// Multiplicator for the number of phi-bins. The minimum number of phi-bins 0077 /// depends on min_pt, magnetic field: 2*pi/(minPT particle phi-deflection). 0078 /// phiBinDeflectionCoverage is a multiplier for this number. If 0079 /// numPhiNeighbors (in the configuration of the BinFinders) is configured 0080 /// to return 1 neighbor on either side of the current phi-bin (and you want 0081 /// to cover the full phi-range of minPT), leave this at 1. 0082 int phiBinDeflectionCoverage = 1; 0083 /// maximum number of phi bins 0084 int maxPhiBins = 10000; 0085 /// enable non equidistant binning in z 0086 std::vector<float> zBinEdges{}; 0087 std::vector<float> rBinEdges{}; 0088 0089 /// magnetic field 0090 float bFieldInZ = 0 * UnitConstants::T; 0091 0092 std::optional<GridBinFinder<3ul>> bottomBinFinder; 0093 std::optional<GridBinFinder<3ul>> topBinFinder; 0094 std::array<std::vector<std::size_t>, 3ul> navigation; 0095 }; 0096 0097 /// Construct a cylindrical space point grid with the given configuration and 0098 /// an optional logger. 0099 /// @param config Configuration for the cylindrical grid 0100 /// @param logger Optional logger instance for debugging output 0101 explicit CylindricalSpacePointGrid2( 0102 const Config& config, 0103 std::unique_ptr<const Logger> logger = 0104 getDefaultLogger("CylindricalSpacePointGrid2", Logging::Level::INFO)); 0105 0106 /// Clear the grid and drop all state. The object will behave like a newly 0107 /// constructed one. 0108 void clear(); 0109 0110 /// Get the bin index for a space point given its azimuthal angle, radial 0111 /// distance, and z-coordinate. 0112 /// @param position The position of the space point in (phi, z, r) coordinates 0113 /// @return The index of the bin in which the space point is located, or 0114 /// `std::nullopt` if the space point is outside the grid bounds. 0115 std::optional<std::size_t> binIndex(const Vector3& position) const { 0116 if (!grid().isInside(position)) { 0117 return std::nullopt; 0118 } 0119 return grid().globalBinFromPosition(position); 0120 } 0121 /// Get the bin index for a space point given its azimuthal angle, radial 0122 /// distance, and z-coordinate. 0123 /// @param phi The azimuthal angle of the space point in radians 0124 /// @param z The z-coordinate of the space point 0125 /// @param r The radial distance of the space point from the origin 0126 /// @return The index of the bin in which the space point is located, or 0127 /// `std::nullopt` if the space point is outside the grid bounds. 0128 std::optional<std::size_t> binIndex(float phi, float z, float r) const { 0129 return binIndex(Vector3(phi, z, r)); 0130 } 0131 0132 /// Insert a space point into the grid. 0133 /// @param index The index of the space point to insert 0134 /// @param phi The azimuthal angle of the space point in radians 0135 /// @param z The z-coordinate of the space point 0136 /// @param r The radial distance of the space point from the origin 0137 /// @return The index of the bin in which the space point was inserted, or 0138 /// `std::nullopt` if the space point is outside the grid bounds. 0139 std::optional<std::size_t> insert(SpacePointIndex index, float phi, float z, 0140 float r); 0141 /// Insert a space point into the grid. 0142 /// @param sp The space point to insert 0143 /// @return The index of the bin in which the space point was inserted, or 0144 /// `std::nullopt` if the space point is outside the grid bounds. 0145 std::optional<std::size_t> insert(const ConstSpacePointProxy2& sp) { 0146 return insert(sp.index(), sp.phi(), sp.z(), sp.r()); 0147 } 0148 0149 /// Fill the grid with space points from the container. 0150 /// @param spacePoints The space point container to fill the grid with 0151 void extend(const SpacePointContainer2::ConstRange& spacePoints); 0152 0153 /// Sort the bins in the grid by the space point radius, which is required by 0154 /// some algorithms that operate on the grid. 0155 /// @param spacePoints The space point container to sort the bins by radius 0156 void sortBinsByR(const SpacePointContainer2& spacePoints); 0157 0158 /// Compute the range of radii in the grid. This requires the grid to be 0159 /// filled with space points and sorted by radius. The sorting can be done 0160 /// with the `sortBinsByR` method. 0161 /// @param spacePoints The space point container to compute the radius range 0162 /// @return The range of radii in the grid 0163 Range1D<float> computeRadiusRange( 0164 const SpacePointContainer2& spacePoints) const; 0165 0166 /// Mutable bin access by index. 0167 /// @param index The index of the bin to access 0168 /// @return Mutable reference to the bin at the specified index 0169 BinType& at(std::size_t index) { return grid().at(index); } 0170 /// Const bin access by index. 0171 /// @param index The index of the bin to access 0172 /// @return Const reference to the bin at the specified index 0173 const BinType& at(std::size_t index) const { return grid().at(index); } 0174 0175 /// Mutable grid access. 0176 /// @return Mutable reference to the grid 0177 GridType& grid() { return *m_grid; } 0178 /// Const grid access. 0179 /// @return Const reference to the grid 0180 const GridType& grid() const { return *m_grid; } 0181 0182 /// Access to the binned group. 0183 /// @return Reference to the binned group 0184 const BinnedGroupType& binnedGroup() const { return *m_binnedGroup; } 0185 0186 /// Get the number of space points in the grid. 0187 /// @return The number of space points in the grid 0188 std::size_t numberOfSpacePoints() const { return m_counter; } 0189 0190 /// Get the number of bins in the grid. 0191 /// @return The number of bins in the grid 0192 std::size_t numberOfBins() const { return grid().size(); } 0193 0194 private: 0195 Config m_cfg; 0196 0197 std::unique_ptr<const Logger> m_logger; 0198 0199 GridType* m_grid{}; 0200 std::optional<BinnedGroupType> m_binnedGroup; 0201 0202 std::size_t m_counter{}; 0203 0204 const Logger& logger() const { return *m_logger; } 0205 }; 0206 0207 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|