From 1960d7a6b305a19cdab9fa69b0de67cf7166d547 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Mon, 16 Dec 2024 11:03:36 +0100 Subject: [PATCH] refactor: Combine GSF actor and aborter (#3984) Currently the GSF actor communicates the abort flag via the navigation break which is not ideal. I want to remove setting this flag from outside in https://github.com/acts-project/acts/pull/3449. The GSF can carry this flag by itself and after the actor+aborter refactor we do not need a separate aborter anymore. pulled out of https://github.com/acts-project/acts/pull/3449 ## Summary by CodeRabbit - **New Features** - Introduced a new method to check if navigation should be aborted based on processed measurements. - **Improvements** - Updated navigation handling in the fitting process by removing the `NavigationBreakAborter` struct. - Refined geo context management in multiple methods for better clarity and consistency. --- .../Acts/TrackFitting/GaussianSumFitter.hpp | 19 ++----------------- .../Acts/TrackFitting/detail/GsfActor.hpp | 11 +++++++++-- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp index 4efcd82e4c4..fcada49abc2 100644 --- a/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp +++ b/Core/include/Acts/TrackFitting/GaussianSumFitter.hpp @@ -77,20 +77,6 @@ struct GaussianSumFitter { /// The actor type using GsfActor = detail::GsfActor; - /// This allows to break the propagation by setting the navigationBreak - /// TODO refactor once we can do this more elegantly - struct NavigationBreakAborter { - NavigationBreakAborter() = default; - - template - bool checkAbort(propagator_state_t& state, const stepper_t& /*stepper*/, - const navigator_t& navigator, - const Logger& /*logger*/) const { - return navigator.navigationBreak(state.navigation); - } - }; - /// @brief The fit function for the Direct navigator template @@ -105,7 +91,7 @@ struct GaussianSumFitter { // Initialize the forward propagation with the DirectNavigator auto fwdPropInitializer = [&sSequence, this](const auto& opts) { - using Actors = ActorList; + using Actors = ActorList; using PropagatorOptions = typename propagator_t::template Options; PropagatorOptions propOptions(opts.geoContext, opts.magFieldContext); @@ -151,8 +137,7 @@ struct GaussianSumFitter { // Initialize the forward propagation with the DirectNavigator auto fwdPropInitializer = [this](const auto& opts) { - using Actors = - ActorList; + using Actors = ActorList; using PropagatorOptions = typename propagator_t::template Options; PropagatorOptions propOptions(opts.geoContext, opts.magFieldContext); diff --git a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp index 6d5ac68d8b9..3c5d602acdb 100644 --- a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp +++ b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp @@ -317,13 +317,20 @@ struct GsfActor { applyMultipleScattering(state, stepper, navigator, MaterialUpdateStage::PostUpdate); } + } - // Break the navigation if we found all measurements + template + bool checkAbort(propagator_state_t& /*state*/, const stepper_t& /*stepper*/, + const navigator_t& /*navigator*/, const result_type& result, + const Logger& /*logger*/) const { if (m_cfg.numberMeasurements && result.measurementStates == m_cfg.numberMeasurements) { ACTS_VERBOSE("Stop navigation because all measurements are found"); - navigator.navigationBreak(state.navigation, true); + return true; } + + return false; } template