Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:18:27

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 PointBounds
0021 ///
0022 /// Bounds for a PointSurface. The local coordinates are Cartesian (x, y) in the
0023 /// measurement plane perpendicular to the track direction, so the bound is a
0024 /// disc of maximum distance @c eR around the point: a local position is inside
0025 /// if @f$ x^2 + y^2 \le R^2 @f$.
0026 ///
0027 /// @note Cartesian (x, y) is used deliberately instead of polar (r, phi)
0028 /// because at the point itself (r = 0) the azimuth phi is degenerate.
0029 class PointBounds : public SurfaceBounds {
0030  public:
0031   /// @enum BoundValues
0032   /// Enumeration for the bound values
0033   enum BoundValues : int { eR = 0, eSize = 1 };
0034 
0035   /// Constructor
0036   ///
0037   /// @param r The maximum distance from the point
0038   explicit PointBounds(double r) noexcept(false) : m_values({r}) {
0039     checkConsistency();
0040   }
0041 
0042   /// Constructor - from fixed size array
0043   ///
0044   /// @param values The bound values stored in a fixed size array
0045   explicit PointBounds(const std::array<double, eSize>& values) noexcept(false)
0046       : m_values(values) {
0047     checkConsistency();
0048   }
0049 
0050   /// @copydoc SurfaceBounds::type
0051   BoundsType type() const final { return ePoint; }
0052 
0053   /// @copydoc SurfaceBounds::isCartesian
0054   bool isCartesian() const final { return true; }
0055 
0056   /// @copydoc SurfaceBounds::boundToCartesianJacobian
0057   SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final {
0058     static_cast<void>(lposition);
0059     return SquareMatrix2::Identity();
0060   }
0061 
0062   /// @copydoc SurfaceBounds::boundToCartesianMetric
0063   SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final {
0064     static_cast<void>(lposition);
0065     return SquareMatrix2::Identity();
0066   }
0067 
0068   /// Return the bound values as dynamically sized vector
0069   /// @return this returns a copy of the internal values
0070   std::vector<double> values() const final;
0071 
0072   /// @copydoc SurfaceBounds::inside
0073   bool inside(const Vector2& lposition) const final;
0074 
0075   /// @copydoc SurfaceBounds::closestPoint
0076   Vector2 closestPoint(const Vector2& lposition,
0077                        const SquareMatrix2& metric) const final;
0078 
0079   using SurfaceBounds::inside;
0080 
0081   /// @copydoc SurfaceBounds::center
0082   /// @note For PointBounds: returns (0,0) since the disc is centered on origin
0083   Vector2 center() const final { return Vector2::Zero(); }
0084 
0085   /// Output Method for std::ostream
0086   ///
0087   /// @param sl is the ostream to be dumped into
0088   /// @return Reference to the output stream for method chaining
0089   std::ostream& toStream(std::ostream& sl) const final;
0090 
0091   /// Access to the bound values
0092   /// @param bValue the class nested enum for the array access
0093   /// @return The bound value for the specified parameter
0094   double get(BoundValues bValue) const { return m_values[bValue]; }
0095 
0096  private:
0097   std::array<double, eSize> m_values;
0098 
0099   /// Check the input values for consistency, will throw a logic_exception
0100   /// if consistency is not given
0101   void checkConsistency() noexcept(false);
0102 };
0103 
0104 }  // namespace Acts