Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:23:27

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019-2020 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 // Workaround for building on clang+libstdc++
0012 #include "Acts/Utilities/detail/ReferenceWrapperAnyCompat.hpp"
0013 
0014 #include "Acts/Definitions/Algebra.hpp"
0015 #include "Acts/Definitions/TrackParametrization.hpp"
0016 #include "Acts/EventData/TrackParameters.hpp"
0017 #include "Acts/EventData/detail/CorrectedTransformationFreeToBound.hpp"
0018 #include "Acts/Geometry/GeometryContext.hpp"
0019 #include "Acts/Surfaces/Surface.hpp"
0020 #include "Acts/Utilities/Result.hpp"
0021 
0022 #include <tuple>
0023 
0024 namespace Acts::detail {
0025 
0026 /// @brief These functions perform the transport of a covariance matrix using
0027 /// given Jacobians. The required data is provided by the stepper object
0028 /// with some additional data. Since this is a purely algebraic problem the
0029 /// calculations are identical for @c StraightLineStepper and @c EigenStepper.
0030 /// As a consequence the methods can be located in a separate file.
0031 
0032 /// Create and return the bound state at the current position
0033 ///
0034 /// @brief It does not check if the transported state is at the surface, this
0035 ///        needs to be guaranteed by the propagator
0036 ///
0037 /// @param [in] geoContext The geometry context
0038 /// @param [in, out] boundCovariance The covariance matrix of the state
0039 /// @param [in, out] fullTransportJacobian Full jacobian since the last reset
0040 /// @param [in, out] freeTransportJacobian Global jacobian since the last reset
0041 /// @param [in, out] freeToPathDerivatives Path length derivatives of the free,
0042 ///        nominal parameters
0043 /// @param [in, out] boundToFreeJacobian Projection jacobian of the last bound
0044 ///        parametrisation to free parameters
0045 /// @param [in, out] freeParameters Free, nominal parametrisation
0046 /// @param [in] particleHypothesis Particle hypothesis
0047 /// @param [in] covTransport Decision whether the covariance transport should be
0048 ///        performed
0049 /// @param [in] accumulatedPath Propagated distance
0050 /// @param [in] surface Target surface on which the state is represented
0051 /// @param [in] freeToBoundCorrection Correction for non-linearity effect during
0052 ///        transform from free to bound
0053 ///
0054 /// @return A bound state:
0055 ///   - the parameters at the surface
0056 ///   - the stepwise jacobian towards it (from last bound)
0057 ///   - and the path length (from start - for ordering)
0058 Result<std::tuple<BoundTrackParameters, BoundMatrix, double>> boundState(
0059     const GeometryContext& geoContext, const Surface& surface,
0060     BoundSquareMatrix& boundCovariance, BoundMatrix& fullTransportJacobian,
0061     FreeMatrix& freeTransportJacobian, FreeVector& freeToPathDerivatives,
0062     BoundToFreeMatrix& boundToFreeJacobian, FreeVector& freeParameters,
0063     const ParticleHypothesis& particleHypothesis, bool covTransport,
0064     double accumulatedPath, const FreeToBoundCorrection& freeToBoundCorrection);
0065 
0066 /// Create and return a curvilinear state at the current position
0067 ///
0068 /// @brief This creates a curvilinear state.
0069 ///
0070 /// @param [in, out] boundCovariance The covariance matrix of the state
0071 /// @param [in, out] fullTransportJacobian Full jacobian since the last reset
0072 /// @param [in, out] freeTransportJacobian Global jacobian since the last reset
0073 /// @param [in, out] freeToPathDerivatives Path length derivatives of the free,
0074 ///        nominal parameters
0075 /// @param [in, out] boundToFreeJacobian Projection jacobian of the last bound
0076 ///        parametrisation to free parameters
0077 /// @param [in] freeParameters Free, nominal parametrisation
0078 /// @param [in] particleHypothesis Particle hypothesis
0079 /// @param [in] covTransport Decision whether the covariance transport should be
0080 ///        performed
0081 /// @param [in] accumulatedPath Propagated distance
0082 ///
0083 /// @return A curvilinear state:
0084 ///   - the curvilinear parameters at given position
0085 ///   - the stepweise jacobian towards it (from last bound)
0086 ///   - and the path length (from start - for ordering)
0087 std::tuple<CurvilinearTrackParameters, BoundMatrix, double> curvilinearState(
0088     BoundSquareMatrix& boundCovariance, BoundMatrix& fullTransportJacobian,
0089     FreeMatrix& transportJacobian, FreeVector& freeToPathDerivatives,
0090     BoundToFreeMatrix& boundToFreeJacobian, const FreeVector& freeParameters,
0091     const ParticleHypothesis& particleHypothesis, bool covTransport,
0092     double accumulatedPath);
0093 
0094 /// @brief Method for on-demand covariance transport of a bound/curvilinear to
0095 ///        another bound representation.
0096 ///
0097 /// @param [in] geoContext The geometry context
0098 /// @param [in] surface is the surface to which the covariance is forwarded to
0099 /// @param [in, out] boundCovariance The covariance matrix of the state
0100 /// @param [in, out] fullTransportJacobian Full jacobian since the last reset
0101 /// @param [in, out] freeTransportJacobian Global jacobian since the last reset
0102 /// @param [in, out] freeToPathDerivatives Path length derivatives
0103 /// @param [in, out] boundToFreeJacobian Projection jacobian of the last bound
0104 ///        parametrisation to free parameters
0105 /// @param [in, out] freeParameters Free, nominal parametrisation
0106 /// @param [in] freeToBoundCorrection Correction for non-linearity effect during
0107 ///        transform from free to bound
0108 ///
0109 /// @note No check is done if the position is actually on the surface
0110 ///
0111 void transportCovarianceToBound(
0112     const GeometryContext& geoContext, const Surface& surface,
0113     BoundSquareMatrix& boundCovariance, BoundMatrix& fullTransportJacobian,
0114     FreeMatrix& freeTransportJacobian, FreeVector& freeToPathDerivatives,
0115     BoundToFreeMatrix& boundToFreeJacobian, FreeVector& freeParameters,
0116     const FreeToBoundCorrection& freeToBoundCorrection);
0117 
0118 /// @brief Method for on-demand covariance transport of a bound/curvilinear
0119 ///        to a new curvilinear representation.
0120 ///
0121 /// @param [in, out] boundCovariance The covariance matrix of the state
0122 /// @param [in, out] fullTransportJacobian Full jacobian since the last reset
0123 /// @param [in, out] freeTransportJacobian Global jacobian since the last reset
0124 /// @param [in, out] freeToPathDerivatives Path length derivatives
0125 /// @param [in, out] boundToFreeJacobian Projection jacobian of the last bound
0126 ///        parametrisation to free parameters
0127 /// @param [in] direction Normalised direction vector
0128 ///
0129 void transportCovarianceToCurvilinear(BoundSquareMatrix& boundCovariance,
0130                                       BoundMatrix& fullTransportJacobian,
0131                                       FreeMatrix& freeTransportJacobian,
0132                                       FreeVector& freeToPathDerivatives,
0133                                       BoundToFreeMatrix& boundToFreeJacobian,
0134                                       const Vector3& direction);
0135 
0136 /// Convert bound track parameters to another bound surface.
0137 /// @pre The @p targetSurface must intersect with the surface attached to
0138 ///      @p boundParameters, and the parameters must be on-surface on the
0139 ///      target surface.
0140 /// @param gctx The geometry context.
0141 /// @param boundParameters The bound track parameters to convert.
0142 /// @param targetSurface The target surface.
0143 /// @param bField The magnetic field at the target surface.
0144 /// @return The converted bound track parameters.
0145 Result<BoundTrackParameters> boundToBoundConversion(
0146     const GeometryContext& gctx, const BoundTrackParameters& boundParameters,
0147     const Surface& targetSurface, const Vector3& bField = Vector3::Zero());
0148 
0149 }  // namespace Acts::detail