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/SurfaceBounds.hpp"
0014 
0015 #include <array>
0016 #include <cmath>
0017 #include <cstdlib>
0018 #include <iosfwd>
0019 #include <numbers>
0020 #include <vector>
0021 
0022 namespace Acts {
0023 
0024 ///  @class ConeBounds
0025 ///
0026 ///  Bounds for a conical surface,
0027 ///  the opening angle is stored in \f$ \tan(\alpha) \f$ and always positively
0028 /// defined.
0029 ///  The cone can open to both sides, steered by \f$ z_min \f$ and \f$ z_max
0030 ///  \f$.
0031 ///
0032 ///  @image html ConeBounds.gif
0033 ///
0034 class ConeBounds : public SurfaceBounds {
0035  public:
0036   enum BoundValues : int {
0037     eAlpha = 0,
0038     eMinZ = 1,
0039     eMaxZ = 2,
0040     eHalfPhiSector = 3,
0041     eAveragePhi = 4,
0042     eSize = 5
0043   };
0044 
0045   /// Constructor - open cone with alpha, by default a full cone
0046   /// but optionally can make a conical section
0047   ///
0048   /// @param alpha is the opening angle of the cone
0049   /// @param symm is the boolean indicating if the cone is symmetric in +/- z
0050   /// @param halfphi is the half opening angle (default is pi)
0051   /// @param avphi is the phi value around which the bounds are opened
0052   /// (default=0)
0053   ConeBounds(double alpha, bool symm, double halfphi = std::numbers::pi,
0054              double avphi = 0.) noexcept(false);
0055 
0056   /// Constructor - open cone with alpha, minz and maxz, by
0057   /// default a full cone but can optionally make it a conical section
0058   ///
0059   /// @param alpha is the opening angle of the cone
0060   /// @param minz cone expanding from minimal z
0061   /// @param maxz cone expanding to maximal z
0062   /// @param halfphi is the half opening angle (default is pi)
0063   /// @param avphi is the phi value around which the bounds are opened
0064   /// (default=0)
0065   ConeBounds(double alpha, double minz, double maxz,
0066              double halfphi = std::numbers::pi,
0067              double avphi = 0.) noexcept(false);
0068 
0069   /// Constructor - from parameters array
0070   ///
0071   /// @param values The parameter array
0072   ConeBounds(const std::array<double, eSize>& values) noexcept(false);
0073 
0074   BoundsType type() const final { return SurfaceBounds::eCone; }
0075 
0076   /// Return the bound values as dynamically sized vector
0077   ///
0078   /// @return this returns a copy of the internal values
0079   std::vector<double> values() const final;
0080 
0081   /// inside method for local position
0082   ///
0083   /// @param lposition is the local position to be checked
0084   /// @param boundaryTolerance is the boundary check directive
0085   /// @return is a boolean indicating if the position is inside
0086   bool inside(const Vector2& lposition,
0087               const BoundaryTolerance& boundaryTolerance =
0088                   BoundaryTolerance::None()) const final;
0089 
0090   /// Output Method for std::ostream
0091   ///
0092   /// @param sl is the ostrea into which the dump is done
0093   /// @return is the input object
0094   std::ostream& toStream(std::ostream& sl) const final;
0095 
0096   /// Return the radius at a specific z values
0097   ///
0098   /// @param z is the z value for which r is requested
0099   /// @return is the r value associated with z
0100   double r(double z) const { return std::abs(z * m_tanAlpha); }
0101 
0102   /// Return tangent of alpha (pre-computed)
0103   double tanAlpha() const { return m_tanAlpha; }
0104 
0105   /// Access to the bound values
0106   /// @param bValue the class nested enum for the array access
0107   double get(BoundValues bValue) const { return m_values[bValue]; }
0108 
0109  private:
0110   std::array<double, eSize> m_values;
0111   double m_tanAlpha;
0112 
0113   /// Check the input values for consistency, will throw a logic_exception
0114   /// if consistency is not given
0115   void checkConsistency() noexcept(false);
0116 
0117   /// Private helper function to shift a local 2D position
0118   ///
0119   /// Shift r-phi coordinate to be centered around the average phi.
0120   ///
0121   /// @param lposition The original local position
0122   Vector2 shifted(const Vector2& lposition) const;
0123 };
0124 
0125 }  // namespace Acts