File indexing completed on 2025-11-04 09:38:58
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0013 #include "Acts/Surfaces/DiscBounds.hpp"
0014 #include "Acts/Surfaces/SurfaceBounds.hpp"
0015 
0016 #include <algorithm>
0017 #include <array>
0018 #include <cmath>
0019 #include <iosfwd>
0020 #include <numbers>
0021 #include <vector>
0022 
0023 namespace Acts {
0024 
0025 
0026 
0027 
0028 
0029 
0030 
0031 class DiscTrapezoidBounds : public DiscBounds {
0032  public:
0033   enum BoundValues : int {
0034     eHalfLengthXminR = 0,
0035     eHalfLengthXmaxR = 1,
0036     eMinR = 2,
0037     eMaxR = 3,
0038     eAveragePhi = 4,
0039     eStereo = 5,
0040     eSize = 6
0041   };
0042 
0043   
0044   
0045   
0046   
0047   
0048   
0049   
0050   
0051   DiscTrapezoidBounds(double halfXminR, double halfXmaxR, double minR,
0052                       double maxR, double avgPhi = std::numbers::pi / 2.,
0053                       double stereo = 0.) noexcept(false);
0054 
0055   
0056   
0057   
0058   DiscTrapezoidBounds(const std::array<double, eSize>& values) noexcept(false)
0059       : m_values(values) {
0060     checkConsistency();
0061   }
0062 
0063   BoundsType type() const final { return SurfaceBounds::eDiscTrapezoid; }
0064 
0065   
0066   
0067   
0068   std::vector<double> values() const final;
0069 
0070   
0071   
0072   
0073   
0074   
0075   
0076   bool inside(const Vector2& lposition,
0077               const BoundaryTolerance& boundaryTolerance =
0078                   BoundaryTolerance::None()) const final;
0079 
0080   
0081   std::ostream& toStream(std::ostream& sl) const final;
0082 
0083   
0084   
0085   double get(BoundValues bValue) const { return m_values[bValue]; }
0086 
0087   
0088   double rMin() const final { return get(eMinR); }
0089 
0090   
0091   double rMax() const final { return get(eMaxR); }
0092 
0093   
0094   double rCenter() const {
0095     double rmin = get(eMinR);
0096     double rmax = get(eMaxR);
0097     double hxmin = get(eHalfLengthXminR);
0098     double hxmax = get(eHalfLengthXmaxR);
0099     auto hmin = std::sqrt(rmin * rmin - hxmin * hxmin);
0100     auto hmax = std::sqrt(rmax * rmax - hxmax * hxmax);
0101     return 0.5 * (hmin + hmax);
0102   }
0103 
0104   
0105   double stereo() const { return get(eStereo); }
0106 
0107   
0108   double halfPhiSector() const {
0109     auto minHalfPhi = std::asin(get(eHalfLengthXminR) / get(eMinR));
0110     auto maxHalfPhi = std::asin(get(eHalfLengthXmaxR) / get(eMaxR));
0111     return std::max(minHalfPhi, maxHalfPhi);
0112   }
0113 
0114   
0115   double halfLengthY() const {
0116     double rmin = get(eMinR);
0117     double rmax = get(eMaxR);
0118     double hxmin = get(eHalfLengthXminR);
0119     double hxmax = get(eHalfLengthXmaxR);
0120     auto hmin = std::sqrt(rmin * rmin - hxmin * hxmin);
0121     auto hmax = std::sqrt(rmax * rmax - hxmax * hxmax);
0122     return 0.5 * (hmax - hmin);
0123   }
0124 
0125   
0126   bool coversFullAzimuth() const final { return false; }
0127 
0128   
0129   
0130   bool insideRadialBounds(double R, double tolerance = 0.) const final {
0131     return (R + tolerance > get(eMinR) && R - tolerance < get(eMaxR));
0132   }
0133 
0134   
0135   double binningValueR() const final { return 0.5 * (get(eMinR) + get(eMaxR)); }
0136 
0137   
0138   double binningValuePhi() const final { return get(eAveragePhi); }
0139 
0140   
0141   
0142   
0143   
0144   
0145   
0146   
0147   std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;
0148 
0149  private:
0150   std::array<double, eSize> m_values;
0151 
0152   
0153   double m_ymax = 0;
0154 
0155   
0156   
0157   void checkConsistency() noexcept(false);
0158 
0159   
0160   
0161   
0162   
0163   Vector2 toLocalCartesian(const Vector2& lposition) const;
0164 
0165   
0166   
0167   
0168   
0169   SquareMatrix2 jacobianToLocalCartesian(const Vector2& lposition) const;
0170 };
0171 
0172 }