Skip to content

Commit

Permalink
Backup
Browse files Browse the repository at this point in the history
  • Loading branch information
beomki-yeo committed Nov 23, 2024
1 parent 034eef4 commit e3e3ca0
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions core/include/traccc/fitting/kalman_filter/gain_matrix_smoother.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct gain_matrix_smoother {
///
/// @return true if the update succeeds
template <typename mask_group_t, typename index_t>
TRACCC_HOST_DEVICE inline void operator()(
TRACCC_HOST_DEVICE inline bool operator()(
const mask_group_t& /*mask_group*/, const index_t& /*index*/,
track_state<algebra_t>& cur_state,
const track_state<algebra_t>& next_state) {
Expand All @@ -49,14 +49,16 @@ struct gain_matrix_smoother {
const auto D = cur_state.get_measurement().meas_dim;
assert(D == 1u || D == 2u);
if (D == 1u) {
smoothe<1u, shape_type>(cur_state, next_state);
return smoothe<1u, shape_type>(cur_state, next_state);
} else if (D == 2u) {
smoothe<2u, shape_type>(cur_state, next_state);
return smoothe<2u, shape_type>(cur_state, next_state);
}

return false;
}

template <size_type D, typename shape_t>
TRACCC_HOST_DEVICE inline void smoothe(
TRACCC_HOST_DEVICE inline bool smoothe(
track_state<algebra_t>& cur_state,
const track_state<algebra_t>& next_state) const {
const auto meas = cur_state.get_measurement();
Expand Down Expand Up @@ -107,6 +109,14 @@ struct gain_matrix_smoother {

cur_state.smoothed().set_vector(smt_vec);
cur_state.smoothed().set_covariance(smt_cov);

// Return false if track is parallel to z-axis or phi is not finite
const scalar theta = cur_state.smoothed().theta();
if (theta <= 0.f || theta >= constant<traccc::scalar>::pi ||
!std::isfinite(cur_state.smoothed().phi())) {
return false;
}

// Wrap the phi in the range of [-pi, pi]
wrap_phi(cur_state.smoothed());

Expand Down Expand Up @@ -134,7 +144,7 @@ struct gain_matrix_smoother {

cur_state.smoothed_chi2() = matrix_operator().element(chi2, 0, 0);

return;
return true;
}
};

Expand Down

0 comments on commit e3e3ca0

Please sign in to comment.