Skip to content

Commit

Permalink
Exit with an error if the first smoothed state is invalid (#882)
Browse files Browse the repository at this point in the history
* Exit with an error if the first smoothed state is invalid

* Fix a bug

---------

Co-authored-by: Stephen Nicholas Swatman <[email protected]>
  • Loading branch information
beomki-yeo and stephenswat authored Feb 22, 2025
1 parent 965c158 commit a839774
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions core/include/traccc/fitting/kalman_filter/kalman_fitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,16 @@ class kalman_fitter {
// return false;
}
auto& last = *fitter_state.m_fit_actor_state.m_it_rev;

const scalar theta = last.filtered().theta();
if (theta <= 0.f || theta >= constant<traccc::scalar>::pi) {
return kalman_fitter_status::ERROR_THETA_ZERO;
}

if (!std::isfinite(last.filtered().phi())) {
return kalman_fitter_status::ERROR_INVERSION;
}

last.smoothed().set_parameter_vector(last.filtered());
last.smoothed().set_covariance(last.filtered().covariance());
last.smoothed_chi2() = last.filtered_chi2();
Expand Down Expand Up @@ -277,13 +287,6 @@ class kalman_fitter {
detray::navigation::direction::e_backward);
fitter_state.m_fit_actor_state.backward_mode = true;

const auto& dir = propagation._stepping().dir();
if (dir[0] == 0.f && dir[1] == 0.f) {
// Particle is exactly parallel to the beampipe, which we
// cannot represent.
return kalman_fitter_status::ERROR_THETA_ZERO;
}

propagator.propagate(propagation,
fitter_state.backward_actor_state());

Expand Down

0 comments on commit a839774

Please sign in to comment.