File indexing completed on 2025-06-30 07:51:51
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 <CylindricalGridElement external_spacepoint_t>
0033 using CylindricalSpacePointGrid =
0034 Grid<std::vector<const external_spacepoint_t*>,
0035 Axis<AxisType::Equidistant, AxisBoundaryType::Closed>,
0036 Axis<AxisType::Variable, AxisBoundaryType::Open>,
0037 Axis<AxisType::Variable, AxisBoundaryType::Open>>;
0038
0039
0040 template <typename external_spacepoint_t>
0041 using CylindricalBinnedGroup =
0042 BinnedGroup<CylindricalSpacePointGrid<external_spacepoint_t>>;
0043
0044 template <typename external_spacepoint_t>
0045 using CylindricalBinnedGroupIterator =
0046 BinnedGroupIterator<CylindricalSpacePointGrid<external_spacepoint_t>>;
0047
0048 struct CylindricalSpacePointGridConfig {
0049
0050 float minPt = 0 * UnitConstants::MeV;
0051
0052
0053 float rMax = 320 * UnitConstants::mm;
0054
0055
0056 float rMin = 0 * UnitConstants::mm;
0057
0058
0059 float zMax = 0 * UnitConstants::mm;
0060
0061
0062 float zMin = 0 * UnitConstants::mm;
0063
0064 float deltaRMax = 0 * UnitConstants::mm;
0065
0066 float cotThetaMax = 0;
0067
0068 float impactMax = 0 * 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
0086 bool isInInternalUnits = true;
0087
0088 CylindricalSpacePointGridConfig toInternalUnits() const { return *this; }
0089
0090 void checkConfig() const {
0091 if (phiMin < -std::numbers::pi_v<float> ||
0092 phiMax > std::numbers::pi_v<float>) {
0093 throw std::runtime_error(
0094 "CylindricalSpacePointGridConfig: phiMin (" + std::to_string(phiMin) +
0095 ") and/or phiMax (" + std::to_string(phiMax) +
0096 ") are outside the allowed phi range, defined as "
0097 "[-std::numbers::pi_v<float>, std::numbers::pi_v<float>]");
0098 }
0099 if (phiMin > phiMax) {
0100 throw std::runtime_error(
0101 "CylindricalSpacePointGridConfig: phiMin is bigger then phiMax");
0102 }
0103 if (rMin > rMax) {
0104 throw std::runtime_error(
0105 "CylindricalSpacePointGridConfig: rMin is bigger then rMax");
0106 }
0107 if (zMin > zMax) {
0108 throw std::runtime_error(
0109 "CylindricalSpacePointGridConfig: zMin is bigger than zMax");
0110 }
0111 }
0112 };
0113
0114 struct CylindricalSpacePointGridOptions {
0115
0116 float bFieldInZ = 0 * UnitConstants::T;
0117
0118 bool isInInternalUnits = true;
0119
0120 CylindricalSpacePointGridOptions toInternalUnits() const { return *this; }
0121 };
0122
0123
0124 class CylindricalSpacePointGridCreator {
0125 public:
0126 template <typename external_spacepoint_t>
0127 static CylindricalSpacePointGrid<external_spacepoint_t> createGrid(
0128 const CylindricalSpacePointGridConfig& _config,
0129 const CylindricalSpacePointGridOptions& _options,
0130 const Logger& logger = getDummyLogger());
0131
0132 template <typename external_spacepoint_t,
0133 typename external_spacepoint_iterator_t>
0134 static void fillGrid(const SeedFinderConfig<external_spacepoint_t>& config,
0135 const SeedFinderOptions& options,
0136 CylindricalSpacePointGrid<external_spacepoint_t>& grid,
0137 external_spacepoint_iterator_t spBegin,
0138 external_spacepoint_iterator_t spEnd,
0139 const Logger& logger = getDummyLogger());
0140
0141 template <typename external_spacepoint_t, typename external_collection_t>
0142 requires std::ranges::range<external_collection_t> &&
0143 std::same_as<typename external_collection_t::value_type,
0144 external_spacepoint_t>
0145 static void fillGrid(const SeedFinderConfig<external_spacepoint_t>& config,
0146 const SeedFinderOptions& options,
0147 CylindricalSpacePointGrid<external_spacepoint_t>& grid,
0148 const external_collection_t& collection,
0149 const Logger& logger = getDummyLogger());
0150 };
0151
0152 }
0153
0154 #include "Acts/Seeding/detail/CylindricalSpacePointGrid.ipp"