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/Surfaces/BoundaryCheck.hpp"
0013 #include "Acts/Surfaces/PlanarBounds.hpp"
0014 #include "Acts/Surfaces/RectangleBounds.hpp"
0015 #include "Acts/Surfaces/SurfaceBounds.hpp"
0016 #include "Acts/Utilities/detail/periodic.hpp"
0017
0018 #include <array>
0019 #include <cmath>
0020 #include <cstdlib>
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 class EllipseBounds : public PlanarBounds {
0038 public:
0039 enum BoundValues {
0040 eInnerRx = 0,
0041 eInnerRy = 1,
0042 eOuterRx = 2,
0043 eOuterRy = 3,
0044 eHalfPhiSector = 4,
0045 eAveragePhi = 5,
0046 eSize = 6
0047 };
0048
0049 EllipseBounds() = delete;
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059 EllipseBounds(double innerRx, double innerRy, double outerRx, double outerRy,
0060 double halfPhi = M_PI, double averagePhi = 0.) noexcept(false)
0061 : m_values({innerRx, innerRy, outerRx, outerRy, halfPhi, averagePhi}),
0062 m_boundingBox(m_values[eInnerRy], m_values[eOuterRy]) {
0063 checkConsistency();
0064 }
0065
0066
0067
0068
0069 EllipseBounds(const std::array<double, eSize>& values) noexcept(false)
0070 : m_values(values), m_boundingBox(values[eInnerRy], values[eOuterRy]) {
0071 checkConsistency();
0072 }
0073
0074 ~EllipseBounds() override = default;
0075
0076 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
0097
0098
0099
0100
0101
0102 std::vector<Vector2> vertices(unsigned int lseg) const final;
0103
0104
0105 const RectangleBounds& boundingBox() const final;
0106
0107
0108 std::ostream& toStream(std::ostream& sl) const final;
0109
0110
0111
0112 double get(BoundValues bValue) const { return m_values[bValue]; }
0113
0114 private:
0115 std::array<double, eSize> m_values;
0116 RectangleBounds m_boundingBox;
0117
0118
0119
0120 void checkConsistency() noexcept(false);
0121 };
0122
0123 inline std::vector<double> EllipseBounds::values() const {
0124 std::vector<double> valvector;
0125 valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
0126 return valvector;
0127 }
0128
0129 inline void EllipseBounds::checkConsistency() noexcept(false) {
0130 if (get(eInnerRx) >= get(eOuterRx) || get(eInnerRx) < 0. ||
0131 get(eOuterRx) <= 0.) {
0132 throw std::invalid_argument("EllipseBounds: invalid along x axis");
0133 }
0134 if (get(eInnerRy) >= get(eOuterRy) || get(eInnerRy) < 0. ||
0135 get(eOuterRy) <= 0.) {
0136 throw std::invalid_argument("EllipseBounds: invalid along y axis.");
0137 }
0138 if (get(eHalfPhiSector) < 0. || get(eHalfPhiSector) > M_PI) {
0139 throw std::invalid_argument("EllipseBounds: invalid phi sector setup.");
0140 }
0141 if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) {
0142 throw std::invalid_argument("EllipseBounds: invalid phi positioning.");
0143 }
0144 }
0145
0146 }