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