Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:03

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 <numbers>
0020 #include <vector>
0021 
0022 namespace Acts {
0023 
0024 /// @class EllipseBounds
0025 ///
0026 /// @image html EllipseBounds.png
0027 ///
0028 /// Class to describe the bounds for a planar ellispoid
0029 /// surface.
0030 ///
0031 /// By providing an argument for hphisec, the bounds can
0032 /// be restricted to a phi-range around the center position.
0033 class EllipseBounds : public PlanarBounds {
0034  public:
0035   enum BoundValues {
0036     eInnerRx = 0,
0037     eInnerRy = 1,
0038     eOuterRx = 2,
0039     eOuterRy = 3,
0040     eHalfPhiSector = 4,
0041     eAveragePhi = 5,
0042     eSize = 6
0043   };
0044 
0045   /// Constructor for full of an ellipsoid ring
0046   ///
0047   /// @param innerRx The inner ellipse radius in x
0048   /// @param innerRy The inner ellipse radius in y
0049   /// @param outerRx The outer ellipse radius in x
0050   /// @param outerRy The outer ellipse radius in y
0051   /// @param halfPhi spanning phi sector (is set to pi as default)
0052   /// @param averagePhi average phi (is set to 0. as default)
0053   EllipseBounds(double innerRx, double innerRy, double outerRx, double outerRy,
0054                 double halfPhi = std::numbers::pi,
0055                 double averagePhi = 0.) noexcept(false)
0056       : m_values({innerRx, innerRy, outerRx, outerRy, halfPhi, averagePhi}),
0057         m_boundingBox(m_values[eInnerRy], m_values[eOuterRy]) {
0058     checkConsistency();
0059   }
0060 
0061   /// Constructor - from fixed size array
0062   ///
0063   /// @param values The parameter values
0064   EllipseBounds(const std::array<double, eSize>& values) noexcept(false)
0065       : m_values(values), m_boundingBox(values[eInnerRy], values[eOuterRy]) {
0066     checkConsistency();
0067   }
0068 
0069   BoundsType type() const final { return SurfaceBounds::eEllipse; }
0070 
0071   /// Return the bound values as dynamically sized vector
0072   ///
0073   /// @return this returns a copy of the internal values
0074   std::vector<double> values() const final;
0075 
0076   /// This method checks if the point given in the local coordinates is between
0077   /// two ellipsoids if only tol0 is given and additional in the phi sector is
0078   /// tol1 is given
0079   ///
0080   /// @warning This **only** works for tolerance-based checks
0081   ///
0082   /// @param lposition Local position (assumed to be in right surface frame)
0083   /// @param boundaryTolerance boundary check directive
0084   /// @return boolean indicator for the success of this operation
0085   bool inside(const Vector2& lposition,
0086               const BoundaryTolerance& boundaryTolerance) const final;
0087 
0088   /// Return the vertices
0089   ///
0090   /// @param quarterSegments is the number of segments to approximate a quarter
0091   /// of a circle. In order to symmetrize fully closed and sectoral cylinders,
0092   /// also in the first case the two end points are given (albeit they overlap)
0093   /// in -pi / pi
0094   ///
0095   /// @return vector for vertices in 2D
0096   std::vector<Vector2> vertices(unsigned int quarterSegments) const final;
0097 
0098   // Bounding box representation
0099   const RectangleBounds& boundingBox() const final;
0100 
0101   /// Output Method for std::ostream
0102   std::ostream& toStream(std::ostream& sl) const final;
0103 
0104   /// Access to the bound values
0105   /// @param bValue the class nested enum for the array access
0106   double get(BoundValues bValue) const { return m_values[bValue]; }
0107 
0108  private:
0109   std::array<double, eSize> m_values;
0110   RectangleBounds m_boundingBox;
0111 
0112   /// Check the input values for consistency, will throw a logic_exception
0113   /// if consistency is not given
0114   void checkConsistency() noexcept(false);
0115 };
0116 
0117 }  // namespace Acts