Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Reuse JacobianEngine #2789

Merged
merged 16 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 0 additions & 120 deletions Core/include/Acts/Propagator/CovarianceTransport.hpp

This file was deleted.

12 changes: 6 additions & 6 deletions Core/include/Acts/Propagator/EigenStepper.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ auto Acts::EigenStepper<E, A>::boundState(
const FreeToBoundCorrection& freeToBoundCorrection) const
-> Result<BoundState> {
return detail::boundState(
state.geoContext, state.cov, state.jacobian, state.jacTransport,
state.geoContext, surface, state.cov, state.jacobian, state.jacTransport,
state.derivative, state.jacToGlobal, state.pars, state.particleHypothesis,
state.covTransport && transportCov, state.pathAccumulated, surface,
state.covTransport && transportCov, state.pathAccumulated,
freeToBoundCorrection);
}

Expand Down Expand Up @@ -101,10 +101,10 @@ template <typename E, typename A>
void Acts::EigenStepper<E, A>::transportCovarianceToBound(
State& state, const Surface& surface,
const FreeToBoundCorrection& freeToBoundCorrection) const {
detail::transportCovarianceToBound(
state.geoContext.get(), state.cov, state.jacobian, state.jacTransport,
state.derivative, state.jacToGlobal, state.pars, surface,
freeToBoundCorrection);
detail::transportCovarianceToBound(state.geoContext.get(), surface, state.cov,
state.jacobian, state.jacTransport,
state.derivative, state.jacToGlobal,
state.pars, freeToBoundCorrection);
}

template <typename E, typename A>
Expand Down
90 changes: 43 additions & 47 deletions Core/include/Acts/Propagator/detail/CovarianceEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,116 +19,112 @@
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/Result.hpp"

#include <cmath>
#include <functional>
#include <tuple>
#include <variant>

