Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-18 09:30:17

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/BoundaryCheck.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/Concepts.hpp"
0023 #include "Acts/Utilities/Result.hpp"
0024 
0025 #include <cstddef>
0026 #include <limits>
0027 #include <memory>
0028 #include <string>
0029 
0030 namespace Acts {
0031 
0032 class DetectorElementBase;
0033 class PlanarBounds;
0034 class SurfaceBounds;
0035 
0036 /// @class PlaneSurface
0037 ///
0038 /// Class for a planaer in the TrackingGeometry.
0039 ///
0040 /// The PlaneSurface extends the Surface class with the possibility to
0041 /// convert local to global positions (vice versa).
0042 ///
0043 /// @image html PlaneSurface.png
0044 ///
0045 class PlaneSurface : public RegularSurface {
0046   friend class Surface;
0047 
0048  protected:
0049   /// Copy Constructor
0050   ///
0051   /// @param other is the source surface for the copy
0052   PlaneSurface(const PlaneSurface& other);
0053 
0054   /// Copy constructor - with shift
0055   ///
0056   /// @param gctx The current geometry context object, e.g. alignment
0057   /// @param other is the source cone surface
0058   /// @param transform is the additional transform applied after copying
0059   PlaneSurface(const GeometryContext& gctx, const PlaneSurface& other,
0060                const Transform3& transform);
0061 
0062   /// @deprecated Use `CurvilinearSurface` instead
0063   ///
0064   /// Dedicated Constructor with normal vector
0065   /// This is for curvilinear surfaces which are by definition boundless
0066   ///
0067   /// @param center is the center position of the surface
0068   /// @param normal is thenormal vector of the plane surface
0069   PlaneSurface(const Vector3& center, const Vector3& normal);
0070 
0071   /// Constructor from DetectorElementBase : Element proxy
0072   ///
0073   /// @param pbounds are the provided planar bounds
0074   /// @param detelement is the linked detector element to this surface
0075   PlaneSurface(std::shared_ptr<const PlanarBounds> pbounds,
0076                const DetectorElementBase& detelement);
0077 
0078   /// Constructor for Planes with (optional) shared bounds object
0079   ///
0080   /// @param transform transform in 3D that positions this surface
0081   /// @param pbounds bounds object to describe the actual surface area
0082   PlaneSurface(const Transform3& transform,
0083                std::shared_ptr<const PlanarBounds> pbounds = nullptr);
0084 
0085  public:
0086   ~PlaneSurface() override = default;
0087   PlaneSurface() = delete;
0088 
0089   /// Assignment operator
0090   ///
0091   /// @param other The source PlaneSurface for assignment
0092   PlaneSurface& operator=(const PlaneSurface& other);
0093 
0094   // Use overloads from `RegularSurface`
0095   using RegularSurface::globalToLocal;
0096   using RegularSurface::localToGlobal;
0097   using RegularSurface::normal;
0098 
0099   /// Get the normal vector of this surface at a given local position
0100   ///
0101   /// @param gctx The current geometry context object, e.g. alignment
0102   /// @param lposition is the local position is ignored
0103   ///
0104   /// return a Vector3 by value
0105   Vector3 normal(const GeometryContext& gctx,
0106                  const Vector2& lposition) const final;
0107 
0108   /// Get the normal vector of this surface at a given global position
0109   /// @note The @p position is required to be on-surface.
0110   /// @param gctx The current geometry context object, e.g. alignment
0111   /// @param position is the global positiono (for @ref PlaneSurface this is ignored)
0112   /// @return The normal vector
0113   Vector3 normal(const GeometryContext& gctx,
0114                  const Vector3& position) const final;
0115 
0116   /// Get the normal vector, independent of the location
0117   /// @param gctx The current geometry context object, e.g. alignment
0118   /// @return The normal vector
0119   Vector3 normal(const GeometryContext& gctx) const;
0120 
0121   /// The binning position is the position calculated
0122   /// for a certain binning type
0123   ///
0124   /// @param gctx The current geometry context object, e.g. alignment
0125   /// @param bValue is the binning type to be used
0126   ///
0127   /// @return position that can beused for this binning
0128   Vector3 binningPosition(const GeometryContext& gctx,
0129                           BinningValue bValue) const final;
0130 
0131   /// Return the surface type
0132   SurfaceType type() const override;
0133 
0134   /// Return method for bounds object of this surfrace
0135   const SurfaceBounds& bounds() const override;
0136 
0137   /// Local to global transformation
0138   ///
0139   /// @note For planar surfaces the momentum direction is ignored in the local to global
0140   /// transformation
0141   ///
0142   /// @param gctx The current geometry context object, e.g. alignment
0143   /// @param lposition local 2D position in specialized surface frame
0144   ///
0145   /// @return the global position by value
0146   Vector3 localToGlobal(const GeometryContext& gctx,
0147                         const Vector2& lposition) const override;
0148 
0149   /// Global to local transformation
0150   ///
0151   /// @note For planar surfaces the momentum direction is ignored in the global to local
0152   /// transformation
0153   ///
0154   /// @param gctx The current geometry context object, e.g. alignment
0155   /// @param position global 3D position - considered to be on surface but not
0156   /// inside bounds (check is done)
0157   /// @param tolerance optional tolerance within which a point is considered
0158   /// valid on surface
0159   ///
0160   /// @return a Result<Vector2> which can be !ok() if the operation fails
0161   Result<Vector2> globalToLocal(
0162       const GeometryContext& gctx, const Vector3& position,
0163       double tolerance = s_onSurfaceTolerance) const override;
0164 
0165   /// Method that calculates the correction due to incident angle
0166   ///
0167   /// @param gctx The current geometry context object, e.g. alignment
0168   /// @param position global 3D position (ignored for @ref PlaneSurface)
0169   /// @param direction global 3D momentum direction (ignored for @ref PlaneSurface)
0170   /// @return a double representing the scaling factor
0171   double pathCorrection(const GeometryContext& gctx, const Vector3& position,
0172                         const Vector3& direction) const final;
0173 
0174   /// @brief Straight line intersection
0175   ///
0176   /// @param gctx The current geometry context object, e.g. alignment
0177   /// @param position The start position of the intersection attempt
0178   /// @param direction The direction of the intersection attempt,
0179   /// (@note expected to be normalized)
0180   /// @param bcheck The boundary check directive
0181   /// @param tolerance the tolerance used for the intersection
0182   ///
0183   /// <b>mathematical motivation:</b>
0184   ///
0185   /// the equation of the plane is given by: <br>
0186   /// @f$ \vec n \cdot \vec x = \vec n \cdot \vec p,@f$ <br>
0187   /// where @f$ \vec n = (n_{x}, n_{y}, n_{z})@f$ denotes the normal vector of
0188   /// the plane,  @f$ \vec p = (p_{x}, p_{y}, p_{z})@f$ one specific point
0189   /// on the plane and @f$ \vec x = (x,y,z) @f$ all possible points
0190   /// on the plane.<br>
0191   ///
0192   /// Given a line with:<br>
0193   /// @f$ \vec l(u) = \vec l_{1} + u \cdot \vec v @f$, <br>
0194   /// the solution for @f$ u @f$ can be written:
0195   /// @f$ u = \frac{\vec n (\vec p - \vec l_{1})}{\vec n \vec v}@f$ <br>
0196   /// If the denominator is 0 then the line lies:
0197   /// - either in the plane
0198   /// - perpendicular to the normal of the plane
0199   ///
0200   /// @return the @c SurfaceMultiIntersection object
0201   SurfaceMultiIntersection intersect(
0202       const GeometryContext& gctx, const Vector3& position,
0203       const Vector3& direction,
0204       const BoundaryCheck& bcheck = BoundaryCheck(false),
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 ACTS_STATIC_CHECK_CONCEPT(RegularSurfaceConcept, PlaneSurface);
0240 
0241 }  // namespace Acts