File indexing completed on 2025-06-30 08:07:08
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/Surfaces/BoundaryTolerance.hpp"
0014 #include "Acts/Surfaces/SurfaceBounds.hpp"
0015 #include "Acts/Utilities/detail/periodic.hpp"
0016
0017 #include <array>
0018 #include <cmath>
0019 #include <cstdlib>
0020 #include <iosfwd>
0021 #include <stdexcept>
0022 #include <vector>
0023
0024 namespace Acts {
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 class ConeBounds : public SurfaceBounds {
0038 public:
0039 enum BoundValues : int {
0040 eAlpha = 0,
0041 eMinZ = 1,
0042 eMaxZ = 2,
0043 eHalfPhiSector = 3,
0044 eAveragePhi = 4,
0045 eSize = 5
0046 };
0047
0048 ConeBounds() = delete;
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 ConeBounds(double alpha, bool symm, double halfphi = M_PI,
0059 double avphi = 0.) noexcept(false);
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070 ConeBounds(double alpha, double minz, double maxz, double halfphi = M_PI,
0071 double avphi = 0.) noexcept(false);
0072
0073
0074
0075
0076 ConeBounds(const std::array<double, eSize>& values) noexcept(false);
0077
0078 ~ConeBounds() override = default;
0079
0080 BoundsType type() const final;
0081
0082
0083
0084
0085 std::vector<double> values() const final;
0086
0087
0088
0089
0090
0091
0092 bool inside(const Vector2& lposition,
0093 const BoundaryTolerance& boundaryTolerance =
0094 BoundaryTolerance::None()) const final;
0095
0096
0097
0098
0099
0100 std::ostream& toStream(std::ostream& sl) const final;
0101
0102
0103
0104
0105
0106 double r(double z) const;
0107
0108
0109 double tanAlpha() const;
0110
0111
0112
0113 double get(BoundValues bValue) const { return m_values[bValue]; }
0114
0115 private:
0116 std::array<double, eSize> m_values;
0117 double m_tanAlpha;
0118
0119
0120
0121 void checkConsistency() noexcept(false);
0122
0123
0124
0125
0126 Vector2 shifted(const Vector2& lposition) const;
0127 };
0128
0129 inline double ConeBounds::r(double z) const {
0130 return std::abs(z * m_tanAlpha);
0131 }
0132
0133 inline double ConeBounds::tanAlpha() const {
0134 return m_tanAlpha;
0135 }
0136
0137 inline std::vector<double> ConeBounds::values() const {
0138 std::vector<double> valvector;
0139 valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
0140 return valvector;
0141 }
0142
0143 inline void ConeBounds::checkConsistency() noexcept(false) {
0144 if (get(eAlpha) < 0. || get(eAlpha) >= M_PI) {
0145 throw std::invalid_argument("ConeBounds: invalid open angle.");
0146 }
0147 if (get(eMinZ) > get(eMaxZ) ||
0148 std::abs(get(eMinZ) - get(eMaxZ)) < s_epsilon) {
0149 throw std::invalid_argument("ConeBounds: invalid z range setup.");
0150 }
0151 if (get(eHalfPhiSector) < 0. || abs(eHalfPhiSector) > M_PI) {
0152 throw std::invalid_argument("ConeBounds: invalid phi sector setup.");
0153 }
0154 if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) {
0155 throw std::invalid_argument("ConeBounds: invalid phi positioning.");
0156 }
0157 }
0158
0159 }