File indexing completed on 2025-12-13 09:39:03
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Units.hpp"
0012 #include "Acts/EventData/SpacePointContainer2.hpp"
0013 #include "Acts/Utilities/KDTree.hpp"
0014 #include "Acts/Utilities/Logger.hpp"
0015
0016 #include <vector>
0017
0018 namespace Acts::Experimental {
0019
0020
0021
0022
0023
0024
0025 class CylindricalSpacePointKDTree {
0026 public:
0027
0028 using SpacePointIndex = std::uint32_t;
0029
0030
0031
0032
0033 static constexpr std::size_t NDims = 3;
0034
0035
0036 enum Dim { DimPhi = 0, DimR = 1, DimZ = 2 };
0037
0038
0039
0040
0041
0042 using Tree = KDTree<NDims, SpacePointIndex, float, std::array, 4>;
0043
0044 struct Options {
0045
0046
0047 float rMax = 600 * UnitConstants::mm;
0048
0049
0050 float zMin = -2800 * UnitConstants::mm;
0051
0052
0053 float zMax = 2800 * UnitConstants::mm;
0054
0055 float phiMin = -std::numbers::pi_v<float>;
0056
0057 float phiMax = std::numbers::pi_v<float>;
0058
0059
0060 float deltaRMin = 5 * UnitConstants::mm;
0061
0062 float deltaRMax = 270 * UnitConstants::mm;
0063
0064
0065 float deltaZMin = -std::numeric_limits<float>::infinity();
0066
0067 float deltaZMax = std::numeric_limits<float>::infinity();
0068
0069
0070
0071 float collisionRegionMin = -150 * UnitConstants::mm;
0072 float collisionRegionMax = +150 * UnitConstants::mm;
0073
0074
0075
0076 float cotThetaMax = 10.01788;
0077
0078
0079
0080 float deltaPhiMax = 0.085;
0081 };
0082
0083 struct Candidates {
0084
0085
0086 std::vector<SpacePointIndex> bottom_lh_v;
0087
0088
0089 std::vector<SpacePointIndex> bottom_hl_v;
0090
0091 std::vector<SpacePointIndex> top_lh_v;
0092
0093 std::vector<SpacePointIndex> top_hl_v;
0094
0095 void reserve(std::size_t n) {
0096 bottom_lh_v.reserve(n);
0097 bottom_hl_v.reserve(n);
0098 top_lh_v.reserve(n);
0099 top_hl_v.reserve(n);
0100 }
0101
0102 void clear() {
0103 bottom_lh_v.clear();
0104 bottom_hl_v.clear();
0105 top_lh_v.clear();
0106 top_hl_v.clear();
0107 }
0108 };
0109
0110
0111
0112 explicit CylindricalSpacePointKDTree(
0113 Tree tree, std::unique_ptr<const Logger> logger = getDefaultLogger(
0114 "CylindricalSpacePointKDTree", Logging::Level::INFO));
0115
0116 std::size_t size() const { return m_tree.size(); }
0117
0118 auto begin() const { return m_tree.begin(); }
0119 auto end() const { return m_tree.end(); }
0120
0121 Tree::range_t validTupleOrthoRangeLH(const Options& options,
0122 const ConstSpacePointProxy2& low) const;
0123 Tree::range_t validTupleOrthoRangeHL(const Options& options,
0124 const ConstSpacePointProxy2& high) const;
0125
0126 void validTuples(const Options& lhOptions, const Options& hlOptions,
0127 const ConstSpacePointProxy2& spM, std::size_t nTopSeedConf,
0128 Candidates& candidates) const;
0129
0130 private:
0131 Tree m_tree;
0132
0133 std::unique_ptr<const Logger> m_logger;
0134
0135 const Logger& logger() const { return *m_logger; }
0136 };
0137
0138 class CylindricalSpacePointKDTreeBuilder {
0139 public:
0140
0141 using SpacePointIndex = CylindricalSpacePointKDTree::SpacePointIndex;
0142
0143
0144
0145
0146 static constexpr std::size_t NDims = CylindricalSpacePointKDTree::NDims;
0147
0148
0149 using Dim = CylindricalSpacePointKDTree::Dim;
0150
0151
0152
0153
0154
0155 using Tree = CylindricalSpacePointKDTree::Tree;
0156
0157
0158
0159 explicit CylindricalSpacePointKDTreeBuilder(
0160 std::unique_ptr<const Logger> logger = getDefaultLogger(
0161 "CylindricalSpacePointKDTree", Logging::Level::INFO));
0162
0163
0164
0165 std::size_t size() const { return m_points.size(); }
0166
0167 void reserve(std::size_t n) { m_points.reserve(n); }
0168
0169
0170
0171 void clear() { m_points.clear(); }
0172
0173
0174
0175
0176
0177
0178 void insert(SpacePointIndex index, float phi, float r, float z);
0179
0180
0181
0182 void insert(const ConstSpacePointProxy2& sp) {
0183 return insert(sp.index(), sp.phi(), sp.r(), sp.z());
0184 }
0185
0186
0187
0188 void extend(const SpacePointContainer2::ConstRange& spacePoints);
0189
0190 CylindricalSpacePointKDTree build();
0191
0192 private:
0193 std::unique_ptr<const Logger> m_logger;
0194
0195 std::vector<Tree::pair_t> m_points;
0196
0197 const Logger& logger() const { return *m_logger; }
0198 };
0199
0200 }