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