From 7449f3803efebe2c13b604f7639904dc0bb8b846 Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Wed, 13 Sep 2023 18:18:19 +0200 Subject: [PATCH 1/3] refactor: Optional curvilinear state in Propagator So far, without a target surface, the propagator unconditionally produces curvilinear parameters, and allocates a plane surface for this. This adds an argument, which if set to false tells the Propagator not to do that. In particular, we don't use this curvilinear state at all in the CKF and KF (I'm not sure about the GSF). --- Core/include/Acts/Propagator/Propagator.hpp | 7 ++++-- Core/include/Acts/Propagator/Propagator.ipp | 25 +++++++++++-------- .../CombinatorialKalmanFilter.hpp | 2 +- .../Acts/TrackFitting/GaussianSumFitter.hpp | 4 +-- .../Acts/TrackFitting/KalmanFitter.hpp | 8 +++--- 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Core/include/Acts/Propagator/Propagator.hpp b/Core/include/Acts/Propagator/Propagator.hpp index 147f04892c0..f101af7ba7e 100644 --- a/Core/include/Acts/Propagator/Propagator.hpp +++ b/Core/include/Acts/Propagator/Propagator.hpp @@ -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) @@ -362,8 +363,8 @@ class Propagator final { Result< action_list_t_result_t> - 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 /// @@ -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 @@ -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&& inputResult) const; diff --git a/Core/include/Acts/Propagator/Propagator.ipp b/Core/include/Acts/Propagator/Propagator.ipp index 718d03dcc96..6562dfbe20d 100644 --- a/Core/include/Acts/Propagator/Propagator.ipp +++ b/Core/include/Acts/Propagator/Propagator.ipp @@ -90,8 +90,9 @@ auto Acts::Propagator::propagate_impl(propagator_state_t& state, template template -auto Acts::Propagator::propagate( - const parameters_t& start, const propagator_options_t& options) const +auto Acts::Propagator::propagate(const parameters_t& start, + const propagator_options_t& options, + bool makeCurvilinear) const -> Result> { @@ -107,7 +108,7 @@ auto Acts::Propagator::propagate( typename propagator_options_t::action_list_type>; return propagate( - start, options, ResultType{}); + start, options, makeCurvilinear, ResultType{}); } template @@ -115,6 +116,7 @@ template auto Acts::Propagator::propagate( const parameters_t& start, const propagator_options_t& options, + bool makeCurvilinear, action_list_t_result_t&& inputResult) const @@ -162,13 +164,16 @@ auto Acts::Propagator::propagate( // Perform the actual propagation & check its outcome auto result = propagate_impl(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(curvState); - // Only fill the transport jacobian when covariance transport was done - if (state.stepping.covTransport) { - inputResult.transportJacobian = std::get(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(curvState); + // Only fill the transport jacobian when covariance transport was done + if (state.stepping.covTransport) { + inputResult.transportJacobian = std::get(curvState); + } } return Result::success(std::forward(inputResult)); } else { diff --git a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp index 14cd9e37304..b77cf2a6ac9 100644 --- a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp +++ b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp @@ -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() << " " diff --git a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp index 8e905a32167..88c52876239 100644 --- a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp +++ b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp @@ -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, true, std::move(inputResult)); } else { - return m_propagator.propagate(sParameters, fwdPropOptions, + return m_propagator.propagate(sParameters, fwdPropOptions, true, std::move(inputResult)); } }(); diff --git a/Core/include/Acts/TrackFitting/KalmanFitter.hpp b/Core/include/Acts/TrackFitting/KalmanFitter.hpp index 8a587a24c62..3bdde9b924c 100644 --- a/Core/include/Acts/TrackFitting/KalmanFitter.hpp +++ b/Core/include/Acts/TrackFitting/KalmanFitter.hpp @@ -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()); @@ -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()); From ee5133773a2ff572fd1e4f1ade24c102f28fbcb3 Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Thu, 14 Sep 2023 15:33:22 +0200 Subject: [PATCH 2/3] fix GX2F call case --- Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp b/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp index 15c194f55cb..7119319d80d 100644 --- a/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp +++ b/Core/include/Acts/TrackFitting/GlobalChiSquareFitter.hpp @@ -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 From ac7510f036dcfe9044e280a9423ef6f87abd5b1a Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Thu, 14 Sep 2023 15:34:13 +0200 Subject: [PATCH 3/3] don't make curvilinear state in GSF --- Core/include/Acts/TrackFitting/GaussianSumFitter.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp index 88c52876239..e2072981625 100644 --- a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp +++ b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp @@ -289,10 +289,10 @@ struct GaussianSumFitter { sParameters.referenceSurface().getSharedPtr(), sParameters.parameters(), sParameters.covariance()); - return m_propagator.propagate(params, fwdPropOptions, true, + return m_propagator.propagate(params, fwdPropOptions, false, std::move(inputResult)); } else { - return m_propagator.propagate(sParameters, fwdPropOptions, true, + return m_propagator.propagate(sParameters, fwdPropOptions, false, std::move(inputResult)); } }();