From ee96979c829a44f40dd2396164f4e6fe3e704b53 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Thu, 28 Mar 2024 17:48:10 +0100 Subject: [PATCH] debugging --- Core/include/Acts/EventData/TrackStateType.hpp | 12 ++++++++++++ .../Acts/TrackFinding/CombinatorialKalmanFilter.hpp | 2 +- Core/src/TrackFitting/GainMatrixSmoother.cpp | 12 ++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Core/include/Acts/EventData/TrackStateType.hpp b/Core/include/Acts/EventData/TrackStateType.hpp index 055354e2259..5e43d6cb20c 100644 --- a/Core/include/Acts/EventData/TrackStateType.hpp +++ b/Core/include/Acts/EventData/TrackStateType.hpp @@ -83,6 +83,18 @@ class TrackStateType { /// @param pos the position of the bit to change void reset(std::size_t pos) { set(pos, false); } + friend std::ostream& operator<<(std::ostream& os, TrackStateType t) { + assert(t.m_raw != nullptr); + std::bitset bs{*t.m_raw}; + std::bitset trunc; + for (std::size_t i = 0; i < TrackStateFlag::NumTrackStateFlags; i++) { + trunc[i] = bs[i]; + } + // SharedhitMaterialHoleOutlierParameterMeasurement + os << "SMHOPM=" << trunc; + return os; + } + private: raw_type* m_raw{nullptr}; }; diff --git a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp index 0887eb3a197..270a8480e50 100644 --- a/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp +++ b/Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp @@ -1206,7 +1206,7 @@ class CombinatorialKalmanFilter { std::vector tracks; for (auto tip : combKalmanResult.lastMeasurementIndices) { - auto track = trackContainer.getTrack(trackContainer.addTrack()); + auto track = trackContainer.makeTrack(); track.tipIndex() = tip; // Set fitted track parameters if available. This will only be the case if diff --git a/Core/src/TrackFitting/GainMatrixSmoother.cpp b/Core/src/TrackFitting/GainMatrixSmoother.cpp index d41169a79dc..36a397c3c27 100644 --- a/Core/src/TrackFitting/GainMatrixSmoother.cpp +++ b/Core/src/TrackFitting/GainMatrixSmoother.cpp @@ -35,8 +35,16 @@ Result GainMatrixSmoother::calculate( predictedCovariance(prev_ts).inverse(); if (G.hasNaN()) { - // error = KalmanFitterError::SmoothFailed; // set to error - // return false; // abort execution + // ACTS_ERROR("Gain smoothing matrix G has NaNs"); + + // ACTS_ERROR("Filtered covariance:\n" << filteredCovariance(ts)); + // ACTS_ERROR("Jacobian:\n" << jacobian(prev_ts)); + // ACTS_ERROR("Predicted covariance:\n" << predictedCovariance(prev_ts)); + // ACTS_ERROR("Inverse of predicted covariance:\n" + // << predictedCovariance(prev_ts).inverse()); + + // ACTS_ERROR("Gain smoothing matrix G:\n" << G); + return KalmanFitterError::SmoothFailed; }