File indexing completed on 2025-01-19 09:23:35
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/TrackParametrization.hpp"
0013 #include "Acts/Surfaces/BoundaryCheck.hpp"
0014 #include "Acts/Surfaces/DiscBounds.hpp"
0015 #include "Acts/Surfaces/SurfaceBounds.hpp"
0016 #include "Acts/Utilities/detail/periodic.hpp"
0017
0018 #include <array>
0019 #include <cmath>
0020 #include <iosfwd>
0021 #include <stdexcept>
0022 #include <vector>
0023
0024 namespace Acts {
0025
0026
0027
0028
0029
0030
0031
0032 class RadialBounds : public DiscBounds {
0033 public:
0034 enum BoundValues {
0035 eMinR = 0,
0036 eMaxR = 1,
0037 eHalfPhiSector = 2,
0038 eAveragePhi = 3,
0039 eSize = 4
0040 };
0041
0042 RadialBounds() = delete;
0043
0044
0045
0046
0047
0048
0049
0050 RadialBounds(double minR, double maxR, double halfPhi = M_PI,
0051 double avgPhi = 0.) noexcept(false)
0052 : m_values({minR, maxR, halfPhi, avgPhi}) {
0053 checkConsistency();
0054 }
0055
0056
0057
0058
0059 RadialBounds(const std::array<double, eSize>& values) noexcept(false)
0060 : m_values(values) {
0061 checkConsistency();
0062 }
0063
0064 ~RadialBounds() override = default;
0065
0066 SurfaceBounds::BoundsType type() const final;
0067
0068
0069
0070
0071 std::vector<double> values() const final;
0072
0073
0074
0075
0076
0077
0078
0079 bool inside(const Vector2& lposition,
0080 const BoundaryCheck& bcheck) const final;
0081
0082
0083
0084
0085 std::ostream& toStream(std::ostream& sl) const final;
0086
0087
0088 double rMin() const final;
0089
0090
0091 double rMax() const final;
0092
0093
0094
0095 double get(BoundValues bValue) const { return m_values[bValue]; }
0096
0097
0098 bool coversFullAzimuth() const final;
0099
0100
0101
0102 bool insideRadialBounds(double R, double tolerance = 0.) const final;
0103
0104
0105 double binningValueR() const final;
0106
0107
0108 double binningValuePhi() const final;
0109
0110 private:
0111 std::array<double, eSize> m_values;
0112
0113
0114
0115 void checkConsistency() noexcept(false);
0116
0117
0118
0119
0120
0121 Vector2 shifted(const Vector2& lposition) const;
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133 std::vector<Vector2> vertices(unsigned int lseg) const final;
0134 };
0135
0136 inline double RadialBounds::rMin() const {
0137 return get(eMinR);
0138 }
0139
0140 inline double RadialBounds::rMax() const {
0141 return get(eMaxR);
0142 }
0143
0144 inline bool RadialBounds::coversFullAzimuth() const {
0145 return (get(eHalfPhiSector) == M_PI);
0146 }
0147
0148 inline bool RadialBounds::insideRadialBounds(double R, double tolerance) const {
0149 return (R + tolerance > get(eMinR) && R - tolerance < get(eMaxR));
0150 }
0151
0152 inline double RadialBounds::binningValueR() const {
0153 return 0.5 * (get(eMinR) + get(eMaxR));
0154 }
0155
0156 inline double RadialBounds::binningValuePhi() const {
0157 return get(eAveragePhi);
0158 }
0159
0160 inline std::vector<double> RadialBounds::values() const {
0161 std::vector<double> valvector;
0162 valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
0163 return valvector;
0164 }
0165
0166 inline void RadialBounds::checkConsistency() noexcept(false) {
0167 if (get(eMinR) < 0. || get(eMaxR) <= 0. || get(eMinR) > get(eMaxR)) {
0168 throw std::invalid_argument("RadialBounds: invalid radial setup");
0169 }
0170 if (get(eHalfPhiSector) < 0. || get(eHalfPhiSector) > M_PI) {
0171 throw std::invalid_argument("RadialBounds: invalid phi sector setup.");
0172 }
0173 if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) {
0174 throw std::invalid_argument("RadialBounds: invalid phi positioning.");
0175 }
0176 }
0177
0178 }