|
|
|||
File indexing completed on 2025-12-16 09:22:43
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/Geometry/GeometryContext.hpp" 0015 #include "Acts/Geometry/Polyhedron.hpp" 0016 #include "Acts/Surfaces/BoundaryTolerance.hpp" 0017 #include "Acts/Surfaces/ConeBounds.hpp" 0018 #include "Acts/Surfaces/RegularSurface.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 #include "Acts/Utilities/detail/RealQuadraticEquation.hpp" 0024 0025 #include <memory> 0026 #include <numbers> 0027 #include <string> 0028 0029 namespace Acts { 0030 0031 /// @class ConeSurface 0032 /// 0033 /// Class for a conical surface in the Tracking geometry. 0034 /// It inherits from Surface. 0035 /// 0036 /// The ConeSurface is special since no corresponding 0037 /// Track parameters exist since they're numerical instable 0038 /// at the tip of the cone. 0039 /// Propagations to a cone surface will be returned in 0040 /// curvilinear coordinates. 0041 /// 0042 class ConeSurface : public RegularSurface { 0043 friend class Surface; 0044 0045 protected: 0046 /// Constructor form HepTransform and an opening angle 0047 /// 0048 /// @param transform is the transform to place to cone in a 3D frame 0049 /// @param alpha is the opening angle of the cone 0050 /// @param symmetric indicates if the cones are built to +/1 z 0051 ConeSurface(const Transform3& transform, double alpha, 0052 bool symmetric = false); 0053 0054 /// Constructor form HepTransform and an opening angle 0055 /// 0056 /// @param transform is the transform that places the cone in the global frame 0057 /// @param alpha is the opening angle of the cone 0058 /// @param zmin is the z range over which the cone spans 0059 /// @param zmax is the z range over which the cone spans 0060 /// @param halfPhi is the opening angle for cone ssectors 0061 ConeSurface(const Transform3& transform, double alpha, double zmin, 0062 double zmax, double halfPhi = std::numbers::pi); 0063 0064 /// Constructor from HepTransform and ConeBounds 0065 /// 0066 /// @param transform is the transform that places the cone in the global frame 0067 /// @param cbounds is the boundary class, the bounds must exit 0068 ConeSurface(const Transform3& transform, 0069 std::shared_ptr<const ConeBounds> cbounds); 0070 0071 /// Copy constructor 0072 /// 0073 /// @param other is the source cone surface 0074 ConeSurface(const ConeSurface& other); 0075 0076 /// Copy constructor - with shift 0077 /// 0078 /// @param gctx The current geometry context object, e.g. alignment 0079 /// @param other is the source cone surface 0080 /// @param shift is the additional transform applied after copying 0081 ConeSurface(const GeometryContext& gctx, const ConeSurface& other, 0082 const Transform3& shift); 0083 0084 public: 0085 /// Assignment operator 0086 /// 0087 /// @param other is the source surface for the assignment 0088 /// @return Reference to this ConeSurface after assignment 0089 ConeSurface& operator=(const ConeSurface& other); 0090 0091 /// The binning position method - is overloaded for r-type binning 0092 /// 0093 /// @param gctx The current geometry context object, e.g. alignment 0094 /// @param aDir defines the direction of binning applied in the global frame 0095 /// 0096 /// @return The return type is a vector for positioning in the global frame 0097 Vector3 referencePosition(const GeometryContext& gctx, 0098 AxisDirection aDir) const final; 0099 0100 /// Return the surface type 0101 /// @return Surface type identifier 0102 SurfaceType type() const override; 0103 0104 /// Return the measurement frame - this is needed for alignment, in particular 0105 /// for StraightLine and Perigee Surface 0106 /// - the default implementation is the RotationMatrix3 of the transform 0107 /// 0108 /// @param gctx The current geometry context object, e.g. alignment 0109 /// @param position is the global position where the measurement frame is 0110 /// constructed 0111 /// @param direction is the momentum direction used for the measurement frame 0112 /// construction 0113 /// @return matrix that indicates the measurement frame 0114 RotationMatrix3 referenceFrame(const GeometryContext& gctx, 0115 const Vector3& position, 0116 const Vector3& direction) const final; 0117 0118 /// Return method for surface normal information 0119 /// 0120 /// @param gctx The current geometry context object, e.g. alignment 0121 /// @param lposition is the local position at normal vector request 0122 /// @return Vector3 normal vector in global frame 0123 Vector3 normal(const GeometryContext& gctx, 0124 const Vector2& lposition) const final; 0125 0126 /// Return method for surface normal information 0127 /// 0128 /// @param gctx The current geometry context object, e.g. alignment 0129 /// @param position is the global position as normal vector base 0130 /// @return Vector3 normal vector in global frame 0131 Vector3 normal(const GeometryContext& gctx, 0132 const Vector3& position) const final; 0133 0134 // Return method for the rotational symmetry axis 0135 /// 0136 /// @param gctx The current geometry context object, e.g. alignment 0137 /// 0138 /// @return The local z axis vector 0139 virtual Vector3 rotSymmetryAxis(const GeometryContext& gctx) const; 0140 0141 /// This method returns the ConeBounds by reference 0142 /// @return Reference to the cone bounds 0143 const ConeBounds& bounds() const final; 0144 /// This method returns the shared_ptr to the ConeBounds 0145 const std::shared_ptr<const ConeBounds>& boundsPtr() const; 0146 /// Overwrite the existing surface bounds with new ones 0147 /// @param newBounds: Pointer to the new bounds 0148 void assignSurfaceBounds(std::shared_ptr<const ConeBounds> newBounds); 0149 0150 /// Local to global transformation 0151 /// 0152 /// @param gctx The current geometry context object, e.g. alignment 0153 /// @param lposition is the local position to be transformed 0154 /// 0155 /// @return The global position by value 0156 Vector3 localToGlobal(const GeometryContext& gctx, 0157 const Vector2& lposition) const final; 0158 0159 // Use overloads from `RegularSurface` 0160 using RegularSurface::globalToLocal; 0161 using RegularSurface::localToGlobal; 0162 using RegularSurface::normal; 0163 0164 /// Global to local transformation 0165 /// 0166 /// @param gctx The current geometry context object, e.g. alignment 0167 /// @param position is the global position to be transformed 0168 /// @param tolerance optional tolerance within which a point is considered 0169 /// valid on surface 0170 /// 0171 /// @return a Result<Vector2> which can be !ok() if the operation fails 0172 Result<Vector2> globalToLocal( 0173 const GeometryContext& gctx, const Vector3& position, 0174 double tolerance = s_onSurfaceTolerance) const final; 0175 0176 /// Straight line intersection schema from position/direction 0177 /// 0178 /// @param gctx The current geometry context object, e.g. alignment 0179 /// @param position The position to start from 0180 /// @param direction The direction at start 0181 /// @param boundaryTolerance the Boundary Check 0182 /// @param tolerance the tolerance used for the intersection 0183 /// 0184 /// If possible returns both solutions for the cylinder 0185 /// 0186 /// @return @c MultiIntersection3D object (contains intersection & surface) 0187 MultiIntersection3D intersect( 0188 const GeometryContext& gctx, const Vector3& position, 0189 const Vector3& direction, 0190 const BoundaryTolerance& boundaryTolerance = 0191 BoundaryTolerance::Infinite(), 0192 double tolerance = s_onSurfaceTolerance) const final; 0193 0194 /// The pathCorrection for derived classes with thickness 0195 /// 0196 /// @param gctx The current geometry context object, e.g. alignment 0197 /// @param position is the global potion at the correction point 0198 /// @param direction is the momentum direction at the correction point 0199 /// @return is the path correction due to incident angle 0200 double pathCorrection(const GeometryContext& gctx, const Vector3& position, 0201 const Vector3& direction) const final; 0202 0203 /// Return a Polyhedron for the surfaces 0204 /// 0205 /// @param gctx The current geometry context object, e.g. alignment 0206 /// @param quarterSegments Number of segments used to approximate a quarter 0207 /// 0208 /// @note The phi extrema points at (-pi, -1/2 pi, 0, 1/2 pi) that fall within 0209 /// the surface will be inserted to guarantee an appropriate extent 0210 /// measurement in x and y 0211 /// 0212 /// @return A list of vertices and a face/facett description of it 0213 Polyhedron polyhedronRepresentation( 0214 const GeometryContext& gctx, 0215 unsigned int quarterSegments = 2u) const override; 0216 0217 /// Return properly formatted class name for screen output 0218 /// @return String representation of the class name 0219 std::string name() const override; 0220 0221 /// Calculate the derivative of path length at the geometry constraint or 0222 /// point-of-closest-approach w.r.t. alignment parameters of the surface (i.e. 0223 /// local frame origin in global 3D Cartesian coordinates and its rotation 0224 /// represented with extrinsic Euler angles) 0225 /// 0226 /// @param gctx The current geometry context object, e.g. alignment 0227 /// @param position global 3D position 0228 /// @param direction global 3D momentum direction 0229 /// 0230 /// @return Derivative of path length w.r.t. the alignment parameters 0231 AlignmentToPathMatrix alignmentToPathDerivative( 0232 const GeometryContext& gctx, const Vector3& position, 0233 const Vector3& direction) const final; 0234 0235 /// Calculate the derivative of bound track parameters local position w.r.t. 0236 /// position in local 3D Cartesian coordinates 0237 /// 0238 /// @param gctx The current geometry context object, e.g. alignment 0239 /// @param position The position of the parameters in global 0240 /// 0241 /// @return Derivative of bound local position w.r.t. position in local 3D 0242 /// cartesian coordinates 0243 ActsMatrix<2, 3> localCartesianToBoundLocalDerivative( 0244 const GeometryContext& gctx, const Vector3& position) const final; 0245 0246 protected: 0247 std::shared_ptr<const ConeBounds> m_bounds; ///< bounds (shared) 0248 0249 private: 0250 /// Implementation of the intersection solver 0251 /// 0252 /// <b>mathematical motivation:</b> 0253 /// 0254 /// The calculation will be done in the 3-dim frame of the cone, 0255 /// i.e. the symmetry axis of the cone is the z-axis, x- and y-axis are 0256 /// perpendicular 0257 /// to the z-axis. In this frame the cone is centered around the origin. 0258 /// Therefore the two points describing the line have to be first 0259 /// recalculated 0260 /// into the new frame. 0261 /// Suppose, this is done, the points of intersection can be 0262 /// obtained as follows:<br> 0263 /// 0264 /// The cone is described by the implicit equation 0265 /// @f$x^2 + y^2 = z^2 \tan \alpha@f$ 0266 /// where @f$\alpha@f$ is opening half-angle of the cone the and 0267 /// the line by the parameter equation (with @f$t@f$ the 0268 /// parameter and @f$x_1@f$ and @f$x_2@f$ are points on the line) 0269 /// @f$(x,y,z) = \vec x_1 + (\vec x_2 - \vec x_2) t @f$. 0270 /// The intersection is the given to the value of @f$t@f$ where 0271 /// the @f$(x,y,z)@f$ coordinates of the line satisfy the implicit 0272 /// equation of the cone. Inserting the expression for the points 0273 /// on the line into the equation of the cone and rearranging to 0274 /// the form of a gives (letting @f$ \vec x_d = \frac{\vec x_2 - \vec 0275 /// x_1}{|\vec x_2 - \vec x_1|} @f$): 0276 /// @f$t^2 (x_d^2 + y_d^2 - z_d^2 \tan^2 \alpha) + 2 t (x_1 x_d + 0277 /// y_1 y_d - z_1 z_d \tan^2 \alpha) + (x_1^2 + y_1^2 - z_1^2 0278 /// \tan^2 \alpha) = 0 @f$ 0279 /// Solving the above for @f$t@f$ and putting the values into the 0280 /// equation of the line gives the points of intersection. @f$t@f$ 0281 /// is also the length of the path, since we normalized @f$x_d@f$ 0282 /// to be unit length. 0283 /// 0284 /// @return the quadratic equation 0285 detail::RealQuadraticEquation intersectionSolver( 0286 const GeometryContext& gctx, const Vector3& position, 0287 const Vector3& direction) const; 0288 }; 0289 0290 static_assert(RegularSurfaceConcept<ConeSurface>, 0291 "ConeSurface does not fulfill RegularSurfaceConcept"); 0292 0293 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|