Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 08:07:05

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2024 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Geometry/Extent.hpp"
0012 #include "Acts/Seeding/BinnedGroup.hpp"
0013 #include "Acts/Seeding/InternalSpacePoint.hpp"
0014 #include "Acts/Seeding/SeedFinderConfig.hpp"
0015 #include "Acts/Utilities/Grid.hpp"
0016 
0017 #include <vector>
0018 
0019 namespace Acts {
0020 
0021 /// Cylindrical Space Point bin is a 2D grid with (phi, z) bins
0022 /// It stores a vector of internal space points to external space points
0023 template <typename external_spacepoint_t>
0024 using CylindricalSpacePointGrid = Acts::Grid<
0025     std::vector<
0026         std::unique_ptr<Acts::InternalSpacePoint<external_spacepoint_t>>>,
0027     Acts::Axis<Acts::AxisType::Equidistant, Acts::AxisBoundaryType::Closed>,
0028     Acts::Axis<Acts::AxisType::Variable, Acts::AxisBoundaryType::Bound>>;
0029 
0030 /// Cylindrical Binned Group
0031 template <typename external_spacepoint_t>
0032 using CylindricalBinnedGroup =
0033     Acts::BinnedGroup<Acts::CylindricalSpacePointGrid<external_spacepoint_t>>;
0034 
0035 template <typename external_spacepoint_t>
0036 using CylindricalBinnedGroupIterator = Acts::BinnedGroupIterator<
0037     Acts::CylindricalSpacePointGrid<external_spacepoint_t>>;
0038 
0039 struct CylindricalSpacePointGridConfig {
0040   // minimum pT to be found by seedFinder
0041   float minPt = 0;
0042   // maximum extension of sensitive detector layer relevant for seeding as
0043   // distance from x=y=0 (i.e. in r)
0044   float rMax = 0;
0045   // maximum extension of sensitive detector layer relevant for seeding in
0046   // positive direction in z
0047   float zMax = 0;
0048   // maximum extension of sensitive detector layer relevant for seeding in
0049   // negative direction in z
0050   float zMin = 0;
0051   // maximum distance in r from middle space point to bottom or top spacepoint
0052   float deltaRMax = 0;
0053   // maximum forward direction expressed as cot(theta)
0054   float cotThetaMax = 0;
0055   // maximum impact parameter in mm
0056   float impactMax = 0;
0057   // minimum phi value for phiAxis construction
0058   float phiMin = -M_PI;
0059   // maximum phi value for phiAxis construction
0060   float phiMax = M_PI;
0061   // Multiplicator for the number of phi-bins. The minimum number of phi-bins
0062   // depends on min_pt, magnetic field: 2*M_PI/(minPT particle phi-deflection).
0063   // phiBinDeflectionCoverage is a multiplier for this number. If
0064   // numPhiNeighbors (in the configuration of the BinFinders) is configured to
0065   // return 1 neighbor on either side of the current phi-bin (and you want to
0066   // cover the full phi-range of minPT), leave this at 1.
0067   int phiBinDeflectionCoverage = 1;
0068   // maximum number of phi bins
0069   int maxPhiBins = 10000;
0070   // enable non equidistant binning in z
0071   std::vector<float> zBinEdges;
0072   bool isInInternalUnits = false;
0073   CylindricalSpacePointGridConfig toInternalUnits() const {
0074     if (isInInternalUnits) {
0075       throw std::runtime_error(
0076           "Repeated conversion to internal units for "
0077           "CylindricalSpacePointGridConfig");
0078     }
0079     using namespace Acts::UnitLiterals;
0080     CylindricalSpacePointGridConfig config = *this;
0081     config.isInInternalUnits = true;
0082     config.minPt /= 1_MeV;
0083     config.rMax /= 1_mm;
0084     config.zMax /= 1_mm;
0085     config.zMin /= 1_mm;
0086     config.deltaRMax /= 1_mm;
0087 
0088     return config;
0089   }
0090 };
0091 
0092 struct CylindricalSpacePointGridOptions {
0093   // magnetic field
0094   float bFieldInZ = 0;
0095   bool isInInternalUnits = false;
0096   CylindricalSpacePointGridOptions toInternalUnits() const {
0097     if (isInInternalUnits) {
0098       throw std::runtime_error(
0099           "Repeated conversion to internal units for "
0100           "CylindricalSpacePointGridOptions");
0101     }
0102     using namespace Acts::UnitLiterals;
0103     CylindricalSpacePointGridOptions options = *this;
0104     options.isInInternalUnits = true;
0105     options.bFieldInZ /= 1000_T;
0106 
0107     return options;
0108   }
0109 };
0110 
0111 /// Instructions on how to create and fill this grid specialization
0112 class CylindricalSpacePointGridCreator {
0113  public:
0114   template <typename external_spacepoint_t>
0115   static Acts::CylindricalSpacePointGrid<external_spacepoint_t> createGrid(
0116       const Acts::CylindricalSpacePointGridConfig& _config,
0117       const Acts::CylindricalSpacePointGridOptions& _options);
0118 
0119   template <typename external_spacepoint_t,
0120             typename external_spacepoint_iterator_t, typename callable_t>
0121   static void fillGrid(
0122       const Acts::SeedFinderConfig<external_spacepoint_t>& config,
0123       const Acts::SeedFinderOptions& options,
0124       Acts::CylindricalSpacePointGrid<external_spacepoint_t>& grid,
0125       external_spacepoint_iterator_t spBegin,
0126       external_spacepoint_iterator_t spEnd, callable_t&& toGlobal,
0127       Acts::Extent& rRangeSPExtent);
0128 };
0129 
0130 }  // namespace Acts
0131 
0132 #include "Acts/Seeding/detail/CylindricalSpacePointGrid.ipp"