File indexing completed on 2025-01-18 09:10:59
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Seeding/BinnedGroup.hpp"
0012 #include "Acts/Seeding/SeedFinderConfig.hpp"
0013 #include "Acts/Utilities/Grid.hpp"
0014 #include "Acts/Utilities/Logger.hpp"
0015
0016 #include <numbers>
0017 #include <vector>
0018
0019 namespace Acts {
0020
0021
0022
0023 template <typename external_spacepoint_t>
0024 concept CylindricalGridElement = requires(external_spacepoint_t sp) {
0025 { sp.phi() } -> std::same_as<float>;
0026 { sp.z() } -> std::same_as<float>;
0027 { sp.radius() } -> std::same_as<float>;
0028 };
0029
0030
0031
0032 template <Acts::CylindricalGridElement external_spacepoint_t>
0033 using CylindricalSpacePointGrid = Acts::Grid<
0034 std::vector<const external_spacepoint_t*>,
0035 Acts::Axis<Acts::AxisType::Equidistant, Acts::AxisBoundaryType::Closed>,
0036 Acts::Axis<Acts::AxisType::Variable, Acts::AxisBoundaryType::Open>,
0037 Acts::Axis<Acts::AxisType::Variable, Acts::AxisBoundaryType::Open>>;
0038
0039
0040 template <typename external_spacepoint_t>
0041 using CylindricalBinnedGroup =
0042 Acts::BinnedGroup<Acts::CylindricalSpacePointGrid<external_spacepoint_t>>;
0043
0044 template <typename external_spacepoint_t>
0045 using CylindricalBinnedGroupIterator = Acts::BinnedGroupIterator<
0046 Acts::CylindricalSpacePointGrid<external_spacepoint_t>>;
0047
0048 struct CylindricalSpacePointGridConfig {
0049
0050 float minPt = 0 * Acts::UnitConstants::MeV;
0051
0052
0053 float rMax = 320 * Acts::UnitConstants::mm;
0054
0055
0056 float rMin = 0 * Acts::UnitConstants::mm;
0057
0058
0059 float zMax = 0 * Acts::UnitConstants::mm;
0060
0061
0062 float zMin = 0 * Acts::UnitConstants::mm;
0063
0064 float deltaRMax = 0 * Acts::UnitConstants::mm;
0065
0066 float cotThetaMax = 0;
0067
0068 float impactMax = 0 * Acts::UnitConstants::mm;
0069
0070 float phiMin = -std::numbers::pi_v<float>;
0071
0072 float phiMax = std::numbers::pi_v<float>;
0073
0074
0075
0076
0077
0078
0079 int phiBinDeflectionCoverage = 1;
0080
0081 int maxPhiBins = 10000;
0082
0083 std::vector<float> zBinEdges{};
0084 std::vector<float> rBinEdges{};
0085 bool isInInternalUnits = false;
0086 CylindricalSpacePointGridConfig toInternalUnits() const {
0087 if (isInInternalUnits) {
0088 throw std::runtime_error(
0089 "Repeated conversion to internal units for "
0090 "CylindricalSpacePointGridConfig");
0091 }
0092
0093 using namespace Acts::UnitLiterals;
0094 CylindricalSpacePointGridConfig config = *this;
0095 config.isInInternalUnits = true;
0096 config.minPt /= 1_MeV;
0097 config.rMin /= 1_mm;
0098 config.rMax /= 1_mm;
0099 config.zMax /= 1_mm;
0100 config.zMin /= 1_mm;
0101 config.deltaRMax /= 1_mm;
0102
0103 for (float& val : config.zBinEdges) {
0104 val /= 1_mm;
0105 }
0106 for (float& val : config.rBinEdges) {
0107 val /= 1_mm;
0108 }
0109
0110 if (config.phiMin < -std::numbers::pi_v<float> ||
0111 config.phiMax > std::numbers::pi_v<float>) {
0112 throw std::runtime_error(
0113 "CylindricalSpacePointGridConfig: phiMin (" +
0114 std::to_string(config.phiMin) + ") and/or phiMax (" +
0115 std::to_string(config.phiMax) +
0116 ") are outside "
0117 "the allowed phi range, defined as "
0118 "[-std::numbers::pi_v<float>, std::numbers::pi_v<float>]");
0119 }
0120 if (config.phiMin > config.phiMax) {
0121 throw std::runtime_error(
0122 "CylindricalSpacePointGridConfig: phiMin is bigger then phiMax");
0123 }
0124 if (config.rMin > config.rMax) {
0125 throw std::runtime_error(
0126 "CylindricalSpacePointGridConfig: rMin is bigger then rMax");
0127 }
0128 if (config.zMin > config.zMax) {
0129 throw std::runtime_error(
0130 "CylindricalSpacePointGridConfig: zMin is bigger than zMax");
0131 }
0132
0133 return config;
0134 }
0135 };
0136
0137 struct CylindricalSpacePointGridOptions {
0138
0139 float bFieldInZ = 0. * Acts::UnitConstants::T;
0140 bool isInInternalUnits = false;
0141 CylindricalSpacePointGridOptions toInternalUnits() const {
0142 if (isInInternalUnits) {
0143 throw std::runtime_error(
0144 "Repeated conversion to internal units for "
0145 "CylindricalSpacePointGridOptions");
0146 }
0147 using namespace Acts::UnitLiterals;
0148 CylindricalSpacePointGridOptions options = *this;
0149 options.isInInternalUnits = true;
0150 options.bFieldInZ /= 1000_T;
0151
0152 return options;
0153 }
0154 };
0155
0156
0157 class CylindricalSpacePointGridCreator {
0158 public:
0159 template <typename external_spacepoint_t>
0160 static Acts::CylindricalSpacePointGrid<external_spacepoint_t> createGrid(
0161 const Acts::CylindricalSpacePointGridConfig& _config,
0162 const Acts::CylindricalSpacePointGridOptions& _options,
0163 const Acts::Logger& logger = Acts::getDummyLogger());
0164
0165 template <typename external_spacepoint_t,
0166 typename external_spacepoint_iterator_t>
0167 static void fillGrid(
0168 const Acts::SeedFinderConfig<external_spacepoint_t>& config,
0169 const Acts::SeedFinderOptions& options,
0170 Acts::CylindricalSpacePointGrid<external_spacepoint_t>& grid,
0171 external_spacepoint_iterator_t spBegin,
0172 external_spacepoint_iterator_t spEnd,
0173 const Acts::Logger& logger = Acts::getDummyLogger());
0174
0175 template <typename external_spacepoint_t, typename external_collection_t>
0176 requires std::ranges::range<external_collection_t> &&
0177 std::same_as<typename external_collection_t::value_type,
0178 external_spacepoint_t>
0179 static void fillGrid(
0180 const Acts::SeedFinderConfig<external_spacepoint_t>& config,
0181 const Acts::SeedFinderOptions& options,
0182 Acts::CylindricalSpacePointGrid<external_spacepoint_t>& grid,
0183 const external_collection_t& collection,
0184 const Acts::Logger& logger = Acts::getDummyLogger());
0185 };
0186
0187 }
0188
0189 #include "Acts/Seeding/detail/CylindricalSpacePointGrid.ipp"