Back to home page

EIC code displayed by LXR

 
 

    


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/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::Experimental {
0022 
0023 class CylindricalSpacePointGrid2 {
0024  public:
0025   /// Cylindrical Space Point bin is a 2D (phi,z) grid. It stores a vector of
0026   /// space point indices.
0027   using GridType = Grid<std::vector<SpacePointIndex2>,
0028                         Axis<AxisType::Equidistant, AxisBoundaryType::Closed>,
0029                         Axis<AxisType::Variable, AxisBoundaryType::Open>,
0030                         Axis<AxisType::Variable, AxisBoundaryType::Open>>;
0031   /// Cylindrical Binned Group
0032   using BinnedGroupType = BinnedGroup<GridType>;
0033 
0034   struct Config {
0035     /// minimum pT
0036     float minPt = 0 * UnitConstants::MeV;
0037     /// minimum extension of sensitive detector layer relevant for seeding as
0038     /// distance from x=y=0 (i.e. in r)
0039     /// WARNING: if rMin is smaller than impactMax, the bin size will be 2*pi,
0040     /// which will make seeding very slow!
0041     float rMin = 0 * UnitConstants::mm;
0042     /// maximum extension of sensitive detector layer relevant for seeding as
0043     /// distance from x=y=0 (i.e. in r)
0044     float rMax = 600 * UnitConstants::mm;
0045     /// minimum extension of sensitive detector layer relevant for seeding in
0046     /// negative direction in z
0047     float zMin = -2800 * UnitConstants::mm;
0048     /// maximum extension of sensitive detector layer relevant for seeding in
0049     /// positive direction in z
0050     float zMax = 2800 * UnitConstants::mm;
0051     /// maximum distance in r from middle space point to bottom or top
0052     /// spacepoint
0053     float deltaRMax = 270 * UnitConstants::mm;
0054     /// maximum forward direction expressed as cot(theta)
0055     float cotThetaMax = 10.01788;  // equivalent to eta = 3 (pseudorapidity)
0056     /// maximum impact parameter in mm
0057     float impactMax = 0 * UnitConstants::mm;
0058     /// minimum phi value for phiAxis construction
0059     float phiMin = -std::numbers::pi_v<float>;
0060     /// maximum phi value for phiAxis construction
0061     float phiMax = std::numbers::pi_v<float>;
0062     /// Multiplicator for the number of phi-bins. The minimum number of phi-bins
0063     /// depends on min_pt, magnetic field: 2*pi/(minPT particle phi-deflection).
0064     /// phiBinDeflectionCoverage is a multiplier for this number. If
0065     /// numPhiNeighbors (in the configuration of the BinFinders) is configured
0066     /// to return 1 neighbor on either side of the current phi-bin (and you want
0067     /// to cover the full phi-range of minPT), leave this at 1.
0068     int phiBinDeflectionCoverage = 1;
0069     /// maximum number of phi bins
0070     int maxPhiBins = 10000;
0071     /// enable non equidistant binning in z
0072     std::vector<float> zBinEdges{};
0073     std::vector<float> rBinEdges{};
0074 
0075     /// magnetic field
0076     float bFieldInZ = 0 * UnitConstants::T;
0077 
0078     std::optional<GridBinFinder<3ul>> bottomBinFinder;
0079     std::optional<GridBinFinder<3ul>> topBinFinder;
0080     std::array<std::vector<std::size_t>, 3ul> navigation;
0081   };
0082 
0083   explicit CylindricalSpacePointGrid2(
0084       const Config& config,
0085       std::unique_ptr<const Logger> logger =
0086           getDefaultLogger("CylindricalSpacePointGrid2", Logging::Level::INFO));
0087 
0088   void clear();
0089 
0090   void insert(const ConstSpacePointProxy2& sp);
0091 
0092   void extend(const SpacePointContainer2::ConstRange& spacePoints);
0093 
0094   void fill(const SpacePointContainer2& spacePoints);
0095 
0096   void sort(const SpacePointContainer2& spacePoints);
0097 
0098   Range1D<float> computeRadiusRange(
0099       const SpacePointContainer2& spacePoints) const;
0100 
0101   auto& at(std::size_t index) { return grid().at(index); }
0102   const auto& at(std::size_t index) const { return grid().at(index); }
0103 
0104   GridType& grid() { return *m_grid; }
0105   const GridType& grid() const { return *m_grid; }
0106 
0107   const BinnedGroupType& binnedGroup() const { return *m_binnedGroup; }
0108 
0109  private:
0110   Config m_cfg;
0111 
0112   std::unique_ptr<const Logger> m_logger;
0113 
0114   GridType* m_grid{};
0115   std::optional<BinnedGroupType> m_binnedGroup;
0116 
0117   std::size_t m_counter{};
0118 
0119   const Logger& logger() const { return *m_logger; }
0120 };
0121 
0122 }  // namespace Acts::Experimental