|
|
|||
File indexing completed on 2026-11-16 09:23:11
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/Surfaces/BoundaryTolerance.hpp" 0017 #include "Acts/Surfaces/LineBounds.hpp" 0018 #include "Acts/Surfaces/Surface.hpp" 0019 #include "Acts/Utilities/AxisDefinitions.hpp" 0020 #include "Acts/Utilities/Result.hpp" 0021 0022 #include <memory> 0023 #include <string> 0024 0025 namespace Acts { 0026 0027 class LineBounds; 0028 class SurfaceBounds; 0029 0030 /// @class LineSurface 0031 /// 0032 /// Base class for a linear surfaces in the TrackingGeometry 0033 /// to describe dirft tube, straw like detectors or the Perigee 0034 /// It inherits from Surface. 0035 /// 0036 /// @note It leaves the type() method virtual, so it can not be instantiated 0037 /// 0038 /// @image html LineSurface.png 0039 class LineSurface : public Surface { 0040 friend class Surface; 0041 0042 protected: 0043 /// Constructor for LineSurface from Transform3 and radial dimensions 0044 /// 0045 /// @param transform The transform that positions the line in the global frame 0046 /// @param radius The radius of the line 0047 /// @param halez The half length in z 0048 explicit LineSurface(const Transform3& transform, double radius, 0049 double halez); 0050 0051 /// Constructor for LineSurface from Transform3 and LineBounds 0052 /// 0053 /// @param transform The transform that positions the line in the global frame 0054 /// @param lbounds The bounds describing the line dimensions 0055 explicit LineSurface(const Transform3& transform, 0056 std::shared_ptr<const LineBounds> lbounds = nullptr); 0057 0058 /// Constructor from SurfacePlacementBase : Element proxy 0059 /// 0060 /// @param lbounds are the bounds describing the line dimensions, they must 0061 /// not be nullptr 0062 /// @param placement Reference to the surface placement 0063 /// @note The Surface does not take any ownership over the 0064 /// `SurfacePlacementBase` it is expected that the user 0065 /// ensures the life-time of the `SurfacePlacementBase` 0066 /// and that the `Surface` is actually owned by 0067 /// the `SurfacePlacementBase` instance 0068 explicit LineSurface(std::shared_ptr<const LineBounds> lbounds, 0069 const SurfacePlacementBase& placement); 0070 0071 /// Copy constructor 0072 /// 0073 /// @param other The source surface for copying 0074 LineSurface(const LineSurface& 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 explicit LineSurface(const GeometryContext& gctx, const LineSurface& other, 0082 const Transform3& shift); 0083 0084 public: 0085 ~LineSurface() override = default; 0086 0087 /// Assignment operator 0088 /// 0089 /// @param other is the source surface dor copying 0090 /// @return Reference to this LineSurface after assignment 0091 /// @deprecated Surface copy-assignment will be removed; copy via 0092 /// `Surface::makeShared<T>(other)` instead. 0093 [[deprecated( 0094 "Surface copy-assignment is deprecated and will be removed; copy via " 0095 "Surface::makeShared<T>(other) instead.")]] 0096 LineSurface& operator=(const LineSurface& other); 0097 0098 Vector3 normal(const GeometryContext& gctx, const Vector3& pos, 0099 const Vector3& direction) const override; 0100 0101 /// The binning position is the position calculated 0102 /// for a certain binning type 0103 /// 0104 /// @param gctx The current geometry context object, e.g. alignment 0105 /// @param aDir is the axis direction for the reference position request 0106 /// 0107 /// @return position that can beused for this binning 0108 Vector3 referencePosition(const GeometryContext& gctx, 0109 AxisDirection aDir) const final; 0110 0111 /// Return the measurement frame - this is needed for alignment, in particular 0112 /// 0113 /// for StraightLine and Perigee Surface 0114 /// - the default implementation is the RotationMatrix3 of the transform 0115 /// 0116 /// @param gctx The current geometry context object, e.g. alignment 0117 /// @param position is the global position where the measurement frame is 0118 /// constructed 0119 /// @param direction is the momentum direction used for the measurement frame 0120 /// construction 0121 /// 0122 /// @return is a rotation matrix that indicates the measurement frame 0123 RotationMatrix3 referenceFrame(const GeometryContext& gctx, 0124 const Vector3& position, 0125 const Vector3& direction) const final; 0126 0127 /// Calculate the jacobian from local to global which the surface knows best, 0128 /// hence the calculation is done here. 0129 /// 0130 /// @param gctx The current geometry context object, e.g. alignment 0131 /// @param position global 3D position 0132 /// @param direction global 3D momentum direction 0133 /// 0134 /// @return Jacobian from local to global 0135 BoundToFreeMatrix boundToFreeJacobian(const GeometryContext& gctx, 0136 const Vector3& position, 0137 const Vector3& direction) const final; 0138 0139 /// Calculate the derivative of path length at the geometry constraint or 0140 /// point-of-closest-approach w.r.t. free parameters 0141 /// 0142 /// @param gctx The current geometry context object, e.g. alignment 0143 /// @param position global 3D position 0144 /// @param direction global 3D momentum direction 0145 /// 0146 /// @return Derivative of path length w.r.t. free parameters 0147 FreeToPathMatrix freeToPathDerivative(const GeometryContext& gctx, 0148 const Vector3& position, 0149 const Vector3& direction) const final; 0150 0151 /// Local to global transformation 0152 /// 0153 /// @note for line surfaces the momentum direction is used in order to interpret the 0154 /// drift radius 0155 /// 0156 /// @param gctx The current geometry context object, e.g. alignment 0157 /// @param lposition is the local position to be transformed 0158 /// @param direction is the global momentum direction (used to sign the closest approach) 0159 /// 0160 /// @return global position by value 0161 Vector3 localToGlobal(const GeometryContext& gctx, const Vector2& lposition, 0162 const Vector3& direction) const final; 0163 0164 /// Specified for `LineSurface`: global to local method without dynamic 0165 /// memory allocation. 0166 /// 0167 /// This method is the true global -> local transformation. It makes use of 0168 /// @c globalToLocal and indicates the sign of the @c Acts::eBoundLoc0 0169 /// by the given momentum direction. 0170 /// 0171 /// The calculation of the sign of the radius (or @f$ d_0 @f$) can be done as 0172 /// follows: 0173 /// May @f$ \vec d = \vec m - \vec c @f$ denote the difference between the 0174 /// center of the line and the global position of the measurement/predicted 0175 /// state. Then, @f$ \vec d @f$ lies in the so-called measurement plane. 0176 /// The latter is determined by the two orthogonal vectors @f$ 0177 /// \vec{\texttt{measY}} = \vec{e}_z @f$ and @f$ 0178 /// \vec{\texttt{measX}} = \vec{\texttt{measY}} \times 0179 /// \frac{\vec{p}}{|\vec{p}|} @f$. 0180 /// 0181 /// The sign of the radius (or @f$ d_{0} @f$ ) is then defined by the projection 0182 /// of @f$ \vec{d} @f$ on @f$ \vec{measX} @f$:<br> @f$ sign = -sign(\vec{d} 0183 /// \cdot \vec{measX}) @f$ 0184 /// 0185 /// @image html SignOfDriftCircleD0.gif 0186 /// 0187 /// @param gctx The current geometry context object, e.g. alignment 0188 /// @param position global 3D position - considered to be on surface but not 0189 /// inside bounds (check is done) 0190 /// @param direction global 3D momentum direction (optionally ignored) 0191 /// @param tolerance (unused) 0192 /// 0193 /// @return A `Result<Vector2>`, which is set to `!ok()` if the @p position is not 0194 /// the point of closest approach to the line surface. 0195 Result<Vector2> globalToLocal( 0196 const GeometryContext& gctx, const Vector3& position, 0197 const Vector3& direction, 0198 double tolerance = s_onSurfaceTolerance) const final; 0199 0200 /// Calculate the straight-line intersection with the line surface. 0201 /// 0202 /// <b>Mathematical motivation:</b> 0203 /// 0204 /// Given two lines in parametric form:<br> 0205 /// 0206 /// @f$ \vec l_{a}(u) = \vec m_a + u \cdot \vec e_{a} @f$ 0207 /// 0208 /// @f$ \vec l_{b}(\mu) = \vec m_b + \mu \cdot \vec e_{b} @f$ 0209 /// 0210 /// The vector between any two points on the two lines is given by: 0211 /// 0212 /// @f$ \vec s(u, \mu) = \vec l_{b} - l_{a} = \vec m_{ab} + \mu 0213 /// \cdot 0214 /// \vec e_{b} - u \cdot \vec e_{a} @f$, 0215 /// 0216 /// where @f$ \vec m_{ab} = \vec m_{b} - \vec m_{a} @f$. 0217 /// 0218 /// @f$ \vec s(u_0, \mu_0) @f$ denotes the vector between the two 0219 /// closest points 0220 /// 0221 /// @f$ \vec l_{a,0} = l_{a}(u_0) @f$ and @f$ \vec l_{b,0} = 0222 /// l_{b}(\mu_0) @f$ 0223 /// 0224 /// and is perpendicular to both, @f$ \vec e_{a} @f$ and @f$ \vec e_{b} @f$. 0225 /// 0226 /// This results in a system of two linear equations: 0227 /// 0228 /// - (i) @f$ 0 = \vec s(u_0, \mu_0) \cdot \vec e_a = \vec m_{ab} \cdot 0229 /// \vec e_a + \mu_0 \vec e_a \cdot \vec e_b - u_0 @f$ <br> 0230 /// - (ii) @f$ 0 = \vec s(u_0, \mu_0) \cdot \vec e_b = \vec m_{ab} \cdot 0231 /// \vec e_b + \mu_0 - u_0 \vec e_b \cdot \vec e_a @f$ <br> 0232 /// 0233 /// Solving (i) and (ii) for @f$ u @f$ and @f$ \mu_0 @f$ yields: 0234 /// 0235 /// - @f$ u_0 = \frac{(\vec m_{ab} \cdot \vec e_a)-(\vec m_{ab} \cdot \vec 0236 /// e_b)(\vec e_a \cdot \vec e_b)}{1-(\vec e_a \cdot \vec e_b)^2} @f$ <br> 0237 /// - @f$ \mu_0 = - \frac{(\vec m_{ab} \cdot \vec e_b)-(\vec m_{ab} \cdot \vec 0238 /// e_a)(\vec e_a \cdot \vec e_b)}{1-(\vec e_a \cdot \vec e_b)^2} @f$ <br> 0239 /// 0240 /// The function checks if @f$ u_0 \simeq 0@f$ to check if the current @p 0241 /// position is at the point of closest approach, i.e. the intersection 0242 /// point, in which case it will return an @c onSurace intersection result. 0243 /// Otherwise, the path length from @p position to the point of closest 0244 /// approach (@f$ u_0 @f$) is returned in a @c reachable intersection. 0245 /// 0246 /// @param gctx The current geometry context object, e.g. alignment 0247 /// @param position The global position as a starting point 0248 /// @param direction The global direction at the starting point 0249 /// @note expected to be normalized 0250 /// @param boundaryTolerance The boundary check directive for the estimate 0251 /// @param tolerance the tolerance used for the intersection 0252 /// @return is the intersection object 0253 MultiIntersection3D intersect( 0254 const GeometryContext& gctx, const Vector3& position, 0255 const Vector3& direction, 0256 const BoundaryTolerance& boundaryTolerance = 0257 BoundaryTolerance::Infinite(), 0258 double tolerance = s_onSurfaceTolerance) const final; 0259 0260 /// the pathCorrection for derived classes with thickness 0261 /// is by definition 1 for LineSurfaces 0262 /// 0263 /// @param gctx Geometry context (ignored) 0264 /// @param position Position parameter (ignored) 0265 /// @param direction Direction parameter (ignored) 0266 /// @note input parameters are ignored 0267 /// @note there's no material associated to the line surface 0268 /// @return Always returns 1.0 for line surfaces 0269 double pathCorrection(const GeometryContext& gctx, const Vector3& position, 0270 const Vector3& direction) const override; 0271 0272 /// This method returns the bounds of the surface by reference 0273 /// @return Reference to the surface bounds 0274 const SurfaceBounds& bounds() const final; 0275 /// This method returns the shared_ptr to the LineBounds 0276 /// @return Shared pointer to the line bounds 0277 const std::shared_ptr<const LineBounds>& boundsPtr() const; 0278 /// Overwrite the existing surface bounds with new ones 0279 /// @param newBounds: Pointer to the new bounds 0280 void assignSurfaceBounds(std::shared_ptr<const LineBounds> newBounds); 0281 0282 /// Return properly formatted class name for screen output 0283 /// @return String representation of the class name 0284 std::string name() const override; 0285 0286 /// Calculate the derivative of path length at the geometry constraint or 0287 /// point-of-closest-approach w.r.t. alignment parameters of the surface (i.e. 0288 /// translations along the local x/y/z axes and rotations represented with 0289 /// extrinsic Euler angles around the local x/y/z axes) 0290 /// 0291 /// @param gctx The current geometry context object, e.g. alignment 0292 /// @param position global 3D position 0293 /// @param direction global 3D momentum direction 0294 /// 0295 /// @return Derivative of path length w.r.t. the alignment parameters 0296 AlignmentToPathMatrix alignmentToPathDerivative( 0297 const GeometryContext& gctx, const Vector3& position, 0298 const Vector3& direction) const final; 0299 0300 /// Calculate the derivative of bound track parameters local position w.r.t. 0301 /// position in local 3D Cartesian coordinates. The bound coordinates of a 0302 /// line are measured in the direction-dependent measurement frame. 0303 /// 0304 /// @param gctx The current geometry context object, e.g. alignment 0305 /// @param position The position of the parameters in global 0306 /// @param direction The track direction, which sets the measurement frame 0307 /// 0308 /// @return Derivative of bound local position w.r.t. position in local 3D 0309 /// cartesian coordinates 0310 Matrix<2, 3> localCartesianToBoundLocalDerivative( 0311 const GeometryContext& gctx, const Vector3& position, 0312 const Vector3& direction) const final; 0313 0314 /// Get the line direction in global coordinates 0315 /// @param gctx The geometry context 0316 /// @return The direction vector of the line surface 0317 Vector3 lineDirection(const GeometryContext& gctx) const; 0318 0319 protected: 0320 std::shared_ptr<const LineBounds> m_bounds; ///< bounds (shared) 0321 0322 /// @copydoc Surface::localAxes 0323 std::array<AxisDirection, 2> localAxes() const override { 0324 return {AxisDirection::AxisR, AxisDirection::AxisZ}; 0325 } 0326 0327 private: 0328 /// helper function to apply the globalToLocal with out transform 0329 /// 0330 /// @param gctx The current geometry context object, e.g. alignment 0331 /// @param position is the global position 0332 /// @param direction is the momentum direction 0333 /// @param lposition is the local position to be filled 0334 bool globalToLocalPlain(const GeometryContext& gctx, const Vector3& position, 0335 const Vector3& direction, Vector2& lposition) const; 0336 }; 0337 0338 } // 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 |
|