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/Surfaces/BoundaryCheck.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 BoundaryCheck& bcheck = BoundaryCheck(true)) const final;
0094
0095
0096
0097
0098
0099 std::ostream& toStream(std::ostream& sl) const final;
0100
0101
0102
0103
0104
0105 double r(double z) const;
0106
0107
0108 double tanAlpha() const;
0109
0110
0111
0112 double get(BoundValues bValue) const { return m_values[bValue]; }
0113
0114 private:
0115 std::array<double, eSize> m_values;
0116 double m_tanAlpha;
0117
0118
0119
0120 void checkConsistency() noexcept(false);
0121
0122
0123
0124
0125 Vector2 shifted(const Vector2& lposition) const;
0126 };
0127
0128 inline double ConeBounds::r(double z) const {
0129 return std::abs(z * m_tanAlpha);
0130 }
0131
0132 inline double ConeBounds::tanAlpha() const {
0133 return m_tanAlpha;
0134 }
0135
0136 inline std::vector<double> ConeBounds::values() const {
0137 std::vector<double> valvector;
0138 valvector.insert(valvector.begin(), m_values.begin(), m_values.end());
0139 return valvector;
0140 }
0141
0142 inline void ConeBounds::checkConsistency() noexcept(false) {
0143 if (get(eAlpha) < 0. || get(eAlpha) >= M_PI) {
0144 throw std::invalid_argument("ConeBounds: invalid open angle.");
0145 }
0146 if (get(eMinZ) > get(eMaxZ) ||
0147 std::abs(get(eMinZ) - get(eMaxZ)) < s_epsilon) {
0148 throw std::invalid_argument("ConeBounds: invalid z range setup.");
0149 }
0150 if (get(eHalfPhiSector) < 0. || abs(eHalfPhiSector) > M_PI) {
0151 throw std::invalid_argument("ConeBounds: invalid phi sector setup.");
0152 }
0153 if (get(eAveragePhi) != detail::radian_sym(get(eAveragePhi))) {
0154 throw std::invalid_argument("ConeBounds: invalid phi positioning.");
0155 }
0156 }
0157
0158 }