From 9b544814e05bc746bc99e3be878a45f02a6289da Mon Sep 17 00:00:00 2001 From: Xiaocong Ai <xiaocong.ai@cern.ch> Date: Thu, 19 Mar 2020 13:47:53 -0700 Subject: [PATCH 1/3] Move the surface material requirement to filter call --- Core/include/Acts/Fitter/KalmanFitter.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Core/include/Acts/Fitter/KalmanFitter.hpp b/Core/include/Acts/Fitter/KalmanFitter.hpp index f3d3e8d41..683d415e1 100644 --- a/Core/include/Acts/Fitter/KalmanFitter.hpp +++ b/Core/include/Acts/Fitter/KalmanFitter.hpp @@ -290,10 +290,9 @@ class KalmanFitter { } // Update: - // - Waiting for a current surface that has material - // -> a trackState will be created on surface with material + // - Waiting for a current surface auto surface = state.navigation.currentSurface; - if (surface and surface->surfaceMaterial()) { + if (surface != nullptr) { // Check if the surface is in the measurement map // -> Get the measurement / calibrate // -> Create the predicted state @@ -546,7 +545,7 @@ class KalmanFitter { } // We count the processed state ++result.processedStates; - } else { + } else if (surface->surfaceMaterial() != nullptr) { if (result.measurementStates > 0) { // No source links on surface, add either hole or passive material // TrackState entry multi trajectory. No storage allocation for @@ -708,7 +707,7 @@ class KalmanFitter { // Update state and stepper with post material effects materialInteractor(surface, state, stepper, postUpdate); } - } else { + } else if (surface->surfaceMaterial() != nullptr) { // Transport covariance if (surface->associatedDetectorElement() != nullptr) { ACTS_VERBOSE("Detected hole on " << surface->geoID() -- GitLab From 96d5cafe43951143df66a87b6024931491397fe4 Mon Sep 17 00:00:00 2001 From: Xiaocong Ai <xiaocong.ai@cern.ch> Date: Thu, 19 Mar 2020 14:01:14 -0700 Subject: [PATCH 2/3] Adapt materialInteractor in KF for no material case --- Core/include/Acts/Fitter/KalmanFitter.hpp | 55 ++++++++++++++--------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/Core/include/Acts/Fitter/KalmanFitter.hpp b/Core/include/Acts/Fitter/KalmanFitter.hpp index 683d415e1..8ecc7471b 100644 --- a/Core/include/Acts/Fitter/KalmanFitter.hpp +++ b/Core/include/Acts/Fitter/KalmanFitter.hpp @@ -747,27 +747,40 @@ class KalmanFitter { void materialInteractor( const Surface* surface, propagator_state_t& state, stepper_t& stepper, const MaterialUpdateStage& updateStage = fullUpdate) const { - // Prepare relevant input particle properties - detail::PointwiseMaterialInteraction interaction(surface, state, stepper); - - // Evaluate the material properties - if (interaction.evaluateMaterialProperties(state, updateStage)) { - // Evaluate the material effects - interaction.evaluatePointwiseMaterialInteraction(multipleScattering, - energyLoss); - - ACTS_VERBOSE("Material effects on surface: " - << surface->geoID() << " at update stage: " << updateStage - << " are :"); - ACTS_VERBOSE("eLoss = " - << interaction.Eloss << ", " - << "variancePhi = " << interaction.variancePhi << ", " - << "varianceTheta = " << interaction.varianceTheta << ", " - << "varianceQoverP = " << interaction.varianceQoverP); - - // Update the state and stepper with material effects - interaction.updateState(state, stepper); - } else { + // Indicator if having material + bool hasMaterial = false; + + if (surface and surface->surfaceMaterial()) { + // Prepare relevant input particle properties + detail::PointwiseMaterialInteraction interaction(surface, state, + stepper); + // Evaluate the material properties + if (interaction.evaluateMaterialProperties(state, updateStage)) { + // Surface has material at this stage + hasMaterial = true; + + // Evaluate the material effects + interaction.evaluatePointwiseMaterialInteraction(multipleScattering, + energyLoss); + + // Screen out material effects info + ACTS_VERBOSE("Material effects on surface: " + << surface->geoID() + << " at update stage: " << updateStage << " are :"); + ACTS_VERBOSE("eLoss = " + << interaction.Eloss << ", " + << "variancePhi = " << interaction.variancePhi << ", " + << "varianceTheta = " << interaction.varianceTheta + << ", " + << "varianceQoverP = " << interaction.varianceQoverP); + + // Update the state and stepper with material effects + interaction.updateState(state, stepper); + } + } + + if (not hasMaterial) { + // Screen out message ACTS_VERBOSE("No material effects on surface: " << surface->geoID() << " at update stage: " << updateStage); -- GitLab From 0abc0fbeb7b19234e5284021be24de03da374ce5 Mon Sep 17 00:00:00 2001 From: Xiaocong Ai <xiaocong.ai@cern.ch> Date: Thu, 19 Mar 2020 14:08:01 -0700 Subject: [PATCH 3/3] Revise the KF error message --- Core/include/Acts/Fitter/KalmanFitter.hpp | 3 ++- Core/include/Acts/Fitter/KalmanFitterError.hpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Core/include/Acts/Fitter/KalmanFitter.hpp b/Core/include/Acts/Fitter/KalmanFitter.hpp index 8ecc7471b..a55fac024 100644 --- a/Core/include/Acts/Fitter/KalmanFitter.hpp +++ b/Core/include/Acts/Fitter/KalmanFitter.hpp @@ -546,6 +546,8 @@ class KalmanFitter { // We count the processed state ++result.processedStates; } else if (surface->surfaceMaterial() != nullptr) { + // We only create track states here if there is already measurement + // detected if (result.measurementStates > 0) { // No source links on surface, add either hole or passive material // TrackState entry multi trajectory. No storage allocation for @@ -991,7 +993,6 @@ class KalmanFitter { /// It could happen that the fit ends in zero processed states. /// The result gets meaningless so such case is regarded as fit failure. - //@TODO: should we require the number of measurments >0 ? if (kalmanResult.result.ok() and not kalmanResult.processedStates) { kalmanResult.result = Result<void>(KalmanFitterError::PropagationInVain); } diff --git a/Core/include/Acts/Fitter/KalmanFitterError.hpp b/Core/include/Acts/Fitter/KalmanFitterError.hpp index 78d599ff0..b7f9ad7a9 100644 --- a/Core/include/Acts/Fitter/KalmanFitterError.hpp +++ b/Core/include/Acts/Fitter/KalmanFitterError.hpp @@ -40,7 +40,7 @@ class KalmanFitterErrorCategory : public std::error_category { case KalmanFitterError::OutputConversionFailed: return "Kalman output conversion failed"; case KalmanFitterError::PropagationInVain: - return "No detector observed during the propagation"; + return "No measurement detected during the propagation"; default: return "unknown"; } -- GitLab