Skip to content

Commit

Permalink
fix: DirectNavigator causes incorrect propagation finalization (#2913)
Browse files Browse the repository at this point in the history
This is observed to break the KalmanFitter if run with the direct
navigator, at least in some cases. To be followed up with a more robust
solution.
  • Loading branch information
paulgessinger authored Jan 31, 2024
1 parent daeea07 commit 318b50d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Core/include/Acts/TrackFitting/KalmanFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,17 @@ class KalmanFitter {
// Reset navigation state
// We do not need to specify a target here since this will be handled
// separately in the KF actor
state.navigation = navigator.makeState(&st.referenceSurface(), nullptr);
auto newState = navigator.makeState(&st.referenceSurface(), nullptr);

if constexpr (isDirectNavigator) {
// reinitialize navigation surfaces
newState.navSurfaces = state.navigation.navSurfaces;
newState.navSurfaceIter =
std::find(newState.navSurfaces.begin(), newState.navSurfaces.end(),
&st.referenceSurface());
}

state.navigation = std::move(newState);
navigator.initialize(state, stepper);

// Update material effects for last measurement state in reversed
Expand Down Expand Up @@ -1039,7 +1049,16 @@ class KalmanFitter {
// Reset the navigation state to enable propagation towards the target
// surface
// Set targetSurface to nullptr as it is handled manually in the actor
state.navigation = navigator.makeState(&surface, nullptr);
auto newState = navigator.makeState(&surface, nullptr);

if constexpr (isDirectNavigator) {
// reinitialize navigation surfaces
newState.navSurfaces = state.navigation.navSurfaces;
newState.navSurfaceIter = std::find(
newState.navSurfaces.begin(), newState.navSurfaces.end(), &surface);
}

state.navigation = std::move(newState);
navigator.initialize(state, stepper);

return Result<void>::success();
Expand Down

0 comments on commit 318b50d

Please sign in to comment.