File indexing completed on 2025-06-30 07:51:54
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0013 #include "Acts/Surfaces/DiscBounds.hpp"
0014 #include "Acts/Surfaces/SurfaceBounds.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 enum BoundValues : int {
0034 eHalfLengthXminR = 0,
0035 eHalfLengthXmaxR = 1,
0036 eMinR = 2,
0037 eMaxR = 3,
0038 eAveragePhi = 4,
0039 eStereo = 5,
0040 eSize = 6
0041 };
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 explicit DiscTrapezoidBounds(double halfXminR, double halfXmaxR, double minR,
0052 double maxR,
0053 double avgPhi = std::numbers::pi / 2.,
0054 double stereo = 0.) noexcept(false);
0055
0056
0057
0058
0059 explicit DiscTrapezoidBounds(
0060 const std::array<double, eSize>& values) noexcept(false)
0061 : m_values(values) {
0062 checkConsistency();
0063 }
0064
0065 BoundsType type() const final { return SurfaceBounds::eDiscTrapezoid; }
0066
0067
0068
0069
0070 std::vector<double> values() const final;
0071
0072
0073
0074
0075
0076
0077
0078 bool inside(const Vector2& lposition,
0079 const BoundaryTolerance& boundaryTolerance =
0080 BoundaryTolerance::None()) const final;
0081
0082
0083 std::ostream& toStream(std::ostream& sl) const final;
0084
0085
0086
0087 double get(BoundValues bValue) const { return m_values[bValue]; }
0088
0089
0090 double rMin() const final { return get(eMinR); }
0091
0092
0093 double rMax() const final { return get(eMaxR); }
0094
0095
0096 double rCenter() const {
0097 double rmin = get(eMinR);
0098 double rmax = get(eMaxR);
0099 double hxmin = get(eHalfLengthXminR);
0100 double hxmax = get(eHalfLengthXmaxR);
0101 auto hmin = std::sqrt(rmin * rmin - hxmin * hxmin);
0102 auto hmax = std::sqrt(rmax * rmax - hxmax * hxmax);
0103 return 0.5 * (hmin + hmax);
0104 }
0105
0106
0107 double stereo() const { return get(eStereo); }
0108
0109
0110 double halfPhiSector() const {
0111 auto minHalfPhi = std::asin(get(eHalfLengthXminR) / get(eMinR));
0112 auto maxHalfPhi = std::asin(get(eHalfLengthXmaxR) / get(eMaxR));
0113 return std::max(minHalfPhi, maxHalfPhi);
0114 }
0115
0116
0117 double halfLengthY() const {
0118 double rmin = get(eMinR);
0119 double rmax = get(eMaxR);
0120 double hxmin = get(eHalfLengthXminR);
0121 double hxmax = get(eHalfLengthXmaxR);
0122 auto hmin = std::sqrt(rmin * rmin - hxmin * hxmin);
0123 auto hmax = std::sqrt(rmax * rmax - hxmax * hxmax);
0124 return 0.5 * (hmax - hmin);
0125 }
0126
0127
0128 bool coversFullAzimuth() const final { return false; }
0129
0130
0131
0132 bool insideRadialBounds(double R, double tolerance = 0.) const final {
0133 return (R + tolerance > get(eMinR) && R - tolerance < get(eMaxR));
0134 }
0135
0136
0137 double binningValueR() const final { return 0.5 * (get(eMinR) + get(eMaxR)); }
0138
0139
0140 double binningValuePhi() const final { return get(eAveragePhi); }
0141
0142
0143
0144
0145
0146
0147
0148
0149 std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;
0150
0151 private:
0152 std::array<double, eSize> m_values;
0153
0154
0155 double m_ymax = 0;
0156
0157
0158
0159 void checkConsistency() noexcept(false);
0160
0161
0162
0163
0164
0165 Vector2 toLocalCartesian(const Vector2& lposition) const;
0166
0167
0168
0169
0170
0171 SquareMatrix2 jacobianToLocalCartesian(const Vector2& lposition) const;
0172 };
0173
0174 }