Back to home page

EIC code displayed by LXR

 
 

    


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

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   Vector3 normal(const GeometryContext& gctx, const Vector3& pos,
0054                  const Vector3& direction) const final;
0055 
0056   /// Convert a global position to a local one this is the most generic
0057   /// interface, which is implemented by all surfaces
0058   /// @note The @p position is required to be on-surface, which is indicated by
0059   ///       the `Result` return value.
0060   /// @param gctx The current geometry context object, e.g. alignment
0061   /// @param position is the global position to be converted
0062   /// @param direction is the direction of the local position (ignored for @c RegularSurface)
0063   /// @param tolerance is the tolerance for the on-surface check
0064   /// @return Result type containing local position by value
0065   Result<Vector2> globalToLocal(
0066       const GeometryContext& gctx, const Vector3& position,
0067       const Vector3& direction,
0068       double tolerance = s_onSurfaceTolerance) const final;
0069 
0070   /// Convert a global position to a local one.
0071   /// @note The @p position is required to be on-surface, which is indicated by
0072   ///       the `Result` return value.
0073   /// @param gctx The current geometry context object, e.g. alignment
0074   /// @param position is the global position to be converted
0075   /// @param tolerance is the tolerance for the on-surface check
0076   /// @return Result type containing local position by value
0077   virtual Result<Vector2> globalToLocal(
0078       const GeometryContext& gctx, const Vector3& position,
0079       double tolerance = s_onSurfaceTolerance) const = 0;
0080 
0081   /// Local to global transformation. This is the most generic interface,
0082   /// which is implemented by all surfaces.
0083   ///
0084   /// @param gctx The current geometry context object, e.g. alignment
0085   /// @param lposition local 2D position in specialized surface frame
0086   /// @param direction global 3D momentum direction (ignored for @c RegularSurface)
0087   ///
0088   /// @return The global position by value
0089   Vector3 localToGlobal(const GeometryContext& gctx, const Vector2& lposition,
0090                         const Vector3& direction) const final;
0091 
0092   /// Local to global transformation.
0093   ///
0094   /// @param gctx The current geometry context object, e.g. alignment
0095   /// @param lposition local 2D position in specialized surface frame
0096   ///
0097   /// @return The global position by value
0098   virtual Vector3 localToGlobal(const GeometryContext& gctx,
0099                                 const Vector2& lposition) const = 0;
0100 
0101   /// The geometric onSurface method
0102   ///
0103   /// Geometrical check whether position is on Surface
0104   ///
0105   /// @param gctx The current geometry context object, e.g. alignment
0106   /// @param position global position to be evaludated
0107   /// @param boundaryTolerance BoundaryTolerance directive for this onSurface check
0108   /// @param tolerance optional tolerance within which a point is considered on surface
0109   ///
0110   /// @return boolean indication if operation was successful
0111   bool isOnSurface(
0112       const GeometryContext& gctx, const Vector3& position,
0113       const BoundaryTolerance& boundaryTolerance = BoundaryTolerance::None(),
0114       double tolerance = s_onSurfaceTolerance) const;
0115 
0116   using Surface::isOnSurface;
0117 };
0118 
0119 }  // namespace Acts