Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:42:21

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/SurfaceBounds.hpp"
0013 
0014 #include <array>
0015 #include <iosfwd>
0016 #include <vector>
0017 
0018 namespace Acts {
0019 
0020 /// @class LineBounds
0021 ///
0022 /// Bounds for a LineSurface.
0023 class LineBounds : public SurfaceBounds {
0024  public:
0025   /// @enum BoundValues
0026   /// Enumeration for the bound values
0027   enum BoundValues : int { eR = 0, eHalfLengthZ = 1, eSize = 2 };
0028 
0029   /// Constructor
0030   ///
0031   /// @param r The radius of the line
0032   /// @param halfZ The half length in z
0033   explicit LineBounds(double r, double halfZ) noexcept(false)
0034       : m_values({r, halfZ}) {
0035     checkConsistency();
0036   }
0037 
0038   /// Constructor - from fixed size array
0039   ///
0040   /// @param values The bound values stored in a fixed size array
0041   explicit LineBounds(const std::array<double, eSize>& values) noexcept(false)
0042       : m_values(values) {
0043     checkConsistency();
0044   }
0045 
0046   /// @copydoc SurfaceBounds::type
0047   BoundsType type() const final { return eLine; }
0048 
0049   /// @copydoc SurfaceBounds::isCartesian
0050   bool isCartesian() const final { return true; }
0051 
0052   /// @copydoc SurfaceBounds::boundToCartesianJacobian
0053   SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final {
0054     (void)lposition;
0055     return SquareMatrix2::Identity();
0056   }
0057 
0058   /// @copydoc SurfaceBounds::boundToCartesianMetric
0059   SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final {
0060     (void)lposition;
0061     return SquareMatrix2::Identity();
0062   }
0063 
0064   /// Return the bound values as dynamically sized vector
0065   /// @return this returns a copy of the internal values
0066   std::vector<double> values() const final;
0067 
0068   /// @copydoc SurfaceBounds::inside
0069   bool inside(const Vector2& lposition) const final;
0070 
0071   /// @copydoc SurfaceBounds::closestPoint
0072   Vector2 closestPoint(const Vector2& lposition,
0073                        const SquareMatrix2& metric) const final;
0074 
0075   using SurfaceBounds::inside;
0076 
0077   /// @copydoc SurfaceBounds::center
0078   /// @note For LineBounds: returns (0,0) since bounds are symmetric around origin
0079   Vector2 center() const final;
0080 
0081   /// Output Method for std::ostream
0082   ///
0083   /// @param sl is the ostream to be dumped into
0084   /// @return Reference to the output stream for method chaining
0085   std::ostream& toStream(std::ostream& sl) const final;
0086 
0087   /// Access to the bound values
0088   /// @param bValue the class nested enum for the array access
0089   /// @return The bound value for the specified parameter
0090   double get(BoundValues bValue) const { return m_values[bValue]; }
0091 
0092  private:
0093   std::array<double, eSize> m_values;
0094 
0095   /// Check the input values for consistency, will throw a logic_exception
0096   /// if consistency is not given
0097   void checkConsistency() noexcept(false);
0098 };
0099 
0100 }  // namespace Acts