Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-18 08:20:46

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   /// Enumeration for the bound values
0033   enum BoundValues {
0034     eHalfLengthXnegY = 0,
0035     eHalfLengthXposY = 1,
0036     eHalfLengthY = 2,
0037     eRotationAngle = 3,
0038     eSize = 4
0039   };
0040 
0041   /// Constructor for symmetric Trapezoid
0042   ///
0043   /// @param halfXnegY minimal half length X, definition at negative Y
0044   /// @param halfXposY maximal half length X, definition at positive Y
0045   /// @param halfY half length Y - defined at x=0
0046   /// @param rotAngle: rotation angle of the bounds w.r.t coordinate axes
0047   explicit TrapezoidBounds(double halfXnegY, double halfXposY, double halfY,
0048                            double rotAngle = 0.) noexcept(false);
0049 
0050   /// Constructor for symmetric Trapezoid - from fixed size array
0051   ///
0052   /// @param values the values to be stream in
0053   explicit TrapezoidBounds(const std::array<double, eSize>& values) noexcept(
0054       false);
0055 
0056   /// @copydoc SurfaceBounds::type
0057   BoundsType type() const final { return eTrapezoid; }
0058 
0059   /// @copydoc SurfaceBounds::values
0060   std::vector<double> values() const final;
0061 
0062   /// @copydoc SurfaceBounds::inside
0063   ///
0064   /// The orientation of the Trapezoid is according to the figure above,
0065   /// in words: the shorter of the two parallel sides of the trapezoid
0066   /// intersects
0067   /// with the negative @f$ y @f$ - axis of the local frame.
0068   ///
0069   /// <br>
0070   /// The cases are:<br>
0071   /// (0) @f$ y @f$ or @f$ x @f$ bounds are 0 || 0<br>
0072   /// (1) the local position is outside @f$ y @f$ bounds <br>
0073   /// (2) the local position is inside @f$ y @f$ bounds, but outside maximum @f$
0074   /// x
0075   /// @f$ bounds  <br>
0076   /// (3) the local position is inside @f$ y @f$ bounds AND inside minimum @f$ x
0077   /// @f$ bounds <br>
0078   /// (4) the local position is inside @f$ y @f$ bounds AND inside maximum @f$ x
0079   /// @f$ bounds, so that it depends on the @f$ eta @f$ coordinate
0080   /// (5) the local position fails test of (4) <br>
0081   ///
0082   /// The inside check is done using single equations of straight lines and one
0083   /// has
0084   /// to take care if a point
0085   /// lies on the positive @f$ x @f$ half area(I) or the negative one(II).
0086   /// Denoting
0087   /// @f$ |x_{min}| @f$ and
0088   /// @f$ | x_{max} | @f$ as \c minHalfX respectively \c maxHalfX, such as @f$ |
0089   /// y_{H} | @f$ as \c halfY,
0090   /// the equations for the straing lines in (I) and (II) can be written as:<br>
0091   ///  <br>
0092   /// - (I):  @f$ y = \kappa_{I} x + \delta_{I} @f$ <br>
0093   /// - (II): @f$ y = \kappa_{II} x + \delta_{II} @f$ ,<br>
0094   ///  <br>
0095   /// where @f$  \kappa_{I} = - \kappa_{II} = 2 \frac{y_{H}}{x_{max} - x_{min}}
0096   /// @f$
0097   /// <br>
0098   /// and   @f$  \delta_{I} = \delta_{II} = - \frac{1}{2}\kappa_{I}(x_{max} +
0099   /// x_{min}) @f$
0100   bool inside(const Vector2& lposition) const final;
0101 
0102   /// @copydoc SurfaceBounds::closestPoint
0103   Vector2 closestPoint(const Vector2& lposition,
0104                        const SquareMatrix2& metric) const final;
0105 
0106   using SurfaceBounds::inside;
0107 
0108   /// @copydoc SurfaceBounds::center
0109   /// @note For TrapezoidBounds: returns center of symmetry (0,0), accounting for rotation
0110   Vector2 center() const final;
0111 
0112   /// Return the vertices
0113   ///
0114   /// @param ignoredSegments is and ignored parameter used to describe
0115   /// the number of segments to approximate curved sectors.
0116   ///
0117   /// @note the number of segments is ignored in this representation
0118   ///
0119   /// @return vector for vertices in 2D
0120   std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;
0121 
0122   // Bounding box representation
0123   const RectangleBounds& boundingBox() const final;
0124 
0125   /// Output Method for std::ostream
0126   ///
0127   /// @param sl is the ostream to be dumped into
0128   /// @return Modified ostream for chaining
0129   std::ostream& toStream(std::ostream& sl) const final;
0130 
0131   /// Access to the bound values
0132   /// @param bValue the class nested enum for the array access
0133   /// @return The bound value at the specified index
0134   double get(BoundValues bValue) const { return m_values[bValue]; }
0135 
0136  private:
0137   std::array<double, eSize> m_values;
0138   RectangleBounds m_boundingBox;
0139 
0140   void rotateBoundingBox() noexcept(false);
0141 
0142   /// Check the input values for consistency, will throw a logic_exception
0143   /// if consistency is not given
0144   void checkConsistency() noexcept(false);
0145 };
0146 
0147 }  // namespace Acts