namespace Acts {
namespace detail {

/// @brief These functions perform the transport of a covariance matrix using
/// given Jacobians. The required data is provided by the stepper object
/// with some additional data. Since this is a purely algebraic problem the
/// calculations are identical for @c StraightLineStepper and @c EigenStepper.
/// As a consequence the methods can be located in a separate file.
namespace detail {

/// Create and return the bound state at the current position
///
/// @brief It does not check if the transported state is at the surface, this
/// needs to be guaranteed by the propagator
/// needs to be guaranteed by the propagator
///
/// @param [in] geoContext The geometry context
/// @param [in, out] covarianceMatrix The covariance matrix of the state
/// @param [in, out] jacobian Full jacobian since the last reset
/// @param [in, out] transportJacobian Global jacobian since the last reset
/// @param [in, out] derivatives Path length derivatives of the free, nominal
/// parameters
/// @param [in, out] jacToGlobal Projection jacobian of the last bound
/// parametrisation to free parameters
/// @param [in, out] parameters Free, nominal parametrisation
/// @param [in, out] boundCovariance The covariance matrix of the state
/// @param [in, out] fullTransportJacobian Full jacobian since the last reset
/// @param [in, out] freeTransportJacobian Global jacobian since the last reset
/// @param [in, out] freeToPathDerivatives Path length derivatives of the free,
/// nominal parameters
/// @param [in, out] boundToFreeJacobian Projection jacobian of the last bound
/// parametrisation to free parameters
/// @param [in, out] freeParameters Free, nominal parametrisation
/// @param [in] particleHypothesis Particle hypothesis
/// @param [in] covTransport Decision whether the covariance transport should be
/// performed
/// performed
/// @param [in] accumulatedPath Propagated distance
/// @param [in] surface Target surface on which the state is represented
/// @param [in] freeToBoundCorrection Correction for non-linearity effect during transform from free to bound
/// @param [in] freeToBoundCorrection Correction for non-linearity effect during
/// transform from free to bound
///
/// @return A bound state:
/// - the parameters at the surface
/// - the stepwise jacobian towards it (from last bound)
/// - and the path length (from start - for ordering)
Result<std::tuple<BoundTrackParameters, BoundMatrix, double>> boundState(
const GeometryContext& geoContext, BoundSquareMatrix& covarianceMatrix,
BoundMatrix& jacobian, FreeMatrix& transportJacobian,
FreeVector& derivatives, BoundToFreeMatrix& jacToGlobal,
FreeVector& parameters, const ParticleHypothesis& particleHypothesis,
bool covTransport, double accumulatedPath, const Surface& surface,
const FreeToBoundCorrection& freeToBoundCorrection =
FreeToBoundCorrection(false));
const GeometryContext& geoContext, const Surface& surface,
BoundSquareMatrix& boundCovariance, BoundMatrix& fullTransportJacobian,
FreeMatrix& freeTransportJacobian, FreeVector& freeToPathDerivatives,
BoundToFreeMatrix& boundToFreeJacobian, FreeVector& freeParameters,
const ParticleHypothesis& particleHypothesis, bool covTransport,
double accumulatedPath, const FreeToBoundCorrection& freeToBoundCorrection);

/// Create and return a curvilinear state at the current position
///
/// @brief This creates a curvilinear state.
///
/// @param [in, out] covarianceMatrix The covariance matrix of the state
/// @param [in, out] jacobian Full jacobian since the last reset
/// @param [in, out] transportJacobian Global jacobian since the last reset
/// @param [in, out] derivatives Path length derivatives of the free, nominal
/// parameters
/// @param [in, out] jacToGlobal Projection jacobian of the last bound
/// parametrisation to free parameters
/// @param [in] parameters Free, nominal parametrisation
/// @param [in, out] boundCovariance The covariance matrix of the state
/// @param [in, out] fullTransportJacobian Full jacobian since the last reset
/// @param [in, out] freeTransportJacobian Global jacobian since the last reset
/// @param [in, out] freeToPathDerivatives Path length derivatives of the free,
/// nominal parameters
/// @param [in, out] boundToFreeJacobian Projection jacobian of the last bound
/// parametrisation to free parameters
/// @param [in] freeParameters Free, nominal parametrisation
/// @param [in] particleHypothesis Particle hypothesis
/// @param [in] covTransport Decision whether the covariance transport should be
/// performed
/// performed
/// @param [in] accumulatedPath Propagated distance
///
/// @return A curvilinear state:
/// - the curvilinear parameters at given position
/// - the stepweise jacobian towards it (from last bound)
/// - and the path length (from start - for ordering)
std::tuple<CurvilinearTrackParameters, BoundMatrix, double> curvilinearState(
BoundSquareMatrix& covarianceMatrix, BoundMatrix& jacobian,
FreeMatrix& transportJacobian, FreeVector& derivatives,
BoundToFreeMatrix& jacToGlobal, const FreeVector& parameters,
BoundSquareMatrix& boundCovariance, BoundMatrix& fullTransportJacobian,
FreeMatrix& transportJacobian, FreeVector& freeToPathDerivatives,
BoundToFreeMatrix& boundToFreeJacobian, const FreeVector& freeParameters,
const ParticleHypothesis& particleHypothesis, bool covTransport,
double accumulatedPath);

/// @brief Method for on-demand covariance transport of a bound/curvilinear to
/// another bound representation.
/// another bound representation.
///
/// @param [in] geoContext The geometry context
/// @param [in] surface is the surface to which the covariance is forwarded to
/// @param [in, out] boundCovariance The covariance matrix of the state
/// @param [in, out] fullTransportJacobian Full jacobian since the last reset
/// @param [in, out] freeTransportJacobian Global jacobian since the last reset
/// @param [in, out] freeToPathDerivatives Path length derivatives
/// @param [in, out] boundToFreeJacobian Projection jacobian of the last bound
/// parametrisation to free parameters
/// parametrisation to free parameters
/// @param [in, out] freeParameters Free, nominal parametrisation
/// @param [in] surface is the surface to which the covariance is
/// forwarded to
/// @param [in] freeToBoundCorrection Correction for non-linearity effect during transform from free to bound
/// @param [in] freeToBoundCorrection Correction for non-linearity effect during
/// transform from free to bound
///
/// @note No check is done if the position is actually on the surface
///
void transportCovarianceToBound(
const GeometryContext& geoContext, BoundSquareMatrix& boundCovariance,
BoundMatrix& fullTransportJacobian, FreeMatrix& freeTransportJacobian,
FreeVector& freeToPathDerivatives, BoundToFreeMatrix& boundToFreeJacobian,
FreeVector& freeParameters, const Surface& surface,
const FreeToBoundCorrection& freeToBoundCorrection =
FreeToBoundCorrection(false));
const GeometryContext& geoContext, const Surface& surface,
BoundSquareMatrix& boundCovariance, BoundMatrix& fullTransportJacobian,
FreeMatrix& freeTransportJacobian, FreeVector& freeToPathDerivatives,
BoundToFreeMatrix& boundToFreeJacobian, FreeVector& freeParameters,
const FreeToBoundCorrection& freeToBoundCorrection);

/// @brief Method for on-demand covariance transport of a bound/curvilinear
/// to a new curvilinear representation.
/// to a new curvilinear representation.
///
/// @param [in, out] boundCovariance The covariance matrix of the state
/// @param [in, out] fullTransportJacobian Full jacobian since the last reset
/// @param [in, out] freeTransportJacobian Global jacobian since the last reset
/// @param [in, out] freeToPathDerivatives Path length derivatives
/// @param [in, out] boundToFreeJacobian Projection jacobian of the last bound
/// parametrisation to free parameters
/// parametrisation to free parameters
/// @param [in] direction Normalised direction vector
///
void transportCovarianceToCurvilinear(BoundSquareMatrix& boundCovariance,
Expand Down
Loading
Loading