Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:13:04

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Surfaces/PlanarBounds.hpp"
0013 #include "Acts/Surfaces/RectangleBounds.hpp"
0014 #include "Acts/Surfaces/SurfaceBounds.hpp"
0015 
0016 #include <array>
0017 #include <iosfwd>
0018 #include <vector>
0019 
0020 namespace Acts {
0021 
0022 /// @class TrapezoidBounds
0023 ///
0024 /// Bounds for a trapezoidal, planar Surface.
0025 ///
0026 /// @image html TrapezoidBounds.gif
0027 ///
0028 /// @todo can be speed optimized by calculating kappa/delta and caching it
0029 class TrapezoidBounds : public PlanarBounds {
0030  public:
0031   enum BoundValues {
0032     eHalfLengthXnegY = 0,
0033     eHalfLengthXposY = 1,
0034     eHalfLengthY = 2,
0035     eRotationAngle = 3,
0036     eSize = 4
0037   };
0038 
0039   /// Constructor for symmetric Trapezoid
0040   ///
0041   /// @param halfXnegY minimal half length X, definition at negative Y
0042   /// @param halfXposY maximal half length X, definition at positive Y
0043   /// @param halfY half length Y - defined at x=0
0044   /// @param rotAngle: rotation angle of the bounds w.r.t coordinate axes
0045   explicit TrapezoidBounds(double halfXnegY, double halfXposY, double halfY,
0046                            double rotAngle = 0.) noexcept(false);
0047 
0048   /// Constructor for symmetric Trapezoid - from fixed size array
0049   ///
0050   /// @param values the values to be stream in
0051   explicit TrapezoidBounds(const std::array<double, eSize>& values) noexcept(
0052       false);
0053 
0054   /// @copydoc SurfaceBounds::type
0055   BoundsType type() const final { return eTrapezoid; }
0056 
0057   /// @copydoc SurfaceBounds::values
0058   std::vector<double> values() const final;
0059 
0060   /// @copydoc SurfaceBounds::inside
0061   ///
0062   /// The orientation of the Trapezoid is according to the figure above,
0063   /// in words: the shorter of the two parallel sides of the trapezoid
0064   /// intersects
0065   /// with the negative @f$ y @f$ - axis of the local frame.
0066   ///
0067   /// <br>
0068   /// The cases are:<br>
0069   /// (0) @f$ y @f$ or @f$ x @f$ bounds are 0 || 0<br>
0070   /// (1) the local position is outside @f$ y @f$ bounds <br>
0071   /// (2) the local position is inside @f$ y @f$ bounds, but outside maximum @f$
0072   /// x
0073   /// @f$ bounds  <br>
0074   /// (3) the local position is inside @f$ y @f$ bounds AND inside minimum @f$ x
0075   /// @f$ bounds <br>
0076   /// (4) the local position is inside @f$ y @f$ bounds AND inside maximum @f$ x
0077   /// @f$ bounds, so that it depends on the @f$ eta @f$ coordinate
0078   /// (5) the local position fails test of (4) <br>
0079   ///
0080   /// The inside check is done using single equations of straight lines and one
0081   /// has
0082   /// to take care if a point
0083   /// lies on the positive @f$ x @f$ half area(I) or the negative one(II).
0084   /// Denoting
0085   /// @f$ |x_{min}| @f$ and
0086   /// @f$ | x_{max} | @f$ as \c minHalfX respectively \c maxHalfX, such as @f$ |
0087   /// y_{H} | @f$ as \c halfY,
0088   /// the equations for the straing lines in (I) and (II) can be written as:<br>
0089   ///  <br>
0090   /// - (I):  @f$ y = \kappa_{I} x + \delta_{I} @f$ <br>
0091   /// - (II): @f$ y = \kappa_{II} x + \delta_{II} @f$ ,<br>
0092   ///  <br>
0093   /// where @f$  \kappa_{I} = - \kappa_{II} = 2 \frac{y_{H}}{x_{max} - x_{min}}
0094   /// @f$
0095   /// <br>
0096   /// and   @f$  \delta_{I} = \delta_{II} = - \frac{1}{2}\kappa_{I}(x_{max} +
0097   /// x_{min}) @f$
0098   bool inside(const Vector2& lposition) const final;
0099 
0100   /// @copydoc SurfaceBounds::closestPoint
0101   Vector2 closestPoint(const Vector2& lposition,
0102                        const SquareMatrix2& metric) const final;
0103 
0104   using SurfaceBounds::inside;
0105 
0106   /// @copydoc SurfaceBounds::center
0107   /// @note For TrapezoidBounds: returns center of symmetry (0,0), accounting for rotation
0108   Vector2 center() const final;
0109 
0110   /// Return the vertices
0111   ///
0112   /// @param ignoredSegments is and ignored parameter used to describe
0113   /// the number of segments to approximate curved sectors.
0114   ///
0115   /// @note the number of segments is ignored in this representation
0116   ///
0117   /// @return vector for vertices in 2D
0118   std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;
0119 
0120   // Bounding box representation
0121   const RectangleBounds& boundingBox() const final;
0122 
0123   /// Output Method for std::ostream
0124   ///
0125   /// @param sl is the ostream to be dumped into
0126   std::ostream& toStream(std::ostream& sl) const final;
0127 
0128   /// Access to the bound values
0129   /// @param bValue the class nested enum for the array access
0130   double get(BoundValues bValue) const { return m_values[bValue]; }
0131 
0132  private:
0133   std::array<double, eSize> m_values;
0134   RectangleBounds m_boundingBox;
0135 
0136   void rotateBoundingBox() noexcept(false);
0137 
0138   /// Check the input values for consistency, will throw a logic_exception
0139   /// if consistency is not given
0140   void checkConsistency() noexcept(false);
0141 };
0142 
0143 }  // namespace Acts