|
||||
File indexing completed on 2025-01-18 09:11:03
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/Definitions/TrackParametrization.hpp" 0014 #include "Acts/Geometry/GeometryContext.hpp" 0015 #include "Acts/Geometry/Polyhedron.hpp" 0016 #include "Acts/Surfaces/BoundaryTolerance.hpp" 0017 #include "Acts/Surfaces/DiscBounds.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 0024 #include <memory> 0025 #include <numbers> 0026 #include <string> 0027 0028 namespace Acts { 0029 0030 class DetectorElementBase; 0031 class DiscBounds; 0032 class SurfaceBounds; 0033 0034 /// @class DiscSurface 0035 /// 0036 /// Class for a disc surface (or a segment thereof) 0037 /// 0038 /// The DiscSurface is defined by the local polar coordinates @f$ (r,phi) @f$. 0039 /// 0040 /// The surface transform positions the disc such that the origin 0041 /// is at @f$ r=0 @f$, independent of the provided \c DiscBounds. 0042 /// The normal vector of the disc (i.e., the local @f$z@f$-axis) is given by 0043 /// @f$ \vec e_{z} = \vec e_{r} \times\vec e_{phi} @f$. 0044 /// 0045 /// The disc surface The only surface type for which the 0046 /// covariance matrix is NOT given in the reference frame. 0047 /// A conversion from polar to cartesian coordinates needs 0048 /// to happen to transfer the local coordinates onto the 0049 /// cartesian reference frame coordinates. 0050 /// 0051 /// @image html DiscSurface.png 0052 /// 0053 class DiscSurface : public RegularSurface { 0054 friend class Surface; 0055 0056 protected: 0057 /// Constructor for Discs from Transform3, \f$ r_{min}, r_{max} \f$ 0058 /// 0059 /// @param transform is transform that places the disc in the global 3D space 0060 /// @param rmin The inner radius of the disc surface 0061 /// @param rmax The outer radius of the disc surface 0062 /// @param hphisec The opening angle of the disc surface and is optional 0063 /// the default is a full disc 0064 DiscSurface(const Transform3& transform, double rmin, double rmax, 0065 double hphisec = std::numbers::pi); 0066 0067 /// Constructor for Discs from Transform3, \f$ r_{min}, r_{max}, hx_{min}, 0068 /// hx_{max} \f$ 0069 /// This is n this case you have DiscTrapezoidBounds 0070 /// 0071 /// @param transform is transform that places the disc in the global 3D space 0072 /// @param minhalfx The half length in x at minimal r 0073 /// @param maxhalfx The half length in x at maximal r 0074 /// @param minR The outer radius of the disc surface 0075 /// @param maxR The inner radius of the disc surface 0076 /// @param avephi The position in phi (default is 0.) 0077 /// @param stereo The optional stereo angle 0078 DiscSurface(const Transform3& transform, double minhalfx, double maxhalfx, 0079 double minR, double maxR, double avephi = 0., double stereo = 0.); 0080 0081 /// Constructor for Discs from Transform3 and shared DiscBounds 0082 /// 0083 /// @param transform The transform that positions the disc in global 3D 0084 /// @param dbounds The disc bounds describing the surface coverage 0085 DiscSurface(const Transform3& transform, 0086 std::shared_ptr<const DiscBounds> dbounds = nullptr); 0087 0088 /// Constructor from DetectorElementBase : Element proxy 0089 /// 0090 /// @param dbounds The disc bounds describing the surface coverage 0091 /// @param detelement The detector element represented by this surface 0092 DiscSurface(std::shared_ptr<const DiscBounds> dbounds, 0093 const DetectorElementBase& detelement); 0094 0095 /// Copy Constructor 0096 /// 0097 /// @param other The source surface for the copy 0098 DiscSurface(const DiscSurface& other); 0099 0100 /// Copy constructor - with shift 0101 /// 0102 /// @param gctx The current geometry context object, e.g. alignment 0103 /// @param other is the source cone surface 0104 /// @param shift is the additional transform applied after copying 0105 DiscSurface(const GeometryContext& gctx, const DiscSurface& other, 0106 const Transform3& shift); 0107 0108 public: 0109 /// Assignment operator 0110 /// 0111 /// @param other The source sourface for the assignment 0112 DiscSurface& operator=(const DiscSurface& other); 0113 0114 /// Return the surface type 0115 SurfaceType type() const override; 0116 0117 // User overloads from `RegularSurface` 0118 using RegularSurface::globalToLocal; 0119 using RegularSurface::localToGlobal; 0120 using RegularSurface::normal; 0121 0122 /// Normal vector return 0123 /// 0124 /// @param gctx The current geometry context object, e.g. alignment 0125 /// @param lposition The local position is ignored 0126 /// 0127 /// @return a Vector3 by value 0128 Vector3 normal(const GeometryContext& gctx, 0129 const Vector2& lposition) const final; 0130 0131 /// Get the normal vector of this surface at a given global position 0132 /// @note The @p position is required to be on-surface. 0133 /// @param gctx The current geometry context object, e.g. alignment 0134 /// @param position is the global positiono (for @ref DiscSurface this is ignored) 0135 /// @return The normal vector 0136 Vector3 normal(const GeometryContext& gctx, 0137 const Vector3& position) const final; 0138 0139 /// Get the normal vector, independent of the location 0140 /// @param gctx The current geometry context object, e.g. alignment 0141 /// @return The normal vector 0142 Vector3 normal(const GeometryContext& gctx) const; 0143 0144 /// A reference position for a given axis direction 0145 /// 0146 /// @param gctx The current geometry context object, e.g. alignment 0147 /// @param aDir The axis direction for the reference position request 0148 /// @return position that can beused for this binning 0149 Vector3 referencePosition(const GeometryContext& gctx, 0150 AxisDirection aDir) const final; 0151 0152 /// A reference position value for a given axis direction 0153 /// 0154 /// @param gctx The current geometry context object, e.g. alignment 0155 /// @param aDir the value generated for the reference position 0156 /// 0157 /// @note This calls the parent method except for AxisR 0158 /// 0159 /// @return float to be used for the binning schema 0160 double referencePositionValue(const GeometryContext& gctx, 0161 AxisDirection aDir) const final; 0162 0163 /// This method returns the bounds by reference 0164 const SurfaceBounds& bounds() const final; 0165 0166 /// Local to global transformation 0167 /// For planar surfaces the momentum direction is ignored in the local to 0168 /// global transformation 0169 /// 0170 /// @param gctx The current geometry context object, e.g. alignment 0171 /// @param lposition local 2D position in specialized surface frame 0172 /// 0173 /// @return global position by value 0174 Vector3 localToGlobal(const GeometryContext& gctx, 0175 const Vector2& lposition) const final; 0176 0177 /// Global to local transformation 0178 /// @note the direction is ignored for Disc surfaces in this calculateion 0179 /// 0180 /// @param gctx The current geometry context object, e.g. alignment 0181 /// @param position global 3D position - considered to be on surface but not 0182 /// inside bounds (check is done) 0183 /// @param tolerance optional tolerance within which a point is considered 0184 /// valid on surface 0185 /// 0186 /// @return a Result<Vector2> which can be !ok() if the operation fails 0187 Result<Vector2> globalToLocal( 0188 const GeometryContext& gctx, const Vector3& position, 0189 double tolerance = s_onSurfaceTolerance) const final; 0190 0191 /// Special method for DiscSurface : local<->local transformations polar <-> 0192 /// cartesian 0193 /// 0194 /// @param lpolar is a local position in polar coordinates 0195 /// 0196 /// @return values is local 2D position in cartesian coordinates @todo check 0197 Vector2 localPolarToCartesian(const Vector2& lpolar) const; 0198 0199 /// Special method for Disc surface : local<->local transformations polar <-> 0200 /// cartesian 0201 /// 0202 /// @param lcart is local 2D position in cartesian coordinates 0203 /// 0204 /// @return value is a local position in polar coordinates 0205 Vector2 localCartesianToPolar(const Vector2& lcart) const; 0206 0207 /// Special method for DiscSurface : local<->local transformations polar <-> 0208 /// cartesian 0209 /// 0210 /// @param locpol is a local position in polar coordinates 0211 /// 0212 /// @return values is local 2D position in cartesian coordinates 0213 Vector2 localPolarToLocalCartesian(const Vector2& locpol) const; 0214 0215 /// Special method for DiscSurface : local<->global transformation when 0216 /// provided cartesian coordinates 0217 /// 0218 /// @param gctx The current geometry context object, e.g. alignment 0219 /// @param lposition is local 2D position in cartesian coordinates 0220 /// 0221 /// @return value is a global cartesian 3D position 0222 Vector3 localCartesianToGlobal(const GeometryContext& gctx, 0223 const Vector2& lposition) const; 0224 0225 /// Special method for DiscSurface : global<->local from cartesian coordinates 0226 /// 0227 /// @param gctx The current geometry context object, e.g. alignment 0228 /// @param position is a global cartesian 3D position 0229 /// @param tol The absolute tolerance parameter 0230 /// 0231 /// @return value is a local polar 0232 Vector2 globalToLocalCartesian(const GeometryContext& gctx, 0233 const Vector3& position, 0234 double tol = 0.) const; 0235 0236 /// Calculate the jacobian from local to global which the surface knows best, 0237 /// hence the calculation is done here. 0238 /// 0239 /// @param gctx The current geometry context object, e.g. alignment 0240 /// @param position global 3D position 0241 /// @param direction global 3D momentum direction 0242 /// 0243 /// @return Jacobian from local to global 0244 BoundToFreeMatrix boundToFreeJacobian(const GeometryContext& gctx, 0245 const Vector3& position, 0246 const Vector3& direction) const final; 0247 0248 /// Calculate the jacobian from global to local which the surface knows best, 0249 /// hence the calculation is done here. 0250 /// 0251 /// @param gctx The current geometry context object, e.g. alignment 0252 /// @param position global 3D position 0253 /// @param direction global 3D momentum direction 0254 /// 0255 /// @return Jacobian from global to local 0256 FreeToBoundMatrix freeToBoundJacobian(const GeometryContext& gctx, 0257 const Vector3& position, 0258 const Vector3& direction) const final; 0259 0260 /// Path correction due to incident of the track 0261 /// 0262 /// @param gctx The current geometry context object, e.g. alignment 0263 /// @param position The global position as a starting point 0264 /// @param direction The global momentum direction at the starting point 0265 /// @return The correction factor due to incident 0266 double pathCorrection(const GeometryContext& gctx, const Vector3& position, 0267 const Vector3& direction) const final; 0268 0269 /// @brief Straight line intersection schema 0270 /// 0271 /// @param gctx The current geometry context object, e.g. alignment 0272 /// @param position The global position as a starting point 0273 /// @param direction The global direction at the starting point 0274 /// @note expected to be normalized (no checking) 0275 /// @param boundaryTolerance The boundary check prescription 0276 /// @param tolerance the tolerance used for the intersection 0277 /// 0278 /// <b>Mathematical motivation:</b> 0279 /// 0280 /// the equation of the plane is given by: <br> 0281 /// @f$ \vec n \cdot \vec x = \vec n \cdot \vec p,@f$ <br> 0282 /// where @f$ \vec n = (n_{x}, n_{y}, n_{z})@f$ denotes the normal vector of 0283 /// the plane, @f$ \vec p = (p_{x}, p_{y}, p_{z})@f$ one specific point on 0284 /// the plane and @f$ \vec x = (x,y,z) @f$ all possible points 0285 /// on the plane.<br> 0286 /// Given a line with:<br> 0287 /// @f$ \vec l(u) = \vec l_{1} + u \cdot \vec v @f$, <br> 0288 /// the solution for @f$ u @f$ can be written: 0289 /// @f$ u = \frac{\vec n (\vec p - \vec l_{1})}{\vec n \vec v}@f$ <br> 0290 /// If the denominator is 0 then the line lies: 0291 /// - either in the plane 0292 /// - perpendicular to the normal of the plane 0293 /// 0294 /// @return The @c SurfaceMultiIntersection object 0295 SurfaceMultiIntersection intersect( 0296 const GeometryContext& gctx, const Vector3& position, 0297 const Vector3& direction, 0298 const BoundaryTolerance& boundaryTolerance = 0299 BoundaryTolerance::Infinite(), 0300 double tolerance = s_onSurfaceTolerance) const final; 0301 0302 /// Return properly formatted class name for screen output 0303 std::string name() const override; 0304 0305 /// Return a Polyhedron for the surfaces 0306 /// 0307 /// @param gctx The current geometry context object, e.g. alignment 0308 /// @param quarterSegments Number of segments used to describe the 0309 /// quarter of a full circle 0310 /// 0311 /// @return A list of vertices and a face/facett description of it 0312 Polyhedron polyhedronRepresentation( 0313 const GeometryContext& gctx, unsigned int quarterSegments) const override; 0314 0315 /// Calculate the derivative of bound track parameters local position w.r.t. 0316 /// position in local 3D Cartesian coordinates 0317 /// 0318 /// @param gctx The current geometry context object, e.g. alignment 0319 /// @param position The position of the parameters in global 0320 /// 0321 /// @return Derivative of bound local position w.r.t. position in local 3D 0322 /// cartesian coordinates 0323 ActsMatrix<2, 3> localCartesianToBoundLocalDerivative( 0324 const GeometryContext& gctx, const Vector3& position) const final; 0325 0326 /// Merge two disc surfaces into a single one. 0327 /// @image html Disc_Merging.svg 0328 /// @note The surfaces need to be *compatible*, i.e. have disc bounds 0329 /// that align 0330 /// @param other The other disc surface to merge with 0331 /// @param direction The binning direction: either @c AxisR or @c AxisPhi 0332 /// @param externalRotation If true, any phi rotation is done in the transform 0333 /// @param logger The logger to use 0334 /// @return The merged disc surface and a boolean indicating if surfaces are reversed 0335 /// @note The returned boolean is `false` if `this` is *left* or 0336 /// *counter-clockwise* of @p other, and `true` if not. 0337 std::pair<std::shared_ptr<DiscSurface>, bool> mergedWith( 0338 const DiscSurface& other, AxisDirection direction, bool externalRotation, 0339 const Logger& logger = getDummyLogger()) const; 0340 0341 protected: 0342 std::shared_ptr<const DiscBounds> m_bounds; ///< bounds (shared) 0343 }; 0344 0345 static_assert(RegularSurfaceConcept<DiscSurface>, 0346 "DiscSurface does not fulfill RegularSurfaceConcept"); 0347 0348 } // 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 |