Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-12 08:07:12

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2020 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Tolerance.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Geometry/Polyhedron.hpp"
0015 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0016 #include "Acts/Surfaces/InfiniteBounds.hpp"
0017 #include "Acts/Surfaces/PlanarBounds.hpp"
0018 #include "Acts/Surfaces/RegularSurface.hpp"
0019 #include "Acts/Surfaces/Surface.hpp"
0020 #include "Acts/Surfaces/SurfaceConcept.hpp"
0021 #include "Acts/Utilities/BinningType.hpp"
0022 #include "Acts/Utilities/Result.hpp"
0023 
0024 #include <cstddef>
0025 #include <limits>
0026 #include <memory>
0027 #include <string>
0028 
0029 namespace Acts {
0030 
0031 class DetectorElementBase;
0032 class PlanarBounds;
0033 class SurfaceBounds;
0034 
0035 /// @class PlaneSurface
0036 ///
0037 /// Class for a planaer in the TrackingGeometry.
0038 ///
0039 /// The PlaneSurface extends the Surface class with the possibility to
0040 /// convert local to global positions (vice versa).
0041 ///
0042 /// @image html PlaneSurface.png
0043 ///
0044 class PlaneSurface : public RegularSurface {
0045   friend class Surface;
0046 
0047  protected:
0048   /// Copy Constructor
0049   ///
0050   /// @param other is the source surface for the copy
0051   PlaneSurface(const PlaneSurface& other);
0052 
0053   /// Copy constructor - with shift
0054   ///
0055   /// @param gctx The current geometry context object, e.g. alignment
0056   /// @param other is the source cone surface
0057   /// @param transform is the additional transform applied after copying
0058   PlaneSurface(const GeometryContext& gctx, const PlaneSurface& other,
0059                const Transform3& transform);
0060 
0061   /// @deprecated Use `CurvilinearSurface` instead
0062   ///
0063   /// Dedicated Constructor with normal vector
0064   /// This is for curvilinear surfaces which are by definition boundless
0065   ///
0066   /// @param center is the center position of the surface
0067   /// @param normal is thenormal vector of the plane surface
0068   PlaneSurface(const Vector3& center, const Vector3& normal);
0069 
0070   /// Constructor from DetectorElementBase : Element proxy
0071   ///
0072   /// @param pbounds are the provided planar bounds
0073   /// @param detelement is the linked detector element to this surface
0074   PlaneSurface(std::shared_ptr<const PlanarBounds> pbounds,
0075                const DetectorElementBase& detelement);
0076 
0077   /// Constructor for Planes with (optional) shared bounds object
0078   ///
0079   /// @param transform transform in 3D that positions this surface
0080   /// @param pbounds bounds object to describe the actual surface area
0081   PlaneSurface(const Transform3& transform,
0082                std::shared_ptr<const PlanarBounds> pbounds = nullptr);
0083 
0084  public:
0085   ~PlaneSurface() override = default;
0086   PlaneSurface() = delete;
0087 
0088   /// Assignment operator
0089   ///
0090   /// @param other The source PlaneSurface for assignment
0091   PlaneSurface& operator=(const PlaneSurface& other);
0092 
0093   // Use overloads from `RegularSurface`
0094   using RegularSurface::globalToLocal;
0095   using RegularSurface::localToGlobal;
0096   using RegularSurface::normal;
0097 
0098   /// Get the normal vector of this surface at a given local position
0099   ///
0100   /// @param gctx The current geometry context object, e.g. alignment
0101   /// @param lposition is the local position is ignored
0102   ///
0103   /// return a Vector3 by value
0104   Vector3 normal(const GeometryContext& gctx,
0105                  const Vector2& lposition) const final;
0106 
0107   /// Get the normal vector of this surface at a given global position
0108   /// @note The @p position is required to be on-surface.
0109   /// @param gctx The current geometry context object, e.g. alignment
0110   /// @param position is the global positiono (for @ref PlaneSurface this is ignored)
0111   /// @return The normal vector
0112   Vector3 normal(const GeometryContext& gctx,
0113                  const Vector3& position) const final;
0114 
0115   /// Get the normal vector, independent of the location
0116   /// @param gctx The current geometry context object, e.g. alignment
0117   /// @return The normal vector
0118   Vector3 normal(const GeometryContext& gctx) const;
0119 
0120   /// The binning position is the position calculated
0121   /// for a certain binning type
0122   ///
0123   /// @param gctx The current geometry context object, e.g. alignment
0124   /// @param bValue is the binning type to be used
0125   ///
0126   /// @return position that can beused for this binning
0127   Vector3 binningPosition(const GeometryContext& gctx,
0128                           BinningValue bValue) const final;
0129 
0130   /// Return the surface type
0131   SurfaceType type() const override;
0132 
0133   /// Return method for bounds object of this surfrace
0134   const SurfaceBounds& bounds() const override;
0135 
0136   /// Local to global transformation
0137   ///
0138   /// @note For planar surfaces the momentum direction is ignored in the local to global
0139   /// transformation
0140   ///
0141   /// @param gctx The current geometry context object, e.g. alignment
0142   /// @param lposition local 2D position in specialized surface frame
0143   ///
0144   /// @return the global position by value
0145   Vector3 localToGlobal(const GeometryContext& gctx,
0146                         const Vector2& lposition) const override;
0147 
0148   /// Global to local transformation
0149   ///
0150   /// @note For planar surfaces the momentum direction is ignored in the global to local
0151   /// transformation
0152   ///
0153   /// @param gctx The current geometry context object, e.g. alignment
0154   /// @param position global 3D position - considered to be on surface but not
0155   /// inside bounds (check is done)
0156   /// @param tolerance optional tolerance within which a point is considered
0157   /// valid on surface
0158   ///
0159   /// @return a Result<Vector2> which can be !ok() if the operation fails
0160   Result<Vector2> globalToLocal(
0161       const GeometryContext& gctx, const Vector3& position,
0162       double tolerance = s_onSurfaceTolerance) const override;
0163 
0164   /// Method that calculates the correction due to incident angle
0165   ///
0166   /// @param gctx The current geometry context object, e.g. alignment
0167   /// @param position global 3D position (ignored for @ref PlaneSurface)
0168   /// @param direction global 3D momentum direction (ignored for @ref PlaneSurface)
0169   /// @return a double representing the scaling factor
0170   double pathCorrection(const GeometryContext& gctx, const Vector3& position,
0171                         const Vector3& direction) const final;
0172 
0173   /// @brief Straight line intersection
0174   ///
0175   /// @param gctx The current geometry context object, e.g. alignment
0176   /// @param position The start position of the intersection attempt
0177   /// @param direction The direction of the intersection attempt,
0178   /// (@note expected to be normalized)
0179   /// @param boundaryTolerance The boundary check directive
0180   /// @param tolerance the tolerance used for the intersection
0181   ///
0182   /// <b>mathematical motivation:</b>
0183   ///
0184   /// the equation of the plane is given by: <br>
0185   /// @f$ \vec n \cdot \vec x = \vec n \cdot \vec p,@f$ <br>
0186   /// where @f$ \vec n = (n_{x}, n_{y}, n_{z})@f$ denotes the normal vector of
0187   /// the plane,  @f$ \vec p = (p_{x}, p_{y}, p_{z})@f$ one specific point
0188   /// on the plane and @f$ \vec x = (x,y,z) @f$ all possible points
0189   /// on the plane.<br>
0190   ///
0191   /// Given a line with:<br>
0192   /// @f$ \vec l(u) = \vec l_{1} + u \cdot \vec v @f$, <br>
0193   /// the solution for @f$ u @f$ can be written:
0194   /// @f$ u = \frac{\vec n (\vec p - \vec l_{1})}{\vec n \vec v}@f$ <br>
0195   /// If the denominator is 0 then the line lies:
0196   /// - either in the plane
0197   /// - perpendicular to the normal of the plane
0198   ///
0199   /// @return the @c SurfaceMultiIntersection object
0200   SurfaceMultiIntersection intersect(
0201       const GeometryContext& gctx, const Vector3& position,
0202       const Vector3& direction,
0203       const BoundaryTolerance& boundaryTolerance =
0204           BoundaryTolerance::Infinite(),
0205       ActsScalar tolerance = s_onSurfaceTolerance) const final;
0206 
0207   /// Return a Polyhedron for the surfaces
0208   ///
0209   /// @param gctx The current geometry context object, e.g. alignment
0210   /// @param lseg Number of segments along curved lines, it represents
0211   /// the full 2*M_PI coverange, if lseg is set to 1 only the extrema
0212   /// are given
0213   ///
0214   /// @return A list of vertices and a face/facett description of it
0215   Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
0216                                       std::size_t lseg) const override;
0217 
0218   /// Return properly formatted class name for screen output
0219   std::string name() const override;
0220 
0221   /// Calculate the derivative of bound track parameters local position w.r.t.
0222   /// position in local 3D Cartesian coordinates
0223   ///
0224   /// @param gctx The current geometry context object, e.g. alignment
0225   /// @param position The position of the parameters in global
0226   ///
0227   /// @return Derivative of bound local position w.r.t. position in local 3D
0228   /// cartesian coordinates
0229   ActsMatrix<2, 3> localCartesianToBoundLocalDerivative(
0230       const GeometryContext& gctx, const Vector3& position) const final;
0231 
0232  protected:
0233   /// the bounds of this surface
0234   std::shared_ptr<const PlanarBounds> m_bounds;
0235 
0236  private:
0237 };
0238 
0239 static_assert(RegularSurfaceConcept<PlaneSurface>,
0240               "PlaneSurface does not fulfill RegularSurfaceConcept");
0241 
0242 }  // namespace Acts