diff --git a/Event/EventPrimitives/EventPrimitives/EventPrimitivesHelpers.h b/Event/EventPrimitives/EventPrimitives/EventPrimitivesHelpers.h
index 8c7175ed6b3e5a91399ef9970910022c867401bc..9548e063aaca2f9d17adbeef1a02954f3521f900 100644
--- a/Event/EventPrimitives/EventPrimitives/EventPrimitivesHelpers.h
+++ b/Event/EventPrimitives/EventPrimitives/EventPrimitivesHelpers.h
@@ -24,64 +24,78 @@
  */
 
 namespace Amg {
-/**  Sometimes the extrapolation to the next surface succeeds but has
+//// Check whether all components of a vector are finite and whether the
+//// length of the vector is still within the Geneva area, i.e. 10 km
+template <int N>
+inline bool saneVector(const AmgVector(N) & vec) {
+  for (int i = 0; i < N; ++i) {
+    if (std::isnan(vec[i]) || std::isinf(vec[i]))
+      return false;
+  }
+  constexpr double max_length2 = 1.e16;
+  return vec.dot(vec) < max_length2;
+}
+
+/* Sometimes the extrapolation to the next surface succeeds but has
    termendoulsy large errors leading to uncertainties larger than the radius of
    the Geneva metropole. These ones themself are clearly unphysical, but if
    extrapolation continues to the next surface the numerical values blow up
    giving rise to floating point exception. The covariance_cutoff defines a
-   maximum value for the diagonal elements of the covariance matrix to consider
-   them as sanish
+   maximum value for the diagonal elements of the covariance matrix
 */
 inline bool saneCovarianceElement(double ele) {
   // Elements > 3.4028234663852886e+38
   // make no-sense remember Gaudi units are in mm
-  // What we say is that the position error must be less
-  // than 3.4028234663852886e+38
   constexpr double upper_covariance_cutoff = std::numeric_limits<float>::max();
   return !(std::isnan(ele) || std::isinf(ele) ||
            std::abs(ele) > upper_covariance_cutoff);
 }
 /// Returns true if all diagonal elements of the covariance matrix
-/// are finite, greater than zero and also below the covariance cutoff.
-/// This check avoids floating point exceptions raised during the uncertainty
-/// calculation on the perigee parameters
+/// are finite aka sane in the above definition.
+/// And equal or greater than 0.
 template <int N>
-inline bool saneCovarianceDiagonal(const AmgSymMatrix(N) & mat) {
-  // For now use float min 1.1754943508222875e-38
-  // This implies that (sigma(q/p)) ^2 has to be greater than
-  // than 1.1754943508222875e-38
-  constexpr double MIN_COV_EPSILON = std::numeric_limits<float>::min();
+inline bool hasPositiveOrZeroDiagElems(const AmgSymMatrix(N) & mat) {
   constexpr int dim = N;
   for (int i = 0; i < dim; ++i) {
-    if (mat(i, i) < MIN_COV_EPSILON || !saneCovarianceElement(mat(i, i)))
+    if (mat(i, i) < 0.0 || !saneCovarianceElement(mat(i, i)))
       return false;
   }
   return true;
 }
 
-inline bool saneCovarianceDiagonal(Amg::MatrixX& mat) {
-  // For now use float min 1.1754943508222875e-38
-  // This implies that (sigma(q/p)) ^2 has to be greater than
-  // than 1.1754943508222875e-38
-  constexpr double MIN_COV_EPSILON = std::numeric_limits<float>::min();
+inline bool hasPositiveOrZeroDiagElems(const Amg::MatrixX& mat) {
   int dim = mat.rows();
   for (int i = 0; i < dim; ++i) {
-    if (mat(i, i) < MIN_COV_EPSILON || !saneCovarianceElement(mat(i, i)))
+    if (mat(i, i) < 0.0 || !saneCovarianceElement(mat(i, i)))
       return false;
   }
   return true;
 }
 
-//// Check whether all components of a vector are finite and whether the
-//// length of the vector is still within the Geneva area, i.e. 10 km
+/// Returns true if all diagonal elements of the covariance matrix
+/// are finite aka sane in the above definition.
+/// And positive
+/// Instead of just positive we check that we are above
+/// the float epsilon
 template <int N>
-inline bool saneVector(const AmgVector(N) & vec) {
-  for (int i = 0; i < N; ++i) {
-    if (std::isnan(vec[i]) || std::isinf(vec[i]))
+inline bool hasPositiveDiagElems(const AmgSymMatrix(N) & mat) {
+  constexpr double MIN_COV_EPSILON = std::numeric_limits<float>::min();
+  constexpr int dim = N;
+  for (int i = 0; i < dim; ++i) {
+    if (mat(i, i) < MIN_COV_EPSILON || !saneCovarianceElement(mat(i, i)))
       return false;
   }
-  constexpr double max_length2 = 1.e16;
-  return vec.dot(vec) < max_length2;
+  return true;
+}
+
+inline bool hasPositiveDiagElems(const Amg::MatrixX& mat) {
+  constexpr double MIN_COV_EPSILON = std::numeric_limits<float>::min();
+  int dim = mat.rows();
+  for (int i = 0; i < dim; ++i) {
+    if (mat(i, i) < MIN_COV_EPSILON || !saneCovarianceElement(mat(i, i)))
+      return false;
+  }
+  return true;
 }
 
 /** return diagonal error of the matrix
diff --git a/Event/EventPrimitives/share/test_Helpers.ref b/Event/EventPrimitives/share/test_Helpers.ref
index aa47d0d46d47a06090f436b0b851b76bb6f3b6e2..d8ce09572c441ce46ae15bedf4911b3626c98612 100644
--- a/Event/EventPrimitives/share/test_Helpers.ref
+++ b/Event/EventPrimitives/share/test_Helpers.ref
@@ -1,2 +1,12 @@
+------------------
 0
 0
+------------------
+0
+0
+------------------
+1
+1
+------------------
+1
+0
diff --git a/Event/EventPrimitives/test/test_Helpers.cxx b/Event/EventPrimitives/test/test_Helpers.cxx
index 07384aee416f1ecddcda32c3fd2d251385f2d6aa..9df7d4b13fae15f57a75459951a384838998d93f 100644
--- a/Event/EventPrimitives/test/test_Helpers.cxx
+++ b/Event/EventPrimitives/test/test_Helpers.cxx
@@ -12,23 +12,44 @@
 
 int main() {
 
+  std::cout<<"------------------"<<'\n';
   AmgSymMatrix(5) mat;
   mat << 36.0000, 0.0000, -0.0222, -0.0001, 0.0000,
          0.0000, 3600.0000, -1.5939, -0.0164, 0.0000,
         -0.0184, -1.2931, -6230751.9604, -290277.8826, -0.5211,
          0.0001, -0.0023, -290277.8826, -13523.4478, -0.0243,
          0.0000, 0.0000, -0.5211, -0.0243, 0.0000;
+  std::cout <<Amg::hasPositiveOrZeroDiagElems(mat)<<'\n';
+  std::cout <<Amg::hasPositiveDiagElems(mat)<<'\n';
 
-  std::cout <<Amg::saneCovarianceDiagonal(mat)<<'\n';
-
-
+  std::cout<<"------------------"<<'\n';
   Amg::MatrixX dynMat(5,5);
   dynMat << 36.0000, 0.0000, -0.0222, -0.0001, 0.0000,
             0.0000, 3600.0000, -1.5939, -0.0164, 0.0000,
-           -0.0184, -1.2931, -6230751.9604, -290277.8826, -0.5211,
+            -0.0184, -1.2931, -6230751.9604, -290277.8826, -0.5211,
             0.0001, -0.0023, -290277.8826, -13523.4478, -0.0243,
             0.0000, 0.0000, -0.5211, -0.0243, 0.0000;
+  std::cout <<Amg::hasPositiveOrZeroDiagElems(dynMat)<<'\n';
+  std::cout <<Amg::hasPositiveDiagElems(dynMat)<<'\n';
+
+
+  std::cout<<"------------------"<<'\n';
+  AmgSymMatrix(5) mat1;
+  mat1 << 50977.455023, -3154.699348, 191.699597, -3.127933, 0.000037,
+          -3154.699348, 50043.753058, -10.483807, -29.006012, -0.001595,
+          191.699597, -10.483807, 0.724398, -0.012684, 0.000000,
+          -3.127933,  -29.006012, -0.012684, 0.021047, 0.000003,
+          0.000037, -0.001595, 0.000000, 0.000003, 1e-12;
+  std::cout<<Amg::hasPositiveOrZeroDiagElems(mat1)<<'\n';
+  std::cout <<Amg::hasPositiveDiagElems(mat1)<<'\n';
+
+
+  std::cout<<"------------------"<<'\n';
+  AmgSymMatrix(5) mat0;
+  mat0.setZero();
+  std::cout <<Amg::hasPositiveOrZeroDiagElems(mat0)<<'\n';
+  std::cout <<Amg::hasPositiveDiagElems(mat0)<<'\n';
+
 
-  std::cout <<Amg::saneCovarianceDiagonal(dynMat)<<'\n';
 
 }
diff --git a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3ESD_Alg.cxx b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3ESD_Alg.cxx
index 171f88ce17a95f220dbc842c5aa46cd299dee7d7..7bcec9f78dc217e3c4f6264f5fd811099ff09c8e 100644
--- a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3ESD_Alg.cxx
+++ b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3ESD_Alg.cxx
@@ -818,7 +818,7 @@ for (; p_trk != trackCollection.end(); ++p_trk) {
                 const AmgSymMatrix(5)* b_err = aTrackParam->covariance();
 
                 if (b_err) {
-                    if (!Amg::saneCovarianceDiagonal(*b_err)) {
+                    if (!Amg::hasPositiveDiagElems(*b_err)) {
                         ATH_MSG_WARNING("Some diagonal element(s) of the covariance matrix is (are) infinite or smaller than / too close to zero or above the covariance cutoff");
                     }
                     else {
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx
index 1c94e446880f2a095b160b137225a0f4dc17802e..07946cd0c684fe1a3999e75f0c204fc7e16890b0 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "MuonSystemExtensionTool.h"
@@ -154,7 +154,7 @@ namespace Muon {
         /// Get the calo extension
         if (!cache.candidate->getCaloExtension()) {
             if (!cache.extensionContainer) {
-                std::unique_ptr<Trk::CaloExtension> caloExtension = 
+                std::unique_ptr<Trk::CaloExtension> caloExtension =
                         m_caloExtensionTool->caloExtension(ctx, cache.candidate->indetTrackParticle());
                 if (!caloExtension || !caloExtension->muonEntryLayerIntersection()) {
                     ATH_MSG_VERBOSE("Failed to create the calo extension for "<<cache.candidate->toString());
@@ -169,11 +169,11 @@ namespace Muon {
                     return false;
                 }
                 cache.candidate->setExtension(caloExtension);
-            }            
+            }
         }
-       
+
         if (!cache.createSystemExtension) {
-            ATH_MSG_VERBOSE("No system extension is required for "<<cache.candidate->toString());           
+            ATH_MSG_VERBOSE("No system extension is required for "<<cache.candidate->toString());
             return true;
         }
         // get entry parameters, use it as current parameter for the extrapolation
@@ -193,11 +193,11 @@ namespace Muon {
         for (const Muon::MuonLayerSurface& it : surfaces) {
             // extrapolate to next layer
             const Trk::Surface& surface = *it.surfacePtr;
-            ATH_MSG_VERBOSE(" startPars: "<<to_string(*currentPars));               
+            ATH_MSG_VERBOSE(" startPars: "<<to_string(*currentPars));
             ATH_MSG_VERBOSE(" destination: sector " << it.sector << "  " << MuonStationIndex::regionName(it.regionIndex) << "  "
                                                     << MuonStationIndex::layerName(it.layerIndex) << " phi  " << surface.center().phi()
                                                     << " r " << surface.center().perp() << " z " << surface.center().z());
-            
+
             std::unique_ptr<const Trk::TrackParameters> exPars{
                 m_extrapolator->extrapolate(ctx, *currentPars, surface, Trk::alongMomentum, false, Trk::muon)};
             if (!exPars) {
@@ -210,20 +210,20 @@ namespace Muon {
             constexpr double TenMeter = 10. * Gaudi::Units::meter;
             const double sigma_lx = Amg::error(*exPars->covariance(), Trk::locX);
             const double sigma_ly = Amg::error(*exPars->covariance(), Trk::locY);
-            if (!Amg::saneCovarianceDiagonal(*exPars->covariance()) || std::max(sigma_lx, sigma_ly) > TenMeter){
+            if (!Amg::hasPositiveDiagElems(*exPars->covariance()) || std::max(sigma_lx, sigma_ly) > TenMeter){
                 ATH_MSG_DEBUG("Reject bad extrapolation "<<to_string(*exPars));
                 continue;
             }
-               
+
             // create shared pointer and add to garbage collection
             std::shared_ptr<const Trk::TrackParameters> sharedPtr{std::move(exPars)};
             trackParametersVec.emplace_back(sharedPtr);
 
             MuonSystemExtension::Intersection intersection = makeInterSection(sharedPtr, it);
             if (intersection.trackParameters) intersections.push_back(std::move(intersection));
-            
+
             constexpr double TenCm = 10. * Gaudi::Units::cm;
-            if(std::hypot(sigma_lx, sigma_ly) < std::max(TenCm, 10. * std::hypot(Amg::error(*currentPars->covariance(), Trk::locX), 
+            if(std::hypot(sigma_lx, sigma_ly) < std::max(TenCm, 10. * std::hypot(Amg::error(*currentPars->covariance(), Trk::locX),
                                                                                  Amg::error(*currentPars->covariance(), Trk::locY)))) {
                 // only update the parameters if errors don't blow up
                 currentPars = sharedPtr.get();
@@ -263,11 +263,11 @@ namespace Muon {
             if (sector != -1) {
                 MuonSystemExtension::Intersection intersection{sharedPtr, it};
                 intersection.layerSurface.sector = sector;
-                return intersection;              
-            } 
+                return intersection;
+            }
             return MuonSystemExtension::Intersection{nullptr, it};
         }
-        return  MuonSystemExtension::Intersection{sharedPtr, it}; 
+        return  MuonSystemExtension::Intersection{sharedPtr, it};
     }
 
     MuonSystemExtensionTool::SurfaceVec MuonSystemExtensionTool::getSurfacesForIntersection(const Trk::TrackParameters& muonEntryPars,
@@ -313,10 +313,10 @@ namespace Muon {
         std::stable_sort(surfaces.begin(), surfaces.end(), sortFunction);
         return surfaces;
     }
-    bool MuonSystemExtensionTool::muonLayerInterSections(const EventContext& ctx, 
+    bool MuonSystemExtensionTool::muonLayerInterSections(const EventContext& ctx,
                                             const MuonCombined::TagBase& cmb_tag,
                                             SystemExtensionCache& cache) const{
-      
+
         const Trk::Track* cmb_trk = cmb_tag.primaryTrack();
         if (!cmb_trk){
             ATH_MSG_WARNING("A combined tag without any track? Please check "<<cmb_tag.toString());
@@ -350,9 +350,9 @@ namespace Muon {
             ATH_MSG_DEBUG("MS extenion without surfaces.. "<<cache.candidate->toString());
             return false;
         }
-        
+
         std::vector<Muon::MuonSystemExtension::Intersection> intersections;
-        
+
         std::vector<const Trk::TrackStateOnSurface*>::const_iterator itr = ms_tsos.begin();
         std::vector<const Trk::TrackStateOnSurface*>::const_iterator end  = ms_tsos.end();
         for (const Muon::MuonLayerSurface& it : surfaces) {
@@ -367,10 +367,10 @@ namespace Muon {
             const Amg::Vector3D pos = trk_pars->position();
             const bool isBarrel = it.regionIndex == MuonStationIndex::Barrel;
             ATH_MSG_VERBOSE("Distance of closest parameters to the surface: "<< std::sqrt(std::abs(surf.normal().dot(pos - surf.center()))));
-            
-           
-            
-            const Trk::PropDirection dir = (isBarrel && pos.perp2() < surf.center().perp2()) || 
+
+
+
+            const Trk::PropDirection dir = (isBarrel && pos.perp2() < surf.center().perp2()) ||
                                            (!isBarrel && std::abs(pos.z()) < std::abs(surf.center().z()) ) ? Trk::alongMomentum : Trk::oppositeMomentum;
             std::shared_ptr<const Trk::TrackParameters> exPars{m_extrapolator->extrapolate(ctx, *trk_pars, surf, dir, false, Trk::muon)};
             if (!exPars) {
@@ -378,15 +378,15 @@ namespace Muon {
                 continue;
             }
             MuonSystemExtension::Intersection intersect = makeInterSection(exPars,it);
-            if (intersect.trackParameters) intersections.push_back(std::move(intersect));            
+            if (intersect.trackParameters) intersections.push_back(std::move(intersect));
         }
-        /// We are trying to reconstruct the layer extensions of a combined track. 
+        /// We are trying to reconstruct the layer extensions of a combined track.
         /// There is no way that this can fail
         if (intersections.empty()) {
             ATH_MSG_DEBUG("Failed to find the intersections for the combined track");
             return false;
         }
-        cache.candidate->setExtension(std::make_unique<MuonSystemExtension>(entry_pars, std::move(intersections)));      
+        cache.candidate->setExtension(std::make_unique<MuonSystemExtension>(entry_pars, std::move(intersections)));
 
         return true;
     }
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx
index e7369c07fdfd2b1e11c99cf026b60c9b24a19da0..dd0c1cbbaa95ebdc17ccc4e529c3b272e5c5617e 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx
@@ -541,7 +541,7 @@ namespace Muon {
                 ATH_MSG_VERBOSE("Surface layer "<<m_idHelperSvc->toStringGasGap(holeId)<<" cannot be reached");
                 continue;
             }
-            if (!Amg::saneCovarianceDiagonal(*pars->covariance())) {
+            if (!Amg::hasPositiveDiagElems(*pars->covariance())) {
                 ATH_MSG_DEBUG("Uncertainties of extraploation to "<<m_idHelperSvc->toStringGasGap(holeId)<<" blew up");
                 continue;
             }
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx
index 89fff5c6486699738d28b3488f66a65d4c00fc55..2aeb40b6b3ef797b5ab80a4bfe04de003ae67abf 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx
@@ -79,7 +79,7 @@ namespace Muon {
         ATH_CHECK(m_regsel_rpc.retrieve());
         ATH_CHECK(m_regsel_tgc.retrieve());
         m_recoverSTGC =  m_recoverSTGC && !m_regsel_stgc.empty();
-        m_recoverMM =  m_recoverMM && !m_regsel_mm.empty(); 
+        m_recoverMM =  m_recoverMM && !m_regsel_mm.empty();
         ATH_CHECK(m_regsel_csc.retrieve(DisableTool{m_regsel_csc.empty()}));
         ATH_CHECK(m_regsel_stgc.retrieve(DisableTool{!m_recoverSTGC}));
         ATH_CHECK(m_regsel_mm.retrieve(DisableTool{!m_recoverMM}));
@@ -434,7 +434,7 @@ namespace Muon {
 
             // calculate crossed tubes
             const MuonStationIntersect intersect = InterSectSvc->tubesCrossedByTrack(chId, exPars->position(), exPars->momentum().unit());
-           
+
             // clear hole vector
             for (unsigned int ii = 0; ii < intersect.tubeIntersects().size(); ++ii) {
                 const MuonTubeIntersect& tint = intersect.tubeIntersects()[ii];
@@ -458,7 +458,7 @@ namespace Muon {
                 int tube = m_idHelperSvc->mdtIdHelper().tube(id);
                 double tubeLen = detElLoc->getActiveTubeLength(lay, tube);
                 double distEdge = std::abs(tubePars->parameters()[Trk::locZ]) - 0.5 * tubeLen;
-                double pullEdge = tubePars->covariance() && Amg::saneCovarianceDiagonal(*tubePars->covariance())
+                double pullEdge = tubePars->covariance() && Amg::hasPositiveDiagElems(*tubePars->covariance())
                                       ? distEdge / Amg::error(*tubePars->covariance(), Trk::locZ)
                                       : distEdge / 20.;
                 std::optional<Amg::Vector2D> locPos = surf.Trk::Surface::globalToLocal(tubePars->position());
@@ -836,7 +836,7 @@ namespace Muon {
                 }
                 data.tgcCols = std::move(newtcols);
             }
-            
+
             m_seededSegmentFinder->extractCscPrdCols(data.csc, data.cscCols);
             std::vector<const CscPrepDataCollection*> newccols;
             for (const CscPrepDataCollection* cit : data.cscCols) {
@@ -852,7 +852,7 @@ namespace Muon {
                     }
                 }
             }
-            data.cscCols = std::move(newccols);  
+            data.cscCols = std::move(newccols);
 
             nstates = states.size();
             if (m_recoverSTGC) {
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSelectorTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSelectorTool.cxx
index aac0a17571c1ecbf668be4a0658fdbe604ccdc3e..389cc62d4442af98eb18eab70a45cf69baa6057a 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSelectorTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSelectorTool.cxx
@@ -70,7 +70,7 @@ namespace Muon {
             return false;
         }
         if (m_requireSanePerigee) {
-            if (!track.perigeeParameters() || !Amg::saneCovarianceDiagonal(*track.perigeeParameters()->covariance())) return false;
+            if (!track.perigeeParameters() || !Amg::hasPositiveDiagElems(*track.perigeeParameters()->covariance())) return false;
         }
 
         ++m_ntotalTracks;
diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx
index 94c90b420c7a112993a0367b04ff1c8e54cda7ec..746a132fbe1214fe657ace3e8cf80a5462b47632 100644
--- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx
+++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx
@@ -37,7 +37,7 @@ namespace {
 
     };
     constexpr float dummy_val = -1.;
-    
+
      struct RecordPars {
         RecordPars() = default;
         RecordPars(Amg::Vector3D&& _pos, Amg::Vector3D&&_mom):
@@ -46,11 +46,11 @@ namespace {
         RecordPars(const CLHEP::Hep3Vector& _pos, const CLHEP::Hep3Vector& _mom):
             pos{_pos.x(), _pos.y(), _pos.z()},
             mom{_mom.x(), _mom.y(), _mom.z()}{
-            
+
         }
         const Amg::Vector3D pos{Amg::Vector3D::Zero()};
         const Amg::Vector3D mom{Amg::Vector3D::Zero()};
-        
+
         std::string record_name;
         const Trk::TrackingVolume* volume{nullptr};
     };
@@ -151,8 +151,8 @@ namespace Muon {
             ATH_MSG_DEBUG("good muon with type " << iType << " and origin" << iOrigin);
 
             // create segments
-            if (m_createTruthSegment && goodMuon) { 
-                ATH_CHECK(createSegments(ctx, truthLink, segmentContainer, ids)); 
+            if (m_createTruthSegment && goodMuon) {
+                ATH_CHECK(createSegments(ctx, truthLink, segmentContainer, ids));
             }
         }
 
@@ -162,12 +162,12 @@ namespace Muon {
         return StatusCode::SUCCESS;
     }
 
-    StatusCode MuonTruthDecorationAlg::createSegments(const EventContext& ctx, 
+    StatusCode MuonTruthDecorationAlg::createSegments(const EventContext& ctx,
                                                      const ElementLink<xAOD::TruthParticleContainer>& truthLink,
                                                      SG::WriteHandle<xAOD::MuonSegmentContainer>& segmentContainer,
                                                      const ChamberIdMap& ids) const {
         SG::ReadCondHandle<MuonGM::MuonDetectorManager> detMgr{m_detMgrKey, ctx};
-        
+
         std::vector<SG::ReadHandle<MuonSimDataCollection> > sdoCollections(6);
         for (const SG::ReadHandleKey<MuonSimDataCollection>& k : m_SDO_TruthNames) {
             SG::ReadHandle<MuonSimDataCollection> col(k, ctx);
@@ -185,7 +185,7 @@ namespace Muon {
             } else {
                 sdoCollections[index] = std::move(col);
             }
-            
+
         }
 
         bool useSDO = (!sdoCollections.empty() || !m_CSC_SDO_TruthNames.empty());
@@ -242,7 +242,7 @@ namespace Muon {
                     }
                     // look up successful, calculate
                     if (!ok) continue;
-                    
+
                     // small comparison function
                     auto isSmaller = [isEndcap](const Amg::Vector3D& p1, const Amg::Vector3D& p2) {
                         if (isEndcap)
@@ -263,7 +263,7 @@ namespace Muon {
                             firstPos = gpos;
                         else if (isSmaller(secondPos, gpos))
                             secondPos = gpos;
-                    }                    
+                    }
                 } else {
                     SG::ReadHandle<CscSimDataCollection> cscCollection(m_CSC_SDO_TruthNames, ctx);
                     auto pos = cscCollection->find(id);
@@ -287,8 +287,8 @@ namespace Muon {
                             firstPos = gpos;
                         else if (secondPos.perp() < gpos.perp())
                             secondPos = gpos;
-                    }                    
-                }                
+                    }
+                }
             }
             if (precLayers.size() > 2) {
                 matchMap[lay.first] = index;
@@ -320,14 +320,14 @@ namespace Muon {
                 }
             }
         }
-        return StatusCode::SUCCESS; 
+        return StatusCode::SUCCESS;
     }
 
     StatusCode MuonTruthDecorationAlg::addTrackRecords(const EventContext& ctx, xAOD::TruthParticle& truthParticle) const {
         // first loop over track records, store parameters at the different positions
-        const xAOD::TruthVertex* vertex = truthParticle.prodVtx();        
+        const xAOD::TruthVertex* vertex = truthParticle.prodVtx();
         const Trk::TrackingGeometry* trackingGeometry = !m_extrapolator.empty()? m_extrapolator->trackingGeometry() : nullptr;
-      
+
         std::vector<RecordPars> parameters;
         if (vertex) {
             parameters.emplace_back(Amg::Vector3D{vertex->x(), vertex->y(), vertex->z()},
@@ -339,7 +339,7 @@ namespace Muon {
                 return StatusCode::FAILURE;
             }
             const std::string r_name = col.key();
-            
+
             float& x = truthParticle.auxdata<float>(r_name + "_x");
             float& y = truthParticle.auxdata<float>(r_name + "_y");
             float& z = truthParticle.auxdata<float>(r_name + "_z");
@@ -359,7 +359,7 @@ namespace Muon {
             truthParticle.auxdata<std::vector<float> >(r_name + "_cov_extr") = emptyVec;
             truthParticle.auxdata<bool>(r_name+"_is_extr") = false;
             ex = ey = ez = epx = epy = epz = dummy_val;
-            
+
             // loop over collection and find particle with the same bar code
             for (const auto& particle : *col) {
                 if (!HepMC::is_sim_descendant(&particle,&truthParticle)) continue;
@@ -368,13 +368,13 @@ namespace Muon {
                 ATH_MSG_VERBOSE("Found associated  " << r_name << " pt " << mom.perp() << " position: r " << pos.perp() << " z " << pos.z());
                 x = pos.x(); y = pos.y(); z = pos.z();
                 px = mom.x(); py = mom.y(); pz = mom.z();
-                parameters.emplace_back(pos, mom);                
+                parameters.emplace_back(pos, mom);
                 found_truth = true;
                 break;
             }
-            
+
             if (!trackingGeometry) continue;
-            
+
             /// Make sure that the parameter vector has the same size
             if (!found_truth) parameters.emplace_back();
             RecordPars& r_pars = parameters.back();
@@ -392,11 +392,11 @@ namespace Muon {
             r_pars.volume = found_truth ? volume : nullptr;
         }
         /// Second loop, extrapolate between the points
-        
+
         /// extrapolation needs to be setup correctly
         if (!trackingGeometry) return StatusCode::SUCCESS;
-       
-        
+
+
         AmgSymMatrix(5) cov{AmgSymMatrix(5)::Identity()};
         cov(0, 0) = cov(1, 1) = 1e-3;
         cov(2, 2) = cov(3, 3) = 1e-6;
@@ -407,7 +407,7 @@ namespace Muon {
             /// If the track record is named, then we should have a volume
             if ( (!start_pars.record_name.empty() && !start_pars.volume) || !end_pars.volume) continue;
             Trk::CurvilinearParameters pars(start_pars.pos, start_pars.mom, truthParticle.charge(), cov);
-            
+
             const Trk::TrackingVolume* volume = end_pars.volume;
             const std::string& r_name = end_pars.record_name;
             float& ex = truthParticle.auxdata<float>(r_name + "_x_extr");
@@ -417,14 +417,14 @@ namespace Muon {
             float& epy = truthParticle.auxdata<float>(r_name + "_py_extr");
             float& epz = truthParticle.auxdata<float>(r_name + "_pz_extr");
             std::vector<float>& covMat = truthParticle.auxdata<std::vector<float> >(r_name + "_cov_extr");
-           
+
             std::unique_ptr<Trk::TrackParameters> exPars{
                 m_extrapolator->extrapolateToVolume(ctx, pars, *volume, Trk::alongMomentum, Trk::muon)};
-            if (! exPars || !exPars->covariance() || !Amg::saneCovarianceDiagonal(*exPars->covariance())) {
+            if (! exPars || !exPars->covariance() || !Amg::hasPositiveDiagElems(*exPars->covariance())) {
                 ATH_MSG_VERBOSE("Extrapolation to "<<r_name<<" failed. ");
-                continue;                    
+                continue;
             }
-            truthParticle.auxdata<bool>(r_name+"_is_extr") = true;            
+            truthParticle.auxdata<bool>(r_name+"_is_extr") = true;
             ex = exPars->position().x();
             ey = exPars->position().y();
             ez = exPars->position().z();
@@ -432,7 +432,7 @@ namespace Muon {
             epy = exPars->momentum().y();
             epz = exPars->momentum().z();
             Amg::compress(*exPars->covariance(), covMat);
-            
+
             const double errorp = Amg::error(*exPars->covariance(), Trk::qOverP);
             ATH_MSG_VERBOSE( " Extrapolated to " << r_name << std::endl
                 << " truth: r " << end_pars.pos.perp() << " z "
@@ -448,12 +448,12 @@ namespace Muon {
                 << " pull p "
                 << (end_pars.mom.mag() -
                     exPars->momentum().mag()) /
-                     errorp);                
+                     errorp);
         }
-        return StatusCode::SUCCESS;            
+        return StatusCode::SUCCESS;
     }
 
-    StatusCode MuonTruthDecorationAlg::addHitCounts(const EventContext& ctx, 
+    StatusCode MuonTruthDecorationAlg::addHitCounts(const EventContext& ctx,
                                                     xAOD::TruthParticle& truthParticle,
                                                     ChamberIdMap& ids) const {
         int barcode = truthParticle.barcode();
@@ -495,13 +495,13 @@ namespace Muon {
                     ids[chIndex].push_back(id);
                 }
 
-                if (m_idHelperSvc->issTgc(id)) {                    
+                if (m_idHelperSvc->issTgc(id)) {
                     if (measPhi) {
                         int index = m_idHelperSvc->phiIndex(id);
                         ++nphiHitsPerChamberLayer.at(index);
                     }  else {
                         ++nprecHitsPerChamberLayer.at(chIndex);
-                    }                    
+                    }
                 } else if (m_idHelperSvc->isMM(id)) {
                     ++nprecHitsPerChamberLayer.at(chIndex);
                 } else if (m_idHelperSvc->isTrigger(id)) {
@@ -516,7 +516,7 @@ namespace Muon {
                     if (measPhi) {
                         Muon::MuonStationIndex::PhiIndex index = m_idHelperSvc->phiIndex(id);
                         ++nphiHitsPerChamberLayer.at(index);
- 
+
                     } else {
                         ++nprecHitsPerChamberLayer.at(chIndex);
                     }
@@ -532,51 +532,51 @@ namespace Muon {
                                  nprecHitsPerChamberLayer[Muon::MuonStationIndex::EIL] +
                                  nprecHitsPerChamberLayer[Muon::MuonStationIndex::CSL];
 
-        uint8_t middleSmallHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BMS] + 
+        uint8_t middleSmallHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BMS] +
                                   nprecHitsPerChamberLayer[Muon::MuonStationIndex::EMS];
 
-        uint8_t middleLargeHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BML] + 
+        uint8_t middleLargeHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BML] +
                                   nprecHitsPerChamberLayer[Muon::MuonStationIndex::EML];
 
-        uint8_t outerSmallHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BOS] + 
+        uint8_t outerSmallHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BOS] +
                                  nprecHitsPerChamberLayer[Muon::MuonStationIndex::EOS];
 
-        uint8_t outerLargeHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BML] + 
+        uint8_t outerLargeHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::BML] +
                                  nprecHitsPerChamberLayer[Muon::MuonStationIndex::EOL];
 
-        uint8_t extendedSmallHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::EES] + 
+        uint8_t extendedSmallHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::EES] +
                                     nprecHitsPerChamberLayer[Muon::MuonStationIndex::BEE];
 
         uint8_t extendedLargeHits = nprecHitsPerChamberLayer[Muon::MuonStationIndex::EEL];
 
-        uint8_t phiLayer1Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BM1] + 
+        uint8_t phiLayer1Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BM1] +
                                 nphiHitsPerChamberLayer[Muon::MuonStationIndex::T4] +
                                 nphiHitsPerChamberLayer[Muon::MuonStationIndex::CSC] +
                                 nphiHitsPerChamberLayer[Muon::MuonStationIndex::STGC1] +
                                 nphiHitsPerChamberLayer[Muon::MuonStationIndex::STGC2];
 
-        uint8_t phiLayer2Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BM2] + 
+        uint8_t phiLayer2Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BM2] +
                                 nphiHitsPerChamberLayer[Muon::MuonStationIndex::T1];
 
-        uint8_t phiLayer3Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BO1] + 
+        uint8_t phiLayer3Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BO1] +
                                 nphiHitsPerChamberLayer[Muon::MuonStationIndex::T2];
 
-        uint8_t phiLayer4Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BO2] + 
+        uint8_t phiLayer4Hits = nphiHitsPerChamberLayer[Muon::MuonStationIndex::BO2] +
                                 nphiHitsPerChamberLayer[Muon::MuonStationIndex::T3];
 
-        uint8_t etaLayer1Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BM1] + 
+        uint8_t etaLayer1Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BM1] +
                                 ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T4] +
-                                ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::CSC] + 
+                                ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::CSC] +
                                 ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::STGC1] +
                                 ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::STGC2];
 
-        uint8_t etaLayer2Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BM2] + 
+        uint8_t etaLayer2Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BM2] +
                                 ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T1];
 
-        uint8_t etaLayer3Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BO1] + 
+        uint8_t etaLayer3Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BO1] +
                                 ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T2];
 
-        uint8_t etaLayer4Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BO2] + 
+        uint8_t etaLayer4Hits = ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::BO2] +
                                 ntrigEtaHitsPerChamberLayer[Muon::MuonStationIndex::T3];
 
         uint8_t nprecLayers = 0;
@@ -684,11 +684,11 @@ namespace Muon {
 
     void MuonTruthDecorationAlg::addHitIDVectors(xAOD::TruthParticle& truthParticle,
                                                  const ChamberIdMap& ids) const {
-        
+
         std::vector<unsigned long long>& mdtTruthHits = truthParticle.auxdata<std::vector<unsigned long long> >("truthMdtHits");
         std::vector<unsigned long long>& tgcTruthHits = truthParticle.auxdata<std::vector<unsigned long long> >("truthTgcHits");
         std::vector<unsigned long long>& rpcTruthHits = truthParticle.auxdata<std::vector<unsigned long long> >("truthRpcHits");
-        
+
         std::vector<unsigned long long> stgcTruthHits;
         std::vector<unsigned long long> cscTruthHits;
         std::vector<unsigned long long> mmTruthHits;
diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx
index a1e9bc2e5d3e896799bae7f2421918f1ddc36d98..fe84bd852abaf30fc604b39075b8b9f600173482 100644
--- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx
+++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
 */
 
 //////////////////////////////////////////////////////////////////////////////
@@ -704,7 +704,7 @@ namespace Rec {
         // set measured momentum error and starting parameters
         bool badlyDeterminedCurvature = false;
 
-        if (!Amg::saneCovarianceDiagonal(*measuredPerigee->covariance())) {
+        if (!Amg::hasPositiveDiagElems(*measuredPerigee->covariance())) {
             ATH_MSG_WARNING("standaloneFit: measuredPerigee has non-positive-definite covariance ");
             ATH_MSG_VERBOSE(" SA::failed (5.5)");
             /// Delete manually until we switch to unique_ptrs
@@ -2273,7 +2273,7 @@ namespace Rec {
         const Trk::Perigee* measuredPerigee = spectrometerTrack.perigeeParameters();
         std::vector<std::unique_ptr<const Trk::TrackStateOnSurface>> spectrometerTSOS;
 
-        if (!measuredPerigee || !measuredPerigee->covariance() || !Amg::saneCovarianceDiagonal(*measuredPerigee->covariance())) {
+        if (!measuredPerigee || !measuredPerigee->covariance() || !Amg::hasPositiveDiagElems(*measuredPerigee->covariance())) {
             // missing MeasuredPerigee for spectrometer track
             if (!measuredPerigee)
                 m_messageHelper->printWarning(38);
diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackFitter.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackFitter.cxx
index 13effa2760398dc8f291e8c8c0980582c6b8820f..1208cb5c581702316eabf5e49b5d466c8c996e5c 100644
--- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackFitter.cxx
+++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackFitter.cxx
@@ -616,7 +616,7 @@ namespace Rec {
 
         for (const Trk::TrackParameters* par : *pars) {
             if (!par->covariance()) { continue; }
-            if (!Amg::saneCovarianceDiagonal(*par->covariance())) {
+            if (!Amg::hasPositiveDiagElems(*par->covariance())) {
                 ATH_MSG_DEBUG(txt<<" "<<__FILE__<<":"<<__LINE__<< "covariance matrix has negative diagonal element, killing track "
                               <<std::endl<<Amg::toString(*par->covariance()));
                 return false;
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx
index 6b006ddf7585a75d9ba4ec5281f894231dd11bea..a61d0866e948cf09578264624bdb230615c20f5c 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
 */
 
 //////////////////////////////////////////////////////////////////////////////
@@ -84,7 +84,7 @@ namespace MuonCombined {
             }
             double chi2 = 0;
             std::unique_ptr<const Trk::Perigee> perigee = theCombIdMu(*idPer, *msPer, chi2);
-            if (!perigee || !perigee->covariance() || !Amg::saneCovarianceDiagonal(*perigee->covariance())) {
+            if (!perigee || !perigee->covariance() || !Amg::hasPositiveDiagElems(*perigee->covariance())) {
                 ATH_MSG_DEBUG("Combination failed");
                 continue;
             }
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx
index ed1a5f5553e8d5958b6134632680325289bb6a7d..449014b55065c3ee89369d3ca212d89f491a753f 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
 */
 
 /////////////////////////////////////////////////////////////////////////////
@@ -342,10 +342,10 @@ namespace MuonCombined {
                             atSegSurface = m_MuTagMatchingTool->ExtrapolateTrktoSegmentSurface(ctx, *seg_ptr, *atSurface, seg_dir);
                             seg_extps.emplace_back(atSegSurface, seg_ptr->associatedSurface());
                         }
-                        if (!atSegSurface || !atSegSurface->covariance() || !Amg::saneCovarianceDiagonal(*atSegSurface->covariance()))
+                        if (!atSegSurface || !atSegSurface->covariance() || !Amg::hasPositiveDiagElems(*atSegSurface->covariance()))
                             continue;
                         const AmgSymMatrix(5) invCov = atSegSurface->covariance()->inverse();
-                        if (!Amg::saneCovarianceDiagonal(invCov)) continue;
+                        if (!Amg::hasPositiveDiagElems(invCov)) continue;
 
                         MuonCombined::MuonSegmentInfo info =
                             m_MuTagMatchingTool->muTagSegmentInfo(ctx, track.track(), *seg_ptr, atSegSurface);
diff --git a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx
index 718b804fcb34b43ac62fad34cf85b4ad0dd87fb2..f27d3a9c8e89ab36e54b2b6c3e455a2adb385169 100755
--- a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx
+++ b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx
@@ -2103,7 +2103,7 @@ std::unique_ptr<Trk::TrackParameters> Trk::STEP_Propagator::propagateRungeKutta(
 
   AmgSymMatrix(5) measurementCovariance =
       Trk::RungeKuttaUtils::newCovarianceMatrix(Jacobian, *trackParameters->covariance());
-  if (!Amg::saneCovarianceDiagonal(measurementCovariance))
+  if (!Amg::hasPositiveOrZeroDiagElems(measurementCovariance))
     return nullptr;
 
   // Calculate multiple scattering and straggling covariance contribution.
diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx
index 3b276b58e8de508ed2cd3cc21a24e876e238532f..4d56e4a453f008065ef9f0b2fbed0ead61fdceb3 100755
--- a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx
+++ b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx
@@ -602,7 +602,7 @@ void iPatFitter::addMeasurements(const EventContext& ctx,
       // FIXME
       // no intersection to MeasurementSet
       m_messageHelper->printWarning(15);
-      continue;      
+      continue;
     }
     auto measurement = std::make_unique<FitMeasurement>(hit, nullptr, *m);
     measurement->intersection(type, intersection);
@@ -719,7 +719,7 @@ bool iPatFitter::addMeasurements(
     }
     const Trk::MeasurementBase* measurementBase = s.measurementOnTrack();
     if (measurementBase) {
-      if (!Amg::saneCovarianceDiagonal(measurementBase->localCovariance())) {
+      if (!Amg::hasPositiveDiagElems(measurementBase->localCovariance())) {
         continue;
       }
       // option to skip vertex measurement (i.e. when not at front of list)
diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx b/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx
index 5f8224aa38003ec8eae8614fee6cafbff6437022..7f05984b477e97c355d7b200d19c12813a1ad1ad 100755
--- a/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx
+++ b/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx
@@ -112,7 +112,7 @@ const Amg::MatrixX* FitMatrices::fullCovariance(void) {
   weight.selfadjointView<0x2>();
 
   // check if m_weights makes sense before inverting
-  if (!Amg::saneCovarianceDiagonal(m_weight)) {
+  if (!Amg::hasPositiveDiagElems(m_weight)) {
     m_covariance.resize(0, 0);
     return nullptr;
   }
diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/src/MeasurementProcessor.cxx b/Tracking/TrkFitter/TrkiPatFitterUtils/src/MeasurementProcessor.cxx
index 4697d48d6e2a83ee2385f063a0a7b1b03e5fb509..dddf434ffbbe71fa3d1e0f0c74854a5737bd6a3c 100755
--- a/Tracking/TrkFitter/TrkiPatFitterUtils/src/MeasurementProcessor.cxx
+++ b/Tracking/TrkFitter/TrkiPatFitterUtils/src/MeasurementProcessor.cxx
@@ -416,7 +416,7 @@ void MeasurementProcessor::fieldIntegralUncertainty(MsgStream& log,
   // check field integral stability if there is a large error on the start
   // position/direction but only meaningful when material taken into account
   if (!m_parameters->numberScatterers() ||
-      !Amg::saneCovarianceDiagonal(covariance))
+      !Amg::hasPositiveOrZeroDiagElems(covariance))
     return;
 
   if (covariance(0, 0) + covariance(1, 1) < m_largeDeltaD0 * m_largeDeltaD0 &&
diff --git a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx
index 06087cd3b5ae8107cc5ef591ec95a49973bad3ed..6eb7ad5c4c7639dc7e3975c7641aa9d81ae8567a 100644
--- a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx
+++ b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TrkMaterialProviderTool.h"
@@ -150,7 +150,7 @@ Trk::TrkMaterialProviderTool::finalize()
 void Trk::TrkMaterialProviderTool::updateCaloTSOS(Trk::Track& track, const Trk::TrackParameters* startParameters) const
 {
   ATH_MSG_VERBOSE("updateCaloTSOS(Trk::Track& track, const Trk::TrackParameters* startParameters)");
- 
+
   // back extrapolate to perigee, get pAtCaloEntry from list of TSOSs
   // and update/add calo+ID material to mstrack to be refitted.
   const Trk::TrackStates* inputTSOS_orig = track.trackStateOnSurfaces();
@@ -713,9 +713,9 @@ Trk::TrkMaterialProviderTool::getCaloTSOS(const Trk::TrackParameters& parm,
 
   // Get TSOS from extrapolateM (from TG)
   std::vector<const Trk::TrackStateOnSurface*>* caloTSOS = m_muonExtrapolator->extrapolateM(ctx,
-                                                                                            parm, 
+                                                                                            parm,
                                                                                             surf, dir,
-                                                                                            boundaryCheck, 
+                                                                                            boundaryCheck,
                                                                                             mateffects);
 
   ATH_MSG_DEBUG("Retrieved " << caloTSOS->size() << " Calorimeter TSOS from extrapolateM, no-removal");
@@ -847,7 +847,7 @@ Trk::TrkMaterialProviderTool::getCaloTSOS(const Trk::TrackParameters& parm,
     if( std::abs(parms->parameters()[Trk::qOverP]) > 0.0 ) {
       double pAtMuonEntry = std::abs(1./parms->parameters()[Trk::qOverP]);
       if (!parms->covariance() ||
-          !Amg::saneCovarianceDiagonal(*parms->covariance())) {
+          !Amg::hasPositiveDiagElems(*parms->covariance())) {
         ATH_MSG_DEBUG(
           "MS track parameters without covariance, using 10% relative error!");
         pAtMuonEntryError = pAtMuonEntry*0.1;
@@ -1102,7 +1102,7 @@ void Trk::TrkMaterialProviderTool::removeMS(std::vector<const Trk::TrackStateOnS
 void Trk::TrkMaterialProviderTool::updateVector(Trk::TrackStates* inputTSOS,
 						Trk::TrackStates::iterator firstCALO,
 						Trk::TrackStates::iterator firstMS,
-						Trk::TrackStates* caloTSOS) 
+						Trk::TrackStates* caloTSOS)
 {
   //printTSOS(*firstCALO, "UPD->FIRST CALO");
   //printTSOS(*firstMS, "UPD->FIRST MS");
@@ -1275,14 +1275,14 @@ unsigned int Trk::TrkMaterialProviderTool::getVolumeByGeo(const Trk::TrackStateO
 
 
 //** Helper to delete TSOS vectors*/
-void Trk::TrkMaterialProviderTool::deleteTSOS(const std::vector<const Trk::TrackStateOnSurface*>* vecTSOS) 
+void Trk::TrkMaterialProviderTool::deleteTSOS(const std::vector<const Trk::TrackStateOnSurface*>* vecTSOS)
 {
   std::vector<const Trk::TrackStateOnSurface*>::const_iterator it = vecTSOS->begin();
   std::vector<const Trk::TrackStateOnSurface*>::const_iterator itEnd = vecTSOS->end();
   for (; it != itEnd; ++it) delete *it;
   delete vecTSOS;
 }
-void Trk::TrkMaterialProviderTool::deleteTSOS(Trk::TrackStates* vecTSOS) 
+void Trk::TrkMaterialProviderTool::deleteTSOS(Trk::TrackStates* vecTSOS)
 {
   if(vecTSOS->ownPolicy()==SG::VIEW_ELEMENTS) {
     Trk::TrackStates::const_iterator it = vecTSOS->begin();
@@ -1382,7 +1382,7 @@ Trk::TrkMaterialProviderTool::modifyTSOSvector(const std::vector<const Trk::Trac
 
   //
   Trk::TrackStates* newTSOSvector = new Trk::TrackStates(SG::VIEW_ELEMENTS);
-  
+
   // initialize total sum variables
   //
   //