Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:23:31

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