File indexing completed on 2026-07-26 08:18:56
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Seeding/detail/SpacePointGridPhiBinning.hpp"
0010
0011 #include "Acts/Utilities/MathHelpers.hpp"
0012
0013 #include <algorithm>
0014 #include <cmath>
0015 #include <numbers>
0016 #include <stdexcept>
0017
0018 namespace Acts::detail {
0019
0020 int computeSpacePointGridPhiBins(const SpacePointGridPhiBinningConfig& config,
0021 const Logger& logger) {
0022 if (config.bFieldInZ == 0) {
0023
0024 ACTS_VERBOSE(
0025 "B-Field is 0 (z-coordinate), setting the number of bins in phi to "
0026 << config.maxPhiBins);
0027 return config.maxPhiBins;
0028 }
0029
0030
0031
0032 const float minHelixRadius = config.minPt / config.bFieldInZ;
0033
0034
0035 if (minHelixRadius < config.rMax * 0.5) {
0036 throw std::domain_error(
0037 "The value of minHelixRadius cannot be smaller than rMax / 2. Please "
0038 "check the configuration of bFieldInZ and minPt");
0039 }
0040
0041
0042
0043
0044
0045
0046 const float outerAngle =
0047 std::atan(1.f / fastCathetus(2 * minHelixRadius / config.rMax, 1));
0048
0049
0050 float innerAngle = 0;
0051 float rMin = config.rMax;
0052 if (config.rMax > config.deltaRMax) {
0053 const float innerCircleR = config.rMax - config.deltaRMax;
0054 rMin = innerCircleR;
0055 innerAngle =
0056 std::atan(1.f / fastCathetus(2 * minHelixRadius / innerCircleR, 1));
0057 }
0058
0059
0060
0061
0062
0063
0064
0065 const float sinInner = std::min(1.f, config.impactMax / rMin);
0066 const float sinOuter = std::min(1.f, config.impactMax / config.rMax);
0067 const float deltaAngleWithMaxD0 =
0068 std::abs(std::asin(sinInner) - std::asin(sinOuter));
0069
0070
0071
0072
0073
0074
0075
0076
0077 const float deltaPhi = (outerAngle - innerAngle + deltaAngleWithMaxD0) /
0078 config.phiBinDeflectionCoverage;
0079
0080
0081
0082 if (deltaPhi <= 0.f) {
0083 throw std::domain_error(
0084 "Delta phi value is equal to or less than zero, leading to an "
0085 "impossible number of bins (negative or infinite)");
0086 }
0087
0088
0089
0090 const int phiBins =
0091 static_cast<int>(std::ceil(2 * std::numbers::pi / deltaPhi));
0092
0093
0094 return std::min(phiBins, config.maxPhiBins);
0095 }
0096
0097 }