Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:23:35

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