Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11: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/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   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   TrapezoidBounds(const std::array<double, eSize>& values) noexcept(false);
0053 
0054   BoundsType type() const final { return SurfaceBounds::eTrapezoid; }
0055 
0056   std::vector<double> values() const final;
0057 
0058   /// The orientation of the Trapezoid is according to the figure above,
0059   /// in words: the shorter of the two parallel sides of the trapezoid
0060   /// intersects
0061   /// with the negative @f$ y @f$ - axis of the local frame.
0062   ///
0063   /// <br>
0064   /// The cases are:<br>
0065   /// (0) @f$ y @f$ or @f$ x @f$ bounds are 0 || 0<br>
0066   /// (1) the local position is outside @f$ y @f$ bounds <br>
0067   /// (2) the local position is inside @f$ y @f$ bounds, but outside maximum @f$
0068   /// x
0069   /// @f$ bounds  <br>
0070   /// (3) the local position is inside @f$ y @f$ bounds AND inside minimum @f$ x
0071   /// @f$ bounds <br>
0072   /// (4) the local position is inside @f$ y @f$ bounds AND inside maximum @f$ x
0073   /// @f$ bounds, so that it depends on the @f$ eta @f$ coordinate
0074   /// (5) the local position fails test of (4) <br>
0075   ///
0076   /// The inside check is done using single equations of straight lines and one
0077   /// has
0078   /// to take care if a point
0079   /// lies on the positive @f$ x @f$ half area(I) or the negative one(II).
0080   /// Denoting
0081   /// @f$ |x_{min}| @f$ and
0082   /// @f$ | x_{max} | @f$ as \c minHalfX respectively \c maxHalfX, such as @f$ |
0083   /// y_{H} | @f$ as \c halfY,
0084   /// the equations for the straing lines in (I) and (II) can be written as:<br>
0085   ///  <br>
0086   /// - (I):  @f$ y = \kappa_{I} x + \delta_{I} @f$ <br>
0087   /// - (II): @f$ y = \kappa_{II} x + \delta_{II} @f$ ,<br>
0088   ///  <br>
0089   /// where @f$  \kappa_{I} = - \kappa_{II} = 2 \frac{y_{H}}{x_{max} - x_{min}}
0090   /// @f$
0091   /// <br>
0092   /// and   @f$  \delta_{I} = \delta_{II} = - \frac{1}{2}\kappa_{I}(x_{max} +
0093   /// x_{min}) @f$
0094   ///
0095   /// @param lposition Local position (assumed to be in right surface frame)
0096   /// @param boundaryTolerance boundary check directive
0097   ///
0098   /// @return boolean indicator for the success of this operation
0099   bool inside(const Vector2& lposition,
0100               const BoundaryTolerance& boundaryTolerance) const final;
0101 
0102   /// Return the vertices
0103   ///
0104   /// @param ignoredSegments is and ignored parameter used to describe
0105   /// the number of segments to approximate curved sectors.
0106   ///
0107   /// @note the number of segments is ignored in this representation
0108   ///
0109   /// @return vector for vertices in 2D
0110   std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;
0111 
0112   // Bounding box representation
0113   const RectangleBounds& boundingBox() const final;
0114 
0115   /// Output Method for std::ostream
0116   ///
0117   /// @param sl is the ostream to be dumped into
0118   std::ostream& toStream(std::ostream& sl) const final;
0119 
0120   /// Access to the bound values
0121   /// @param bValue the class nested enum for the array access
0122   double get(BoundValues bValue) const { return m_values[bValue]; }
0123 
0124  private:
0125   std::array<double, eSize> m_values;
0126   RectangleBounds m_boundingBox;
0127 
0128   void rotateBoundingBox() noexcept(false);
0129 
0130   /// Check the input values for consistency, will throw a logic_exception
0131   /// if consistency is not given
0132   void checkConsistency() noexcept(false);
0133 };
0134 
0135 }  // namespace Acts