-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add additional error checking in Kálmán filter #886
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,9 +158,8 @@ class kalman_fitter { | |
|
||
if (kalman_fitter_status res = | ||
filter(seed_params_cpy, fitter_state); | ||
res != kalman_fitter_status::SUCCESS) { | ||
return res; | ||
} | ||
res != kalman_fitter_status::SUCCESS) | ||
[[unlikely]] { return res; } | ||
} | ||
|
||
return kalman_fitter_status::SUCCESS; | ||
|
@@ -206,9 +205,11 @@ class kalman_fitter { | |
|
||
// Run smoothing | ||
if (kalman_fitter_status res = smooth(fitter_state); | ||
res != kalman_fitter_status::SUCCESS) { | ||
return res; | ||
} | ||
res != kalman_fitter_status::SUCCESS) | ||
[[unlikely]] { return res; } | ||
|
||
if (fitter_state.m_fit_res.fit_params.theta() == 0.f) | ||
[[unlikely]] { return kalman_fitter_status::ERROR_THETA_ZERO; } | ||
|
||
// Update track fitting qualities | ||
update_statistics(fitter_state); | ||
|
@@ -265,11 +266,12 @@ class kalman_fitter { | |
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; | ||
} | ||
if (dir[0] == 0.f && dir[1] == 0.f) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here: const scalar_type theta = last.smoothed().theta()
if (theta <= 0.f || theta >= constant<traccc::scalar>::pi)
[[unlikely]] { return kalman_fitter_status::ERROR_THETA_ZERO; } |
||
[[unlikely]] { | ||
// 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()); | ||
|
@@ -289,9 +291,8 @@ class kalman_fitter { | |
if (kalman_fitter_status res = | ||
sf.template visit_mask< | ||
gain_matrix_smoother<algebra_type>>(*it, *(it - 1)); | ||
res != kalman_fitter_status::SUCCESS) { | ||
return res; | ||
} | ||
res != kalman_fitter_status::SUCCESS) | ||
[[unlikely]] { return res; } | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** TRACCC library, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2021 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <algebra/concepts.hpp> | ||
#include <algebra/type_traits.hpp> | ||
|
||
#include "traccc/definitions/qualifiers.hpp" | ||
|
||
namespace traccc { | ||
template <::algebra::concepts::matrix T> | ||
TRACCC_HOST_DEVICE bool matrix_is_finite(const T& mat) { | ||
for (std::size_t i = 0; i < ::algebra::traits::columns<T>; ++i) { | ||
for (std::size_t j = 0; j < ::algebra::traits::rows<T>; ++j) { | ||
if (!std::isfinite(getter::element(mat, i, j))) { | ||
return false; | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
} // namespace traccc | ||
// | ||
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,10 @@ TRACCC_HOST_DEVICE inline void fit( | |
// TODO: Process fit failures more elegantly | ||
assert(fit_status == kalman_fitter_status::SUCCESS); | ||
|
||
if (fit_status == kalman_fitter_status::SUCCESS) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here const scalar_type theta = fitter_state.m_fit_res.fit_params.theta()
if (theta <= 0.f || theta >= constant<traccc::scalar>::pi)
[[unlikely]] { return kalman_fitter_status::ERROR_THETA_ZERO; } |
||
assert(fitter_state.m_fit_res.fit_params.theta() != 0.f); | ||
} | ||
|
||
// Get the final fitting information | ||
track_states.at(param_id).header = fitter_state.m_fit_res; | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make errors consistent