File indexing completed on 2025-01-19 09:23:34
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Tolerance.hpp"
0013 #include "Acts/Definitions/TrackParametrization.hpp"
0014 #include "Acts/Surfaces/BoundaryCheck.hpp"
0015 #include "Acts/Surfaces/DiscBounds.hpp"
0016 #include "Acts/Surfaces/SurfaceBounds.hpp"
0017 #include "Acts/Utilities/detail/periodic.hpp"
0018
0019 #include <array>
0020 #include <cmath>
0021 #include <exception>
0022 #include <iosfwd>
0023 #include <stdexcept>
0024 #include <vector>
0025
0026 namespace Acts {
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 class AnnulusBounds : public DiscBounds {
0039 public:
0040 enum BoundValues : int {
0041 eMinR = 0,
0042 eMaxR = 1,
0043 eMinPhiRel = 2,
0044 eMaxPhiRel = 3,
0045 eAveragePhi = 4,
0046 eOriginX = 5,
0047 eOriginY = 6,
0048 eSize = 7
0049 };
0050
0051 AnnulusBounds() = delete;
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 AnnulusBounds(double minR, double maxR, double minPhiRel, double maxPhiRel,
0064 const Vector2& moduleOrigin = {0, 0},
0065 double avgPhi = 0) noexcept(false)
0066 : AnnulusBounds({minR, maxR, minPhiRel, maxPhiRel, avgPhi,
0067 moduleOrigin.x(), moduleOrigin.y()}) {}
0068
0069
0070
0071
0072 AnnulusBounds(const std::array<double, eSize>& values) noexcept(false);
0073
0074 AnnulusBounds(const AnnulusBounds& source) = default;
0075
0076 SurfaceBounds::BoundsType type() const final;
0077
0078
0079
0080
0081 std::vector<double> values() const final;
0082
0083
0084
0085
0086
0087
0088
0089
0090 bool inside(const Vector2& lposition,
0091 const BoundaryCheck& bcheck) const final;
0092
0093
0094
0095
0096 std::ostream& toStream(std::ostream& sl) const final;
0097
0098
0099
0100 double get(BoundValues bValue) const { return m_values[bValue]; }
0101
0102
0103
0104 double phiMin() const;
0105
0106
0107
0108 double phiMax() const;
0109
0110
0111 bool coversFullAzimuth() const final;
0112
0113
0114
0115 bool insideRadialBounds(double R, double tolerance = 0.) const final;
0116
0117
0118 double binningValueR() const final;
0119
0120
0121 double binningValuePhi() const final;
0122
0123
0124
0125
0126
0127 Vector2 moduleOrigin() const;
0128
0129
0130
0131
0132
0133 std::vector<Vector2> corners() const;
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148 std::vector<Vector2> vertices(unsigned int lseg) const override;
0149
0150
0151 double rMin() const final;
0152
0153
0154 double rMax() const final;
0155
0156 private:
0157 std::array<double, eSize> m_values;
0158
0159
0160 Vector2 m_moduleOrigin;
0161 Vector2 m_shiftXY;
0162 Vector2 m_shiftPC;
0163 Transform2 m_rotationStripPC;
0164 Transform2 m_translation;
0165
0166
0167 Vector2 m_outLeftStripPC;
0168 Vector2 m_inLeftStripPC;
0169 Vector2 m_outRightStripPC;
0170 Vector2 m_inRightStripPC;
0171
0172 Vector2 m_outLeftModulePC;
0173 Vector2 m_inLeftModulePC;
0174 Vector2 m_outRightModulePC;
0175 Vector2 m_inRightModulePC;
0176
0177 Vector2 m_outLeftStripXY;
0178 Vector2 m_inLeftStripXY;
0179 Vector2 m_outRightStripXY;
0180 Vector2 m_inRightStripXY;
0181
0182
0183
0184 void checkConsistency() noexcept(false);
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194 virtual bool inside(const Vector2& lposition, double tolR,
0195 double tolPhi) const final;
0196
0197
0198
0199
0200
0201
0202 Vector2 stripXYToModulePC(const Vector2& vStripXY) const;
0203
0204
0205 Vector2 closestOnSegment(const Vector2& a, const Vector2& b, const Vector2& p,
0206 const SquareMatrix2& weight) const;
0207
0208
0209 double squaredNorm(const Vector2& v, const SquareMatrix2& weight) const;
0210 };
0211
0212 inline SurfaceBounds::BoundsType AnnulusBounds::type() const {
0213 return SurfaceBounds::eAnnulus;
0214 }
0215
0216 inline double AnnulusBounds::rMin() const {
0217 return get(eMinR);
0218 }
0219
0220 inline double AnnulusBounds::rMax() const {
0221 return get(eMaxR);
0222 }
0223
0224 inline double AnnulusBounds::phiMin() const {
0225 return get(eMinPhiRel) + get(eAveragePhi);
0226 }
0227
0228 inline double AnnulusBounds::phiMax() const {
0229 return get(eMaxPhiRel) + get(eAveragePhi);
0230 }
0231
0232 inline bool AnnulusBounds::coversFullAzimuth() const {
0233 return (std::abs((get(eMinPhiRel) - get(eMaxPhiRel)) - M_PI) <
0234 s_onSurfaceTolerance);
0235 }
0236
0237 inline bool AnnulusBounds::insideRadialBounds(double R,
0238 double tolerance) const {
0239 return ((R + tolerance) > get(eMinR) && (R - tolerance) < get(eMaxR));
0240 }
0241
0242 inline double AnnulusBounds::binningValueR() const {
0243 return 0.5 * (get(eMinR) + get(eMaxR));
0244 }
0245
0246 inline double AnnulusBounds::binningValuePhi() const {
0247 return get(eAveragePhi);
0248 }
0249
0250 inline std::vector<double> AnnulusBounds::values() const {
0251 std::vector<double> valvector;
0252 valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
0253 return valvector;
0254 }
0255
0256 inline void AnnulusBounds::checkConsistency() noexcept(false) {
0257 if (get(eMinR) < 0. || get(eMaxR) < 0. || get(eMinR) > get(eMaxR) ||
0258 std::abs(get(eMinR) - get(eMaxR)) < s_epsilon) {
0259 throw std::invalid_argument("AnnulusBounds: invalid radial setup.");
0260 }
0261 if (get(eMinPhiRel) != detail::radian_sym(get(eMinPhiRel)) ||
0262 get(eMaxPhiRel) != detail::radian_sym(get(eMaxPhiRel)) ||
0263 get(eMinPhiRel) > get(eMaxPhiRel)) {
0264 throw std::invalid_argument("AnnulusBounds: invalid phi boundary setup.");
0265 }
0266 if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) {
0267 throw std::invalid_argument("AnnulusBounds: invalid phi positioning.");
0268 }
0269 }
0270
0271 }