File indexing completed on 2026-05-31 07:47:28
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Surfaces/DiscBounds.hpp"
0013 #include "Acts/Surfaces/SurfaceBounds.hpp"
0014 #include "Acts/Utilities/MathHelpers.hpp"
0015
0016 #include <algorithm>
0017 #include <array>
0018 #include <cmath>
0019 #include <iosfwd>
0020 #include <numbers>
0021 #include <vector>
0022
0023 namespace Acts {
0024
0025
0026
0027
0028
0029
0030
0031 class DiscTrapezoidBounds : public DiscBounds {
0032 public:
0033
0034
0035 enum BoundValues : int {
0036 eHalfLengthXminR = 0,
0037 eHalfLengthXmaxR = 1,
0038 eMinR = 2,
0039 eMaxR = 3,
0040 eAveragePhi = 4,
0041 eStereo = 5,
0042 eSize = 6
0043 };
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053 explicit DiscTrapezoidBounds(double halfXminR, double halfXmaxR, double minR,
0054 double maxR,
0055 double avgPhi = std::numbers::pi / 2.,
0056 double stereo = 0.) noexcept(false);
0057
0058
0059
0060
0061 explicit DiscTrapezoidBounds(
0062 const std::array<double, eSize>& values) noexcept(false)
0063 : m_values(values) {
0064 checkConsistency();
0065 }
0066
0067
0068 BoundsType type() const final { return eDiscTrapezoid; }
0069
0070
0071 bool isCartesian() const final { return false; }
0072
0073
0074 SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final;
0075
0076
0077 SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final;
0078
0079
0080
0081 std::vector<double> values() const final;
0082
0083
0084 bool inside(const Vector2& lposition) const final;
0085
0086
0087 Vector2 closestPoint(const Vector2& lposition,
0088 const SquareMatrix2& metric) const final;
0089
0090 using SurfaceBounds::inside;
0091
0092
0093 Vector2 center() const final;
0094
0095
0096
0097
0098 std::ostream& toStream(std::ostream& sl) const final;
0099
0100
0101
0102
0103 double get(BoundValues bValue) const { return m_values[bValue]; }
0104
0105
0106
0107 double rMin() const final { return get(eMinR); }
0108
0109
0110
0111 double rMax() const final { return get(eMaxR); }
0112
0113
0114
0115 double rCenter() const {
0116 const double rmin = get(eMinR);
0117 const double rmax = get(eMaxR);
0118 const double hxmin = get(eHalfLengthXminR);
0119 const double hxmax = get(eHalfLengthXmaxR);
0120 const double hmin = fastCathetus(rmin, hxmin);
0121 const double hmax = fastCathetus(rmax, hxmax);
0122 return 0.5 * (hmin + hmax);
0123 }
0124
0125
0126
0127 double stereo() const { return get(eStereo); }
0128
0129
0130
0131 double halfPhiSector() const {
0132 const double minHalfPhi = std::asin(get(eHalfLengthXminR) / get(eMinR));
0133 const double maxHalfPhi = std::asin(get(eHalfLengthXmaxR) / get(eMaxR));
0134 return std::max(minHalfPhi, maxHalfPhi);
0135 }
0136
0137
0138
0139 double halfLengthY() const {
0140 const double rmin = get(eMinR);
0141 const double rmax = get(eMaxR);
0142 const double hxmin = get(eHalfLengthXminR);
0143 const double hxmax = get(eHalfLengthXmaxR);
0144 const double hmin = fastCathetus(rmin, hxmin);
0145 const double hmax = fastCathetus(rmax, hxmax);
0146 return 0.5 * (hmax - hmin);
0147 }
0148
0149
0150
0151 bool coversFullAzimuth() const final { return false; }
0152
0153
0154
0155
0156
0157
0158 bool insideRadialBounds(double R, double tolerance = 0.) const final {
0159 return (R + tolerance > get(eMinR) && R - tolerance < get(eMaxR));
0160 }
0161
0162
0163
0164 double binningValueR() const final { return 0.5 * (get(eMinR) + get(eMaxR)); }
0165
0166
0167
0168 double binningValuePhi() const final { return get(eAveragePhi); }
0169
0170
0171
0172
0173
0174
0175
0176
0177 std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;
0178
0179 private:
0180 std::array<double, eSize> m_values;
0181
0182
0183 double m_ymax = 0;
0184
0185
0186
0187 void checkConsistency() noexcept(false);
0188
0189
0190
0191
0192
0193 Vector2 toLocalCartesian(const Vector2& lposition) const;
0194 };
0195
0196 }