From 8e3e1565f7a3cdda615ee8d409c1f6f4e574ab51 Mon Sep 17 00:00:00 2001 From: xai <xiaocong.ai@cern.ch> Date: Fri, 13 Dec 2019 09:05:20 +0800 Subject: [PATCH] Add a new type of KalmanFitterError: no states created at all --- Core/include/Acts/Fitter/KalmanFitter.hpp | 12 ++++++++++++ Core/include/Acts/Fitter/KalmanFitterError.hpp | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Core/include/Acts/Fitter/KalmanFitter.hpp b/Core/include/Acts/Fitter/KalmanFitter.hpp index bc54910ac..d3e601c7f 100644 --- a/Core/include/Acts/Fitter/KalmanFitter.hpp +++ b/Core/include/Acts/Fitter/KalmanFitter.hpp @@ -653,6 +653,12 @@ class KalmanFitter { /// Get the result of the fit auto kalmanResult = propRes.template get<KalmanResult>(); + /// It could happen that the fit ends in zero processed states. + /// The result gets meaningless so such case is regarded as fit failure. + if (kalmanResult.result.ok() and not kalmanResult.processedStates) { + kalmanResult.result = Result<void>(KalmanFitterError::PropagationInVain); + } + if (!kalmanResult.result.ok()) { return kalmanResult.result.error(); } @@ -736,6 +742,12 @@ class KalmanFitter { /// Get the result of the fit auto kalmanResult = propRes.template get<KalmanResult>(); + /// It could happen that the fit ends in zero processed states. + /// The result gets meaningless so such case is regarded as fit failure. + if (kalmanResult.result.ok() and not kalmanResult.processedStates) { + kalmanResult.result = Result<void>(KalmanFitterError::PropagationInVain); + } + if (!kalmanResult.result.ok()) { return kalmanResult.result.error(); } diff --git a/Core/include/Acts/Fitter/KalmanFitterError.hpp b/Core/include/Acts/Fitter/KalmanFitterError.hpp index 997936357..56be3facb 100644 --- a/Core/include/Acts/Fitter/KalmanFitterError.hpp +++ b/Core/include/Acts/Fitter/KalmanFitterError.hpp @@ -17,7 +17,8 @@ namespace Acts { enum class KalmanFitterError { UpdateFailed = 1, SmoothFailed = 2, - OutputConversionFailed = 3 + OutputConversionFailed = 3, + PropagationInVain = 4 }; namespace detail { @@ -35,6 +36,8 @@ class KalmanFitterErrorCategory : public std::error_category { return "Kalman smooth failed"; case KalmanFitterError::OutputConversionFailed: return "Kalman output conversion failed"; + case KalmanFitterError::PropagationInVain: + return "No detector observed during the propagation"; default: return "unknown"; } -- GitLab