Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Acts/Propagator/RiddersPropagator.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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   /// @brief Constructor using a propagator
0085   ///
0086   /// @param [in] propagator Underlying propagator that will be used
0087   /// @param [in] config Config for the Ridders propagation
0088   RiddersPropagator(propagator_t propagator, Config config = {})
0089       : m_propagator(std::move(propagator)), m_config(std::move(config)) {}
0090 
0091   /// @brief Constructor building a propagator
0092   ///
0093   /// @tparam stepper_t Type of the stepper
0094   /// @tparam navigator_t Type of the navigator
0095   ///
0096   /// @param [in] stepper Stepper that will be used
0097   /// @param [in] navigator Navigator that will be used
0098   /// @param [in] config Config for the Ridders propagation
0099   template <typename stepper_t, typename navigator_t = VoidNavigator>
0100   RiddersPropagator(stepper_t stepper, navigator_t navigator = navigator_t(),
0101                     Config config = {})
0102       : m_propagator(std::move(stepper), std::move(navigator)),
0103         m_config(std::move(config)) {}
0104 
0105   /// @brief Propagation method targeting curvilinear parameters
0106   ///
0107   /// @tparam parameters_t Type of the start parameters
0108   /// @tparam propagator_options_t Type of the propagator options
0109   ///
0110   /// @param [in] start Start parameters
0111   /// @param [in] options Options of the propagations
0112   ///
0113   /// @return Result of the propagation
0114   template <typename parameters_t, typename propagator_options_t>
0115   Result<
0116       action_list_t_result_t<CurvilinearTrackParameters,
0117                              typename propagator_options_t::action_list_type>>
0118   propagate(const parameters_t& start,
0119             const propagator_options_t& options) const;
0120 
0121   /// @brief Propagation method targeting bound parameters
0122   ///
0123   /// @tparam parameters_t Type of the start parameters
0124   /// @tparam propagator_options_t Type of the propagator options
0125   ///
0126   /// @param [in] start Start parameters
0127   /// @param [in] target The target surface
0128   /// @param [in] options Options of the propagations
0129   ///
0130   /// @return Result of the propagation
0131   /// @note If the target surface is a disc, the resulting covariance may be
0132   /// inconsistent. In this case a zero matrix is returned.
0133   template <typename parameters_t, typename propagator_options_t>
0134   Result<action_list_t_result_t<
0135       BoundTrackParameters, typename propagator_options_t::action_list_type>>
0136   propagate(const parameters_t& start, const Surface& target,
0137             const propagator_options_t& options) const;
0138 
0139  private:
0140   /// Does the actual ridders propagation by wiggling the parameters and
0141   /// propagating again. This function is called from the different propagation
0142   /// overloads in order to deduplicate code.
0143   ///
0144   /// @param [in] options Options of the propagations
0145   /// @param [in] start Start parameters
0146   /// @param [in] nominalResult The result of the nominal propagation
0147   template <typename propagator_options_t, typename parameters_t,
0148             typename result_t>
0149   Jacobian wiggleAndCalculateJacobian(const propagator_options_t& options,
0150                                       const parameters_t& start,
0151                                       result_t& nominalResult) const;
0152 
0153   /// @brief This function tests whether the variations on a disc as target
0154   /// surface lead to results on different sides wrt the center of the disc.
0155   /// This would lead to a flip of the phi value on the surface and therewith to
0156   /// a huge variance in that parameter. It can only occur in this algorithm
0157   /// since the ridders algorithm is unaware of the target surface.
0158   ///
0159   /// @param [in] derivatives Derivatives of a single parameter
0160   ///
0161   /// @return Boolean result whether a phi jump occurred
0162   static bool inconsistentDerivativesOnDisc(
0163       const std::vector<BoundVector>& derivatives);
0164 
0165   /// @brief This function wiggles one dimension of the starting parameters,
0166   /// performs the propagation to a surface and collects for each change of the
0167   /// start parameters the slope
0168   ///
0169   /// @tparam options_t PropagatorOptions object
0170   /// @tparam parameters_t Type of the parameters to start the propagation with
0171   ///
0172   /// @param [in] options Options do define how to wiggle
0173   /// @param [in] start Start parameters which will be modified
0174   /// @param [in] param Index to get the parameter that will be modified
0175   /// @param [in] target Target surface
0176   /// @param [in] nominal Nominal end parameters
0177   /// @param [in] deviations Vector of deviations
0178   ///
0179   /// @return Vector containing each slope
0180   template <typename propagator_options_t, typename parameters_t>
0181   std::vector<BoundVector> wiggleParameter(
0182       const propagator_options_t& options, const parameters_t& start,
0183       unsigned int param, const Surface& target, const BoundVector& nominal,
0184       const std::vector<double>& deviations) const;
0185 
0186   /// @brief This function fits the jacobian with the deviations and derivatives as input.
0187   ///
0188   /// @param [in] deviations Vector of deviations
0189   /// @param [in] derivatives Slopes of each modification of the parameters
0190   ///
0191   /// @return Propagated jacobian matrix
0192   static Jacobian calculateJacobian(
0193       const std::vector<double>& deviations,
0194       const std::array<std::vector<BoundVector>, eBoundSize>& derivatives);
0195 
0196   /// @brief This function fits a linear function through the final state
0197   /// parametrisations
0198   ///
0199   /// @param [in] deviations Vector of deviations
0200   /// @param [in] derivatives Vector of resulting derivatives
0201   ///
0202   /// @return Vector containing the linear fit
0203   static BoundVector fitLinear(const std::vector<double>& deviations,
0204                                const std::vector<BoundVector>& derivatives);
0205 
0206   propagator_t m_propagator;
0207   Config m_config;
0208 };
0209 }  // namespace Acts
0210 
0211 #include "Acts/Propagator/RiddersPropagator.ipp"