Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-20 07:58:23

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/Tolerance.hpp"
0012 #include "Acts/Surfaces/Surface.hpp"
0013 
0014 namespace Acts {
0015 
0016 /// A physical surface which does not depend on the direction you look at it
0017 /// from. As such it narrows the interface of @c Surface and allows
0018 /// inspection without providing a global position and direction.
0019 class RegularSurface : public Surface {
0020  public:
0021   // Reuse all constructors from the base class
0022   using Surface::Surface;
0023 
0024   /// Calculate the normal vector of the surface
0025   /// This overload requires an on-surface local position
0026   ///
0027   /// @param gctx The current geometry context object, e.g. alignment
0028   /// @param lposition is the local position where the normal vector is
0029   /// constructed
0030   ///
0031   /// @return normal vector by value
0032   virtual Vector3 normal(const GeometryContext& gctx,
0033                          const Vector2& lposition) const = 0;
0034 
0035   /// Calculate the normal vector of the surface
0036   /// This overload accepts a global position
0037   ///
0038   /// @param position is the global position where the normal vector is
0039   /// constructed
0040   /// @param gctx The current geometry context object, e.g. alignment
0041   /// @return normal vector by value
0042   virtual Vector3 normal(const GeometryContext& gctx,
0043                          const Vector3& position) const = 0;
0044 
0045   /// Calculate the normal vector of the surface
0046   /// This overload is fully generic, fulfills the @ref Surface interface and
0047   /// accepts a global position and a direction. For @c RegularSurface this is
0048   /// equivalent to the @ref normal
0049   /// overload, ignoring the @p direction
0050   /// @param gctx The current geometry context object, e.g. alignment
0051   /// @param pos is the global position where the normal vector is constructed
0052   /// @param direction is the direction of the normal vector (ignored for @c RegularSurface)
0053   /// @return Normal vector at the given position
0054   Vector3 normal(const GeometryContext& gctx, const Vector3& pos,
0055                  const Vector3& direction) const final;
0056 
0057   /// Convert a global position to a local one this is the most generic
0058   /// interface, which is implemented by all surfaces
0059   /// @note The @p position is required to be on-surface, which is indicated by
0060   ///       the `Result` return value.
0061   /// @param gctx The current geometry context object, e.g. alignment
0062   /// @param position is the global position to be converted
0063   /// @param direction is the direction of the local position (ignored for @c RegularSurface)
0064   /// @param tolerance is the tolerance for the on-surface check
0065   /// @return Result type containing local position by value
0066   Result<Vector2> globalToLocal(
0067       const GeometryContext& gctx, const Vector3& position,
0068       const Vector3& direction,
0069       double tolerance = s_onSurfaceTolerance) const final;
0070 
0071   /// Convert a global position to a local one.
0072   /// @note The @p position is required to be on-surface, which is indicated by
0073   ///       the `Result` return value.
0074   /// @param gctx The current geometry context object, e.g. alignment
0075   /// @param position is the global position to be converted
0076   /// @param tolerance is the tolerance for the on-surface check
0077   /// @return Result type containing local position by value
0078   virtual Result<Vector2> globalToLocal(
0079       const GeometryContext& gctx, const Vector3& position,
0080       double tolerance = s_onSurfaceTolerance) const = 0;
0081 
0082   /// Local to global transformation. This is the most generic interface,
0083   /// which is implemented by all surfaces.
0084   ///
0085   /// @param gctx The current geometry context object, e.g. alignment
0086   /// @param lposition local 2D position in specialized surface frame
0087   /// @param direction global 3D momentum direction (ignored for @c RegularSurface)
0088   ///
0089   /// @return The global position by value
0090   Vector3 localToGlobal(const GeometryContext& gctx, const Vector2& lposition,
0091                         const Vector3& direction) const final;
0092 
0093   /// Local to global transformation.
0094   ///
0095   /// @param gctx The current geometry context object, e.g. alignment
0096   /// @param lposition local 2D position in specialized surface frame
0097   ///
0098   /// @return The global position by value
0099   virtual Vector3 localToGlobal(const GeometryContext& gctx,
0100                                 const Vector2& lposition) const = 0;
0101 
0102   /// The geometric onSurface method
0103   ///
0104   /// Geometrical check whether position is on Surface
0105   ///
0106   /// @param gctx The current geometry context object, e.g. alignment
0107   /// @param position global position to be evaludated
0108   /// @param boundaryTolerance BoundaryTolerance directive for this onSurface check
0109   /// @param tolerance optional tolerance within which a point is considered on surface
0110   ///
0111   /// @return boolean indication if operation was successful
0112   bool isOnSurface(
0113       const GeometryContext& gctx, const Vector3& position,
0114       const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::None(),
0115       double tolerance = s_onSurfaceTolerance) const;
0116 
0117   using Surface::isOnSurface;
0118 };
0119 
0120 }  // namespace Acts