Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Core/include/Acts/Surfaces/PointSurface.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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/Alignment.hpp"
0013 #include "Acts/Definitions/Tolerance.hpp"
0014 #include "Acts/Definitions/TrackParametrization.hpp"
0015 #include "Acts/Geometry/GeometryContext.hpp"
0016 #include "Acts/Geometry/Polyhedron.hpp"
0017 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0018 #include "Acts/Surfaces/PointBounds.hpp"
0019 #include "Acts/Surfaces/Surface.hpp"
0020 #include "Acts/Surfaces/SurfaceConcept.hpp"
0021 #include "Acts/Utilities/AxisDefinitions.hpp"
0022 #include "Acts/Utilities/Result.hpp"
0023 
0024 #include <iosfwd>
0025 #include <memory>
0026 #include <string>
0027 
0028 namespace Acts {
0029 
0030 class PointBounds;
0031 class SurfaceBounds;
0032 
0033 /// @class PointSurface
0034 ///
0035 /// Surface describing the point of closest approach (PCA) of a track to a
0036 /// single fixed 3D point (the surface center). It is the point-analogue of the
0037 /// LineSurface (which represents the PCA to a line / Perigee).
0038 ///
0039 /// Geometrically, a PointSurface behaves like a curvilinear plane anchored at
0040 /// the fixed center: a plane through the center whose normal always equals the
0041 /// track momentum direction. The track's crossing of that plane is therefore
0042 /// the PCA to the point. Consequently there is no parallel-line degeneracy: a
0043 /// unique intersection always exists.
0044 ///
0045 /// The local coordinates are Cartesian (x, y) in the measurement plane
0046 /// perpendicular to the track direction. Cartesian (not polar r-phi) is used on
0047 /// purpose, because at the point itself (r = 0) the azimuth phi is degenerate.
0048 ///
0049 /// The measurement frame is oriented from the track direction like the
0050 /// CurvilinearSurface: the third axis is the track direction, the first axis is
0051 /// built from global Z (with a fall-back to global X when the direction is
0052 /// (anti-)parallel to Z).
0053 ///
0054 /// @note A point has no intrinsic orientation, so only translation (center)
0055 /// alignment is supported; rotational alignment derivatives are zero.
0056 class PointSurface : public Surface {
0057   friend class Surface;
0058 
0059  protected:
0060   /// Constructor from a global position (unbounded point surface)
0061   ///
0062   /// @param center position of the point in the global frame
0063   explicit PointSurface(const Vector3& center);
0064 
0065   /// Constructor from a global position and a maximum distance
0066   ///
0067   /// @param center position of the point in the global frame
0068   /// @param maxDistance maximum distance from the point (radius of the
0069   /// PointBounds disc in the measurement plane)
0070   PointSurface(const Vector3& center, double maxDistance);
0071 
0072   /// Constructor from a Transform3 and optional PointBounds
0073   ///
0074   /// @param transform the transform whose translation positions the point
0075   /// @param pbounds the bounds describing the maximum distance, may be nullptr
0076   /// for an unbounded point surface
0077   explicit PointSurface(const Transform3& transform,
0078                         std::shared_ptr<const PointBounds> pbounds = nullptr);
0079 
0080   /// Copy constructor - with shift
0081   ///
0082   /// @param gctx The current geometry context object, e.g. alignment
0083   /// @param other is the source surface
0084   /// @param shift is the additional transform applied after copying
0085   PointSurface(const GeometryContext& gctx, const PointSurface& other,
0086                const Transform3& shift);
0087 
0088  public:
0089   /// Copy constructor
0090   ///
0091   /// @param other The source surface for copying
0092   PointSurface(const PointSurface& other) noexcept = default;
0093 
0094   /// Assignment operator
0095   ///
0096   /// @param other is the source surface for copying
0097   /// @return Reference to this PointSurface after assignment
0098   PointSurface& operator=(const PointSurface& other) noexcept = default;
0099 
0100   /// Destructor
0101   ~PointSurface() noexcept override = default;
0102 
0103   /// Return the surface type
0104   /// @return Surface type identifier for point surfaces
0105   SurfaceType type() const final { return Surface::Point; }
0106 
0107   /// Return the surface normal, which for a point surface is the momentum
0108   /// direction (the measurement plane is perpendicular to the direction).
0109   ///
0110   /// @param gctx The current geometry context object, e.g. alignment
0111   /// @param pos is the global position (ignored)
0112   /// @param direction is the global momentum direction
0113   /// @return the normal vector (equal to @p direction)
0114   Vector3 normal(const GeometryContext& gctx, const Vector3& pos,
0115                  const Vector3& direction) const final;
0116 
0117   /// The binning position is the center of the point surface.
0118   ///
0119   /// @param gctx The current geometry context object, e.g. alignment
0120   /// @param aDir is the axis direction for the reference position request
0121   /// @return the center position
0122   Vector3 referencePosition(const GeometryContext& gctx,
0123                             AxisDirection aDir) const final;
0124 
0125   /// Return the measurement frame, built from the momentum direction like a
0126   /// curvilinear surface. Columns are (U, V, T) with T the direction.
0127   ///
0128   /// @param gctx The current geometry context object, e.g. alignment
0129   /// @param position is the global position (ignored)
0130   /// @param direction is the momentum direction used to build the frame
0131   /// @return a rotation matrix that indicates the measurement frame
0132   RotationMatrix3 referenceFrame(const GeometryContext& gctx,
0133                                  const Vector3& position,
0134                                  const Vector3& direction) const final;
0135 
0136   /// Calculate the jacobian from local to global.
0137   ///
0138   /// @param gctx The current geometry context object, e.g. alignment
0139   /// @param position global 3D position
0140   /// @param direction global 3D momentum direction
0141   /// @return Jacobian from local to global
0142   BoundToFreeMatrix boundToFreeJacobian(const GeometryContext& gctx,
0143                                         const Vector3& position,
0144                                         const Vector3& direction) const final;
0145 
0146   /// Calculate the derivative of path length at the point-of-closest-approach
0147   /// w.r.t. free parameters.
0148   ///
0149   /// @param gctx The current geometry context object, e.g. alignment
0150   /// @param position global 3D position
0151   /// @param direction global 3D momentum direction
0152   /// @return Derivative of path length w.r.t. free parameters
0153   FreeToPathMatrix freeToPathDerivative(const GeometryContext& gctx,
0154                                         const Vector3& position,
0155                                         const Vector3& direction) const final;
0156 
0157   /// Local to global transformation
0158   ///
0159   /// @note for point surfaces the momentum direction is used in order to
0160   /// build the measurement plane
0161   ///
0162   /// @param gctx The current geometry context object, e.g. alignment
0163   /// @param lposition is the local (x, y) position to be transformed
0164   /// @param direction is the global momentum direction
0165   /// @return global position by value
0166   Vector3 localToGlobal(const GeometryContext& gctx, const Vector2& lposition,
0167                         const Vector3& direction) const final;
0168 
0169   /// Global to local transformation
0170   ///
0171   /// @param gctx The current geometry context object, e.g. alignment
0172   /// @param position global 3D position - considered to be on surface but not
0173   /// inside bounds (check is done)
0174   /// @param direction global 3D momentum direction
0175   /// @param tolerance the tolerance for the on-surface check
0176   /// @return A Result<Vector2> which is !ok() if @p position is not the point
0177   /// of closest approach to the point surface.
0178   Result<Vector2> globalToLocal(
0179       const GeometryContext& gctx, const Vector3& position,
0180       const Vector3& direction,
0181       double tolerance = s_onSurfaceTolerance) const final;
0182 
0183   /// Calculate the straight-line intersection with the point surface, i.e. the
0184   /// point of closest approach of the track to the point.
0185   ///
0186   /// Given the track (@p position @f$ \vec m @f$, @p direction @f$ \vec e @f$,
0187   /// normalized), the PCA path length is @f$ u = (\vec c - \vec m) \cdot \vec e
0188   /// @f$ where @f$ \vec c @f$ is the point, and the intersection point is @f$
0189   /// \vec m + u \vec e @f$. Unlike the LineSurface there is no parallel
0190   /// degeneracy.
0191   ///
0192   /// @param gctx The current geometry context object, e.g. alignment
0193   /// @param position The global position as a starting point
0194   /// @param direction The global direction at the starting point
0195   ///        @note expected to be normalized
0196   /// @param boundaryTolerance The boundary check directive for the estimate
0197   /// @param tolerance the tolerance used for the intersection
0198   /// @return is the intersection object
0199   MultiIntersection3D intersect(
0200       const GeometryContext& gctx, const Vector3& position,
0201       const Vector3& direction,
0202       const BoundaryTolerance& boundaryTolerance =
0203           BoundaryTolerance::Infinite(),
0204       double tolerance = s_onSurfaceTolerance) const final;
0205 
0206   /// The pathCorrection is by definition 1 for point surfaces
0207   ///
0208   /// @param gctx Geometry context (ignored)
0209   /// @param position Position parameter (ignored)
0210   /// @param direction Direction parameter (ignored)
0211   /// @return Always returns 1.0 for point surfaces
0212   double pathCorrection(const GeometryContext& gctx, const Vector3& position,
0213                         const Vector3& direction) const final;
0214 
0215   /// This method returns the bounds of the surface by reference
0216   /// @return Reference to the surface bounds
0217   const SurfaceBounds& bounds() const final;
0218   /// This method returns the shared_ptr to the PointBounds
0219   /// @return Shared pointer to the point bounds (may be nullptr)
0220   const std::shared_ptr<const PointBounds>& boundsPtr() const;
0221   /// Overwrite the existing surface bounds with new ones
0222   /// @param newBounds Pointer to the new bounds
0223   void assignSurfaceBounds(std::shared_ptr<const PointBounds> newBounds);
0224 
0225   /// Return properly formatted class name for screen output
0226   /// @return String representation of the class name
0227   std::string name() const final;
0228 
0229   /// Return a Polyhedron for the surface (a non-physical marker at the center)
0230   ///
0231   /// @param gctx The current geometry context object, e.g. alignment
0232   /// @param quarterSegments is an ignored parameter
0233   /// @return A list of vertices and a face/facet description of it
0234   Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
0235                                       unsigned int quarterSegments) const final;
0236 
0237   /// Calculate the derivative of path length at the point-of-closest-approach
0238   /// w.r.t. alignment parameters of the surface. Only the center (translation)
0239   /// contributes; a point has no orientation so the rotation block is zero.
0240   ///
0241   /// @param gctx The current geometry context object, e.g. alignment
0242   /// @param position global 3D position
0243   /// @param direction global 3D momentum direction
0244   /// @return Derivative of path length w.r.t. the alignment parameters
0245   AlignmentToPathMatrix alignmentToPathDerivative(
0246       const GeometryContext& gctx, const Vector3& position,
0247       const Vector3& direction) const final;
0248 
0249   /// Calculate the derivative of bound track parameters local position w.r.t.
0250   /// position in local 3D Cartesian coordinates
0251   ///
0252   /// @param gctx The current geometry context object, e.g. alignment
0253   /// @param position The position of the parameters in global
0254   /// @return Derivative of bound local position w.r.t. position in local 3D
0255   /// cartesian coordinates
0256   Matrix<2, 3> localCartesianToBoundLocalDerivative(
0257       const GeometryContext& gctx, const Vector3& position) const final;
0258 
0259  protected:
0260   std::shared_ptr<const PointBounds>
0261       m_bounds;  ///< bounds (shared, may be null)
0262 
0263   /// @copydoc Surface::localAxes
0264   std::array<AxisDirection, 2> localAxes() const final {
0265     return {AxisDirection::AxisX, AxisDirection::AxisY};
0266   }
0267 
0268   /// Output Method for std::ostream
0269   ///
0270   /// @param gctx The current geometry context object, e.g. alignment
0271   /// @param sl is the ostream to be dumped into
0272   /// @return ostream object which was streamed into
0273   std::ostream& toStreamImpl(const GeometryContext& gctx,
0274                              std::ostream& sl) const final;
0275 };
0276 
0277 static_assert(SurfaceConcept<PointSurface>,
0278               "PointSurface does not fulfill SurfaceConcept");
0279 
0280 }  // namespace Acts