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