From dbd469a0cba314639282d879d08161ba3d4a411e Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sat, 14 Dec 2024 10:38:09 +0100 Subject: [PATCH 1/3] refactor: Combine GSF actor and aborter --- .../Acts/TrackFitting/GaussianSumFitter.hpp | 19 ++----------------- .../Acts/TrackFitting/detail/GsfActor.hpp | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 23 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..11794e25437 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 materialSlab( - old_bound.position(state.stepping.geoContext), state.options.direction, + old_bound.position(state.options.geoContext), state.options.direction, MaterialUpdateStage::FullUpdate); const auto pathCorrection = surface.pathCorrection( - state.stepping.geoContext, - old_bound.position(state.stepping.geoContext), old_bound.direction()); + state.options.geoContext, old_bound.position(state.options.geoContext), + old_bound.direction()); slab.scaleThickness(pathCorrection); const double pathXOverX0 = slab.thicknessInX0(); @@ -525,7 +532,7 @@ struct GsfActor { auto& cmp = *res; auto freeParams = cmp.pars(); cmp.jacToGlobal() = surface.boundToFreeJacobian( - state.geoContext, freeParams.template segment<3>(eFreePos0), + state.options.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); cmp.pathAccumulated() = state.stepping.pathAccumulated; cmp.jacobian() = BoundMatrix::Identity(); From 3c898ca4edc6b90e08eff8c3afb64f4fd456ecb6 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sun, 15 Dec 2024 10:49:13 +0100 Subject: [PATCH 2/3] revert gctx changes --- Core/include/Acts/TrackFitting/detail/GsfActor.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp index 11794e25437..41a83505289 100644 --- a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp +++ b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp @@ -372,12 +372,12 @@ struct GsfActor { // Evaluate material slab auto slab = surface.surfaceMaterial()->materialSlab( - old_bound.position(state.options.geoContext), state.options.direction, + old_bound.position(state.stepping.geoContext), state.options.direction, MaterialUpdateStage::FullUpdate); const auto pathCorrection = surface.pathCorrection( - state.options.geoContext, old_bound.position(state.options.geoContext), - old_bound.direction()); + state.stepping.geoContext, + old_bound.position(state.stepping.geoContext), old_bound.direction()); slab.scaleThickness(pathCorrection); const double pathXOverX0 = slab.thicknessInX0(); @@ -532,7 +532,7 @@ struct GsfActor { auto& cmp = *res; auto freeParams = cmp.pars(); cmp.jacToGlobal() = surface.boundToFreeJacobian( - state.options.geoContext, freeParams.template segment<3>(eFreePos0), + state.stepping.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); cmp.pathAccumulated() = state.stepping.pathAccumulated; cmp.jacobian() = BoundMatrix::Identity(); From 99c980651f301731c3a32d41b7ec02ade41ac9e5 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Mon, 16 Dec 2024 09:41:16 +0100 Subject: [PATCH 3/3] revert another residual gctx change --- Core/include/Acts/TrackFitting/detail/GsfActor.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp index 41a83505289..3c5d602acdb 100644 --- a/Core/include/Acts/TrackFitting/detail/GsfActor.hpp +++ b/Core/include/Acts/TrackFitting/detail/GsfActor.hpp @@ -532,7 +532,7 @@ struct GsfActor { auto& cmp = *res; auto freeParams = cmp.pars(); cmp.jacToGlobal() = surface.boundToFreeJacobian( - state.stepping.geoContext, freeParams.template segment<3>(eFreePos0), + state.geoContext, freeParams.template segment<3>(eFreePos0), freeParams.template segment<3>(eFreeDir0)); cmp.pathAccumulated() = state.stepping.pathAccumulated; cmp.jacobian() = BoundMatrix::Identity();