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: Optional curvilinear state in Propagator #2444

Merged
merged 5 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 5 additions & 2 deletions Core/include/Acts/Propagator/Propagator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ class Propagator final {
///
/// @param [in] start initial track parameters to propagate
/// @param [in] options Propagation options, type Options<,>
/// @param [in] makeCurvilinear Produce curvilinear parameters at the end of the propagation
///
/// @return Propagation result containing the propagation status, final
/// track parameters, and output of actions (if they produce any)
Expand All @@ -362,8 +363,8 @@ class Propagator final {
Result<
action_list_t_result_t<CurvilinearTrackParameters,
typename propagator_options_t::action_list_type>>
propagate(const parameters_t& start,
const propagator_options_t& options) const;
propagate(const parameters_t& start, const propagator_options_t& options,
bool makeCurvilinear = true) const;

/// @brief Propagate track parameters
///
Expand All @@ -378,6 +379,7 @@ class Propagator final {
///
/// @param [in] start initial track parameters to propagate
/// @param [in] options Propagation options, type Options<,>
/// @param [in] makeCurvilinear Produce curvilinear parameters at the end of the propagation
/// @param [in] inputResult an existing result object to start from
///
/// @return Propagation result containing the propagation status, final
Expand All @@ -390,6 +392,7 @@ class Propagator final {
typename propagator_options_t::action_list_type>>
propagate(
const parameters_t& start, const propagator_options_t& options,
bool makeCurvilinear,
action_list_t_result_t<CurvilinearTrackParameters,
typename propagator_options_t::action_list_type>&&
inputResult) const;
Expand Down
25 changes: 15 additions & 10 deletions Core/include/Acts/Propagator/Propagator.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ auto Acts::Propagator<S, N>::propagate_impl(propagator_state_t& state,
template <typename S, typename N>
template <typename parameters_t, typename propagator_options_t,
typename path_aborter_t>
auto Acts::Propagator<S, N>::propagate(
const parameters_t& start, const propagator_options_t& options) const
auto Acts::Propagator<S, N>::propagate(const parameters_t& start,
const propagator_options_t& options,
bool makeCurvilinear) const
-> Result<action_list_t_result_t<
CurvilinearTrackParameters,
typename propagator_options_t::action_list_type>> {
Expand All @@ -107,14 +108,15 @@ auto Acts::Propagator<S, N>::propagate(
typename propagator_options_t::action_list_type>;

return propagate<parameters_t, propagator_options_t, path_aborter_t>(
start, options, ResultType{});
start, options, makeCurvilinear, ResultType{});
}

template <typename S, typename N>
template <typename parameters_t, typename propagator_options_t,
typename path_aborter_t>
auto Acts::Propagator<S, N>::propagate(
const parameters_t& start, const propagator_options_t& options,
bool makeCurvilinear,
action_list_t_result_t<CurvilinearTrackParameters,
typename propagator_options_t::action_list_type>&&
inputResult) const
Expand Down Expand Up @@ -162,13 +164,16 @@ auto Acts::Propagator<S, N>::propagate(
// Perform the actual propagation & check its outcome
auto result = propagate_impl<ResultType>(state, inputResult);
if (result.ok()) {
/// Convert into return type and fill the result object
auto curvState = m_stepper.curvilinearState(state.stepping);
// Fill the end parameters
inputResult.endParameters = std::get<CurvilinearTrackParameters>(curvState);
// Only fill the transport jacobian when covariance transport was done
if (state.stepping.covTransport) {
inputResult.transportJacobian = std::get<Jacobian>(curvState);
if (makeCurvilinear) {
/// Convert into return type and fill the result object
auto curvState = m_stepper.curvilinearState(state.stepping);
// Fill the end parameters
inputResult.endParameters =
std::get<CurvilinearTrackParameters>(curvState);
// Only fill the transport jacobian when covariance transport was done
if (state.stepping.covTransport) {
inputResult.transportJacobian = std::get<Jacobian>(curvState);
}
}
return Result<ResultType>::success(std::forward<ResultType>(inputResult));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ class CombinatorialKalmanFilter {
r.stateBuffer->clear();

auto result = m_propagator.template propagate(
initialParameters, propOptions, std::move(inputResult));
initialParameters, propOptions, false, std::move(inputResult));

if (!result.ok()) {
ACTS_ERROR("Propapation failed: " << result.error() << " "
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/TrackFitting/GaussianSumFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ struct GaussianSumFitter {
sParameters.referenceSurface().getSharedPtr(),
sParameters.parameters(), sParameters.covariance());

return m_propagator.propagate(params, fwdPropOptions,
return m_propagator.propagate(params, fwdPropOptions, false,
std::move(inputResult));
} else {
return m_propagator.propagate(sParameters, fwdPropOptions,
return m_propagator.propagate(sParameters, fwdPropOptions, false,
std::move(inputResult));
}
}();
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,8 @@ class Gx2Fitter {

r.fittedStates = &trackContainer.trackStateContainer();
// propagate with params and return jacobians and residuals
auto result = m_propagator.template propagate(params, propagatorOptions,
std::move(inputResult));
auto result = m_propagator.template propagate(
params, propagatorOptions, true, std::move(inputResult));

// TODO Improve Propagator + Actor [allocate before loop], rewrite
// makeMeasurements
Expand Down
8 changes: 4 additions & 4 deletions Core/include/Acts/TrackFitting/KalmanFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,8 +1093,8 @@ class KalmanFitter {
r.fittedStates = &trackContainer.trackStateContainer();

// Run the fitter
auto result = m_propagator.template propagate(sParameters, kalmanOptions,
std::move(inputResult));
auto result = m_propagator.template propagate(
sParameters, kalmanOptions, false, std::move(inputResult));

if (!result.ok()) {
ACTS_ERROR("Propapation failed: " << result.error());
Expand Down Expand Up @@ -1232,8 +1232,8 @@ class KalmanFitter {
r.fittedStates = &trackContainer.trackStateContainer();

// Run the fitter
auto result = m_propagator.template propagate(sParameters, kalmanOptions,
std::move(inputResult));
auto result = m_propagator.template propagate(
sParameters, kalmanOptions, false, std::move(inputResult));

if (!result.ok()) {
ACTS_ERROR("Propapation failed: " << result.error());
Expand Down
Loading