Skip to content

Commit

Permalink
fix: Allow CKF smoothing without a target surface (#2317)
Browse files Browse the repository at this point in the history
The current CKF implementation does not allow for smoothing without setting a target surface as this would result in a null pointer dereference. I try to fix that by handling the special case of not having a target surface.
  • Loading branch information
andiwand authored Jul 26, 2023
1 parent 5252d07 commit 9cdf2fe
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,26 +497,32 @@ class CombinatorialKalmanFilter {
}
result.smoothed = true;
}

// -> then progress to target/reference surface and built the final
// track parameters for found track indexed with iSmoothed
if (result.smoothed and targetReached(state, stepper, navigator,
*targetSurface, logger())) {
if (result.smoothed and (targetSurface == nullptr or
targetReached(state, stepper, navigator,
*targetSurface, logger()))) {
ACTS_VERBOSE(
"Completing the track with last measurement index = "
<< result.lastMeasurementIndices.at(result.iSmoothed));
// Transport & bind the parameter to the final surface
auto res = stepper.boundState(state.stepping, *targetSurface);
if (!res.ok()) {
ACTS_ERROR("Error in finalize: " << res.error());
result.result = res.error();
return;

if (targetSurface != nullptr) {
// Transport & bind the parameter to the final surface
auto res = stepper.boundState(state.stepping, *targetSurface);
if (!res.ok()) {
ACTS_ERROR("Error in finalize: " << res.error());
result.result = res.error();
return;
}

auto fittedState = *res;
// Assign the fitted parameters
result.fittedParameters.emplace(
result.lastMeasurementIndices.at(result.iSmoothed),
std::get<BoundTrackParameters>(fittedState));
}

auto fittedState = *res;
// Assign the fitted parameters
result.fittedParameters.emplace(
result.lastMeasurementIndices.at(result.iSmoothed),
std::get<BoundTrackParameters>(fittedState));
// If there are more trajectories to handle:
// -> set the targetReached status to false
// -> set the smoothed status to false
Expand Down

0 comments on commit 9cdf2fe

Please sign in to comment.