![]() |
|
|||
File indexing completed on 2025-07-02 08:05:38
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2017-2019 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 #include "Acts/Propagator/Propagator.hpp" 0012 #include "Acts/Surfaces/Surface.hpp" 0013 0014 namespace Acts { 0015 0016 /// @brief This class performs the Ridders algorithm to estimate the propagation 0017 /// of the covariance to a certain point in space. 0018 /// 0019 /// The algorithm is based on the small deviations of the start parameters based 0020 /// on their uncertainty at the beginning of the propgation. This deviation is 0021 /// represented here by a vector of relative deviations of these parameters and 0022 /// fix for all parameters. So, a common choice has to be found that is able to 0023 /// actually fit into the order of magnitude of the uncertainty of each 0024 /// parameter. Using these deviations, the propagation is repeated multiple 0025 /// times and the final covariance matrix at a given target surface is 0026 /// afterwards evaluated by first order derivatives of the final state 0027 /// parameters wrt. the initial parameters. Therefore this evaluation represents 0028 /// a first order approximation of the transport jacobian. Since performing 0029 /// multiple propagations and a numerical evaluation of the covariance requires 0030 /// more time than a single propagation towards a target + a common propagation 0031 /// of the covariance, this class just serves to verify the results of the 0032 /// latter classes. 0033 template <typename propagator_t> 0034 class RiddersPropagator { 0035 using Jacobian = BoundMatrix; 0036 using Covariance = BoundSquareMatrix; 0037 0038 /// 0039 /// @note The result_type_helper struct and the action_list_t_result_t are 0040 /// here to allow a look'n'feel of this class like the Propagator itself 0041 /// 0042 0043 /// @brief Helper struct determining the result's type 0044 /// 0045 /// @tparam parameters_t Type of final track parameters 0046 /// @tparam action_list_t List of propagation action types 0047 /// 0048 /// This helper struct provides type definitions to extract the correct 0049 /// propagation result type from a given TrackParameter type and an 0050 /// ActionList. 0051 /// 0052 template <typename parameters_t, typename action_list_t> 0053 struct result_type_helper { 0054 /// @brief Propagation result type for an arbitrary list of additional 0055 /// propagation results 0056 /// 0057 /// @tparam args Parameter pack specifying additional propagation results 0058 /// 0059 template <typename... args> 0060 using this_result_type = PropagatorResult<parameters_t, args...>; 0061 0062 /// @brief Propagation result type derived from a given action list 0063 using type = typename action_list_t::template result_type<this_result_type>; 0064 }; 0065 0066 /// @brief Short-hand type definition for propagation result derived from 0067 /// an action list 0068 /// 0069 /// @tparam parameters_t Type of the final track parameters 0070 /// @tparam action_list_t List of propagation action types 0071 /// 0072 template <typename parameters_t, typename action_list_t> 0073 using action_list_t_result_t = 0074 typename result_type_helper<parameters_t, action_list_t>::type; 0075 0076 public: 0077 struct Config { 0078 /// Set of deltas which will be added to the nominal track parameters 0079 std::vector<double> deviations = {-4e-4, -2e-4, 2e-4, 4e-4}; 0080 /// See `deviations` - these are applied for disc surfaces 0081 std::vector<double> deviationsDisc = {-3e-5, -1e-5, 1e-5, 3e-5}; 0082 }; 0083 0084 template <typename action_list_t = ActionList<>, 0085 typename aborter_list_t = AbortList<>> 0086 using Options = 0087 typename propagator_t::template Options<action_list_t, aborter_list_t>; 0088 0089 /// @brief Constructor using a propagator 0090 /// 0091 /// @param [in] propagator Underlying propagator that will be used 0092 /// @param [in] config Config for the Ridders propagation 0093 RiddersPropagator(propagator_t propagator, Config config = {}) 0094 : m_propagator(std::move(propagator)), m_config(std::move(config)) {} 0095 0096 /// @brief Constructor building a propagator 0097 /// 0098 /// @tparam stepper_t Type of the stepper 0099 /// @tparam navigator_t Type of the navigator 0100 /// 0101 /// @param [in] stepper Stepper that will be used 0102 /// @param [in] navigator Navigator that will be used 0103 /// @param [in] config Config for the Ridders propagation 0104 template <typename stepper_t, typename navigator_t = VoidNavigator> 0105 RiddersPropagator(stepper_t stepper, navigator_t navigator = navigator_t(), 0106 Config config = {}) 0107 : m_propagator(std::move(stepper), std::move(navigator)), 0108 m_config(std::move(config)) {} 0109 0110 /// @brief Propagation method targeting curvilinear parameters 0111 /// 0112 /// @tparam parameters_t Type of the start parameters 0113 /// @tparam propagator_options_t Type of the propagator options 0114 /// 0115 /// @param [in] start Start parameters 0116 /// @param [in] options Options of the propagations 0117 /// 0118 /// @return Result of the propagation 0119 template <typename parameters_t, typename propagator_options_t> 0120 Result< 0121 action_list_t_result_t<CurvilinearTrackParameters, 0122 typename propagator_options_t::action_list_type>> 0123 propagate(const parameters_t& start, 0124 const propagator_options_t& options) const; 0125 0126 /// @brief Propagation method targeting bound parameters 0127 /// 0128 /// @tparam parameters_t Type of the start parameters 0129 /// @tparam propagator_options_t Type of the propagator options 0130 /// 0131 /// @param [in] start Start parameters 0132 /// @param [in] target The target surface 0133 /// @param [in] options Options of the propagations 0134 /// 0135 /// @return Result of the propagation 0136 /// @note If the target surface is a disc, the resulting covariance may be 0137 /// inconsistent. In this case a zero matrix is returned. 0138 template <typename parameters_t, typename propagator_options_t> 0139 Result<action_list_t_result_t< 0140 BoundTrackParameters, typename propagator_options_t::action_list_type>> 0141 propagate(const parameters_t& start, const Surface& target, 0142 const propagator_options_t& options) const; 0143 0144 private: 0145 /// Does the actual ridders propagation by wiggling the parameters and 0146 /// propagating again. This function is called from the different propagation 0147 /// overloads in order to deduplicate code. 0148 /// 0149 /// @param [in] options Options of the propagations 0150 /// @param [in] start Start parameters 0151 /// @param [in] nominalResult The result of the nominal propagation 0152 template <typename propagator_options_t, typename parameters_t, 0153 typename result_t> 0154 Jacobian wiggleAndCalculateJacobian(const propagator_options_t& options, 0155 const parameters_t& start, 0156 result_t& nominalResult) const; 0157 0158 /// @brief This function tests whether the variations on a disc as target 0159 /// surface lead to results on different sides wrt the center of the disc. 0160 /// This would lead to a flip of the phi value on the surface and therewith to 0161 /// a huge variance in that parameter. It can only occur in this algorithm 0162 /// since the ridders algorithm is unaware of the target surface. 0163 /// 0164 /// @param [in] derivatives Derivatives of a single parameter 0165 /// 0166 /// @return Boolean result whether a phi jump occurred 0167 static bool inconsistentDerivativesOnDisc( 0168 const std::vector<BoundVector>& derivatives); 0169 0170 /// @brief This function wiggles one dimension of the starting parameters, 0171 /// performs the propagation to a surface and collects for each change of the 0172 /// start parameters the slope 0173 /// 0174 /// @tparam options_t PropagatorOptions object 0175 /// @tparam parameters_t Type of the parameters to start the propagation with 0176 /// 0177 /// @param [in] options Options do define how to wiggle 0178 /// @param [in] start Start parameters which will be modified 0179 /// @param [in] param Index to get the parameter that will be modified 0180 /// @param [in] target Target surface 0181 /// @param [in] nominal Nominal end parameters 0182 /// @param [in] deviations Vector of deviations 0183 /// 0184 /// @return Vector containing each slope 0185 template <typename propagator_options_t, typename parameters_t> 0186 std::vector<BoundVector> wiggleParameter( 0187 const propagator_options_t& options, const parameters_t& start, 0188 unsigned int param, const Surface& target, const BoundVector& nominal, 0189 const std::vector<double>& deviations) const; 0190 0191 /// @brief This function fits the jacobian with the deviations and derivatives as input. 0192 /// 0193 /// @param [in] deviations Vector of deviations 0194 /// @param [in] derivatives Slopes of each modification of the parameters 0195 /// 0196 /// @return Propagated jacobian matrix 0197 static Jacobian calculateJacobian( 0198 const std::vector<double>& deviations, 0199 const std::array<std::vector<BoundVector>, eBoundSize>& derivatives); 0200 0201 /// @brief This function fits a linear function through the final state 0202 /// parametrisations 0203 /// 0204 /// @param [in] deviations Vector of deviations 0205 /// @param [in] derivatives Vector of resulting derivatives 0206 /// 0207 /// @return Vector containing the linear fit 0208 static BoundVector fitLinear(const std::vector<double>& deviations, 0209 const std::vector<BoundVector>& derivatives); 0210 0211 propagator_t m_propagator; 0212 Config m_config; 0213 }; 0214 } // namespace Acts 0215 0216 #include "Acts/Propagator/RiddersPropagator.ipp"
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |