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