Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-13 07:50:20

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