Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:50

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/Utilities/Result.hpp"
0016 #include "Acts/Utilities/detail/periodic.hpp"
0017 
0018 #include <numbers>
0019 
0020 namespace Acts {
0021 
0022 class Surface;
0023 
0024 /// Reflect bound track parameters.
0025 ///
0026 /// @param boundParams Bound track parameters vector
0027 /// @return Reflected bound track parameters vector
0028 inline BoundVector reflectBoundParameters(const BoundVector& boundParams) {
0029   BoundVector reflected = boundParams;
0030   auto [phi, theta] =
0031       detail::normalizePhiTheta(boundParams[eBoundPhi] - std::numbers::pi,
0032                                 std::numbers::pi - boundParams[eBoundTheta]);
0033   reflected[eBoundPhi] = phi;
0034   reflected[eBoundTheta] = theta;
0035   reflected[eBoundQOverP] = -boundParams[eBoundQOverP];
0036   return reflected;
0037 }
0038 
0039 /// Reflect free track parameters.
0040 ///
0041 /// @param freeParams Free track parameters vector
0042 /// @return Reflected free track parameters vector
0043 inline FreeVector reflectFreeParameters(const FreeVector& freeParams) {
0044   FreeVector reflected = freeParams;
0045   reflected[eFreeDir0] = -freeParams[eFreeDir0];
0046   reflected[eFreeDir1] = -freeParams[eFreeDir1];
0047   reflected[eFreeDir2] = -freeParams[eFreeDir2];
0048   reflected[eFreeQOverP] = -freeParams[eFreeQOverP];
0049   return reflected;
0050 }
0051 
0052 /// Transform bound track parameters into equivalent free track parameters.
0053 ///
0054 /// @param surface Surface onto which the input parameters are bound
0055 /// @param geoCtx Geometry context for the local-to-global transformation
0056 /// @param boundParams Bound track parameters vector
0057 /// @return Equivalent free trackparameters vector
0058 FreeVector transformBoundToFreeParameters(const Surface& surface,
0059                                           const GeometryContext& geoCtx,
0060                                           const BoundVector& boundParams);
0061 
0062 /// Convert free track parameters to bound track parameters.
0063 ///
0064 /// @param freeParams Free track parameters vector
0065 /// @param surface Surface onto which the parameters are bound
0066 /// @param geoCtx Geometry context for the global-to-local transformation
0067 /// @param tolerance Tolerance used for globalToLocal
0068 ///
0069 /// @return Bound track parameters vector on the given surface
0070 Result<BoundVector> transformFreeToBoundParameters(
0071     const FreeVector& freeParams, const Surface& surface,
0072     const GeometryContext& geoCtx, double tolerance = s_onSurfaceTolerance);
0073 
0074 /// Convert position and direction to bound track parameters.
0075 ///
0076 /// @param position Global track three-position
0077 /// @param time Global track time
0078 /// @param direction Global direction three-vector; normalization is ignored.
0079 /// @param qOverP Charge-over-momentum-like parameter
0080 /// @param surface Surface onto which the parameters are bound
0081 /// @param geoCtx Geometry context for the global-to-local transformation
0082 /// @param tolerance Tolerance used for globalToLocal
0083 ///
0084 /// @return Equivalent bound parameters vector on the given surface
0085 Result<BoundVector> transformFreeToBoundParameters(
0086     const Vector3& position, double time, const Vector3& direction,
0087     double qOverP, const Surface& surface, const GeometryContext& geoCtx,
0088     double tolerance = s_onSurfaceTolerance);
0089 
0090 /// Convert direction to curvilinear track parameters.
0091 ///
0092 /// @param time Global track time
0093 /// @param direction Global direction three-vector; normalization is ignored.
0094 /// @param qOverP Charge-over-momentum-like parameter
0095 /// @return Equivalent bound parameters vector on the curvilinear surface
0096 ///
0097 /// @note The parameters are assumed to be defined at the origin of the
0098 ///       curvilinear frame derived from the direction vector. The local
0099 ///       coordinates are zero by construction.
0100 BoundVector transformFreeToCurvilinearParameters(double time,
0101                                                  const Vector3& direction,
0102                                                  double qOverP);
0103 
0104 /// Convert direction angles to curvilinear track parameters.
0105 ///
0106 /// @param time Global track time
0107 /// @param phi Global transverse direction angle
0108 /// @param theta Global longitudinal direction angle
0109 /// @param qOverP Charge-over-momentum-like parameter
0110 /// @return Equivalent bound parameters vector on the curvilinear surface
0111 ///
0112 /// @note The parameters are assumed to be defined at the origin of the
0113 ///       curvilinear frame derived from the direction angles. The local
0114 ///       coordinates are zero by construction.
0115 BoundVector transformFreeToCurvilinearParameters(double time, double phi,
0116                                                  double theta, double qOverP);
0117 
0118 }  // namespace Acts