Skip to content

Commit

Permalink
Abort the KF if all track candidates are visited
Browse files Browse the repository at this point in the history
  • Loading branch information
beomki-yeo committed Nov 26, 2024
1 parent acec9af commit 2138829
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions core/include/traccc/fitting/kalman_filter/kalman_actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ struct kalman_actor : detray::actor {
TRACCC_HOST_DEVICE
void next() { m_it++; }

/// @return true if the iterator reaches the end of vector
TRACCC_HOST_DEVICE
bool is_complete() const {
if (m_it == m_track_states.end()) {
return true;
}
return false;
}

// vector of track states
vector_t<track_state_type> m_track_states;

Expand All @@ -76,6 +85,12 @@ struct kalman_actor : detray::actor {
auto& stepping = propagation._stepping;
auto& navigation = propagation._navigation;

// If the iterator reaches the end, terminate the propagation
if (actor_state.is_complete()) {
propagation._heartbeat &= navigation.abort();
return;
}

// triggered only for sensitive surfaces
if (navigation.is_on_sensitive()) {

Expand Down
4 changes: 3 additions & 1 deletion tests/cpu/test_kalman_fitter_hole_count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ TEST_P(KalmanFittingHoleCountTests, Run) {
ASSERT_EQ(n_tracks, n_truth_tracks);

// Check the number of holes
// The three holes at the end are not counted as KF aborts once it goes
// through all track candidates
const auto& fit_res = track_states.at(0u).header;
ASSERT_EQ(fit_res.n_holes, 8u);
ASSERT_EQ(fit_res.n_holes, 5u);

// Some sanity checks
ASSERT_EQ(track_states.at(0u).items.size(), n_planes - fit_res.n_holes);
Expand Down

0 comments on commit 2138829

Please sign in to comment.