File indexing completed on 2025-12-16 09:22:37
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 void checkConfig() const {
0089 if (phiMin < -std::numbers::pi_v<float> ||
0090 phiMax > std::numbers::pi_v<float>) {
0091 throw std::runtime_error(
0092 "CylindricalSpacePointGridConfig: phiMin (" + std::to_string(phiMin) +
0093 ") and/or phiMax (" + std::to_string(phiMax) +
0094 ") are outside the allowed phi range, defined as "
0095 "[-std::numbers::pi_v<float>, std::numbers::pi_v<float>]");
0096 }
0097 if (phiMin > phiMax) {
0098 throw std::runtime_error(
0099 "CylindricalSpacePointGridConfig: phiMin is bigger then phiMax");
0100 }
0101 if (rMin > rMax) {
0102 throw std::runtime_error(
0103 "CylindricalSpacePointGridConfig: rMin is bigger then rMax");
0104 }
0105 if (zMin > zMax) {
0106 throw std::runtime_error(
0107 "CylindricalSpacePointGridConfig: zMin is bigger than zMax");
0108 }
0109 }
0110 };
0111
0112 struct CylindricalSpacePointGridOptions {
0113
0114 float bFieldInZ = 0 * UnitConstants::T;
0115
0116 bool isInInternalUnits = true;
0117 };
0118
0119
0120 class CylindricalSpacePointGridCreator {
0121 public:
0122 template <typename external_spacepoint_t>
0123 static CylindricalSpacePointGrid<external_spacepoint_t> createGrid(
0124 const CylindricalSpacePointGridConfig& _config,
0125 const CylindricalSpacePointGridOptions& _options,
0126 const Logger& logger = getDummyLogger());
0127
0128 template <typename external_spacepoint_t,
0129 typename external_spacepoint_iterator_t>
0130 static void fillGrid(const SeedFinderConfig<external_spacepoint_t>& config,
0131 const SeedFinderOptions& options,
0132 CylindricalSpacePointGrid<external_spacepoint_t>& grid,
0133 external_spacepoint_iterator_t spBegin,
0134 external_spacepoint_iterator_t spEnd,
0135 const Logger& logger = getDummyLogger());
0136
0137 template <typename external_spacepoint_t, typename external_collection_t>
0138 requires std::ranges::range<external_collection_t> &&
0139 std::same_as<typename external_collection_t::value_type,
0140 external_spacepoint_t>
0141 static void fillGrid(const SeedFinderConfig<external_spacepoint_t>& config,
0142 const SeedFinderOptions& options,
0143 CylindricalSpacePointGrid<external_spacepoint_t>& grid,
0144 const external_collection_t& collection,
0145 const Logger& logger = getDummyLogger());
0146 };
0147
0148 }
0149
0150 #include "Acts/Seeding/detail/CylindricalSpacePointGrid.ipp"