diff --git a/Event/EventPrimitives/CMakeLists.txt b/Event/EventPrimitives/CMakeLists.txt index 83620b5efc00c2304afde67d48a5b8a150efc0bb..1c3d20a705505ba37b7e4c9208d72c1ea5f86dca 100644 --- a/Event/EventPrimitives/CMakeLists.txt +++ b/Event/EventPrimitives/CMakeLists.txt @@ -29,8 +29,8 @@ atlas_add_test( test_AmgDefs SOURCES test/test_AmgDefs.cxx LINK_LIBRARIES EventPrimitives ) -atlas_add_test( test_Helpers - SOURCES test/test_Helpers.cxx +atlas_add_test( test_CovarianceHelpers + SOURCES test/test_CovarianceHelpers.cxx LINK_LIBRARIES EventPrimitives ) diff --git a/Event/EventPrimitives/EventPrimitives/EventPrimitivesCovarianceHelpers.h b/Event/EventPrimitives/EventPrimitives/EventPrimitivesCovarianceHelpers.h new file mode 100644 index 0000000000000000000000000000000000000000..eb1f3cd6ff00b3749a764aa35f187673f942d592 --- /dev/null +++ b/Event/EventPrimitives/EventPrimitives/EventPrimitivesCovarianceHelpers.h @@ -0,0 +1,220 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +/////////////////////////////////////////////////////////////////// +// EventPrimitivesHelpers.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// + +#ifndef EVENTPRIMITIVES_EVENTPRIMITIVESCOVARIANCEHELPERS_H +#define EVENTPRIMITIVES_EVENTPRIMITIVESCOVARIANCEHELPERS_H + +#include "EventPrimitives/EventPrimitives.h" +// +#include <Eigen/Cholesky> +// +#include <limits> +/** Event Primitives Covariance Helper Functions + @author Christos Anastopoulos + @author Johannes Junggeburth + */ + +namespace Amg { +/// A covariance matrix formally needs to be positive *semi* definite. +/// Not positive definite just positive *semi* definite. +/// +/// A symmetric matrix M with real entries is positive-definite +/// if the real number x^T M x is positive for every nonzero +/// real column vector x. +/// Positive-semidefinite means x^T M x non zero +/// for every nonzero real column vector x +/// +/// A symmetric matrix is positive semidefinite +/// if all its eigenvalues are non negative. +/// +/// A symmetric matrix is positive definite +/// if all its eigenvalues are positive +/// +/// Positive Definite and Positive Semi Definit matrices +/// Have a Cholesky decomposition. The Positive (semi) +/// definiteness is a necessary and sufficient condition +/// +/// A positive (semi)-definite matrix can not have +/// non-positive (negative) diagonal elements. +/// If A_ii < 0 we could choose an x vector with +/// all entries 0 bar x_i and the x^T M x would be +/// negative. +/// +/// Having positive (positive or 0) diagonal elements +/// is *necessary* but not *sufficient* condition. +/// As we could have positive diagonal elements and have +/// a vector x that still could result in x^T M x being negative. +/// Matrix A in the test shows this issue +/// +/// What follows are methods to check for these +/// +/// We can +/// - Just check for the *necessary* condition (relatively fast) +/// - Check using Cholosky decomposition (still not too slow) +/// - Solve for all eigenvalues and check none +/// is zero (slow) + +/// Avoid nan, inf, and elements above float max +inline bool saneCovarianceElement(double ele) { + 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 aka sane in the above definition. +/// And equal or greater than 0. +template <int N> +inline bool hasPositiveOrZeroDiagElems(const AmgSymMatrix(N) & mat) { + constexpr int dim = N; + for (int i = 0; i < dim; ++i) { + if (mat(i, i) < 0.0 || !saneCovarianceElement(mat(i, i))) + return false; + } + return true; +} + +inline bool hasPositiveOrZeroDiagElems(const Amg::MatrixX& mat) { + int dim = mat.rows(); + for (int i = 0; i < dim; ++i) { + if (mat(i, i) < 0.0 || !saneCovarianceElement(mat(i, i))) + return false; + } + return true; +} + +/// 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 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; + } + 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; +} + +/// Check if is positive semidefinit using that fact that is needed for +/// Cholesky decomposition. We have to use LDLT from Eigen +template <int N> +inline bool isPositiveSemiDefinite(const AmgSymMatrix(N) & mat) { + if (!hasPositiveOrZeroDiagElems(mat)) { + // fast check for necessary condition + return false; + } + Eigen::LDLT<AmgSymMatrix(N)> ldltCov(mat); + return (ldltCov.info() == Eigen::Success && ldltCov.isPositive()); +} +inline bool isPositiveSemiDefinite(const Amg::MatrixX& mat) { + if (!hasPositiveOrZeroDiagElems(mat)) { + // fast check for necessary condition + return false; + } + Eigen::LDLT<Amg::MatrixX> ldltCov(mat); + return (ldltCov.info() == Eigen::Success && ldltCov.isPositive()); +} + +/// Check if is positive semidefinit using that fact that is needed for +/// Cholesky decomposition. We use LLT from Eigen +template <int N> +inline bool isPositiveDefinite(const AmgSymMatrix(N) & mat) { + if (!hasPositiveDiagElems(mat)) { + // fast check for necessary condition + return false; + } + Eigen::LLT<AmgSymMatrix(N)> lltCov(mat); + return (lltCov.info() == Eigen::Success); +} +inline bool isPositiveDefinite(const Amg::MatrixX& mat) { + if (!hasPositiveDiagElems(mat)) { + // fast check for necessary condition + return false; + } + Eigen::LLT<Amg::MatrixX> lltCov(mat); + return (lltCov.info() == Eigen::Success); +} + +/// These are the slow test following the definition. +/// Indented mainly for testing/ +template <int N> +inline bool isPositiveSemiDefiniteSlow(const AmgSymMatrix(N) & mat) { + if (!hasPositiveOrZeroDiagElems(mat)) { + // fast check for necessary condition + return false; + } + Eigen::SelfAdjointEigenSolver<AmgSymMatrix(5)> eigensolver(mat); + auto res = eigensolver.eigenvalues(); + for (size_t i = 0; i < N; ++i) { + if (res[i] < 0) { + return false; + } + } + return true; +} +inline bool isPositiveSemiDefiniteSlow(const Amg::MatrixX& mat) { + if (!hasPositiveOrZeroDiagElems(mat)) { + // fast check for necessary condition + return false; + } + Eigen::SelfAdjointEigenSolver<Amg::MatrixX> eigensolver(mat); + auto res = eigensolver.eigenvalues(); + int dim = mat.rows(); + for (int i = 0; i < dim; ++i) { + if (res[i] < 0) { + return false; + } + } + return true; +} +template <int N> +inline bool isPositiveDefiniteSlow(const AmgSymMatrix(N) & mat) { + if (!hasPositiveDiagElems(mat)) { + // fast check for necessary condition + return false; + } + Eigen::SelfAdjointEigenSolver<AmgSymMatrix(5)> eigensolver(mat); + auto res = eigensolver.eigenvalues(); + for (size_t i = 0; i < N; ++i) { + if (res[i] <= 0) { + return false; + } + } + return true; +} +inline bool isPositiveDefiniteSlow(const Amg::MatrixX& mat) { + if (!hasPositiveDiagElems(mat)) { + // fast check for necessary condition + return false; + } + Eigen::SelfAdjointEigenSolver<Amg::MatrixX> eigensolver(mat); + auto res = eigensolver.eigenvalues(); + int dim = mat.rows(); + for (int i = 0; i < dim; ++i) { + if (res[i] <= 0) { + return false; + } + } + return true; +} + +} // namespace Amg + +#endif diff --git a/Event/EventPrimitives/EventPrimitives/EventPrimitivesHelpers.h b/Event/EventPrimitives/EventPrimitives/EventPrimitivesHelpers.h index 9548e063aaca2f9d17adbeef1a02954f3521f900..cc716e8929e767e485729eb6c082a4d6deadb23e 100644 --- a/Event/EventPrimitives/EventPrimitives/EventPrimitivesHelpers.h +++ b/Event/EventPrimitives/EventPrimitives/EventPrimitivesHelpers.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -11,16 +11,14 @@ #include "EventPrimitives/EventPrimitives.h" // -#include <vector> #include <cmath> +#include <vector> /** Event primitives helper functions @author Niels van Eldik @author Robert Johannes Langenberg @author Andreas Salzburger @author Johannes Junggeburth - @author Christos Anastopoulos - */ namespace Amg { @@ -36,68 +34,6 @@ inline bool saneVector(const AmgVector(N) & vec) { 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 -*/ -inline bool saneCovarianceElement(double ele) { - // Elements > 3.4028234663852886e+38 - // make no-sense remember Gaudi units are in mm - 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 aka sane in the above definition. -/// And equal or greater than 0. -template <int N> -inline bool hasPositiveOrZeroDiagElems(const AmgSymMatrix(N) & mat) { - constexpr int dim = N; - for (int i = 0; i < dim; ++i) { - if (mat(i, i) < 0.0 || !saneCovarianceElement(mat(i, i))) - return false; - } - return true; -} - -inline bool hasPositiveOrZeroDiagElems(const Amg::MatrixX& mat) { - int dim = mat.rows(); - for (int i = 0; i < dim; ++i) { - if (mat(i, i) < 0.0 || !saneCovarianceElement(mat(i, i))) - return false; - } - return true; -} - -/// 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 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; - } - 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 caller should ensure the matrix is symmetric and the index is in range */ diff --git a/Event/EventPrimitives/share/test_CovarianceHelpers.ref b/Event/EventPrimitives/share/test_CovarianceHelpers.ref new file mode 100644 index 0000000000000000000000000000000000000000..d6535642fb427df2ecb042cab066da2f3a0e7744 --- /dev/null +++ b/Event/EventPrimitives/share/test_CovarianceHelpers.ref @@ -0,0 +1,66 @@ +Test Covariance Helpers + +Testing Matrix A + 50977.5 -3154.7 191.7 -3.12793 3.7e-05 + -3154.7 50043.8 -10.4838 -29.006 -0.001595 + 191.7 -10.4838 0.724398 -0.012684 0 + -3.12793 -29.006 -0.012684 0.021047 3e-06 + 3.7e-05 -0.001595 0 3e-06 1e-12 +isPositiveSemiDefinite 0 +isPositiveDefinite 0 +Cholesky isPositiveSemiDefinite 0 +Cholesky isPositiveDefinite 0 +All diagonal Elements are >=0 1 +All diagonal Elements are >0 1 + +Testing dynamic Matrix A + 50977.5 -3154.7 191.7 -3.12793 3.7e-05 + -3154.7 50043.8 -10.4838 -29.006 -0.001595 + 191.7 -10.4838 0.724398 -0.012684 0 + -3.12793 -29.006 -0.012684 0.021047 3e-06 + 3.7e-05 -0.001595 0 3e-06 1e-12 +isPositiveSemiDefinite 0 +isPositiveDefinite 0 +Cholesky isPositiveSemiDefinite 0 +Cholesky isPositiveDefinite 0 +All diagonal Elements are >=0 1 +All diagonal Elements are >0 1 + +Testing Matrix B + 36 0 -0.0222 -0.0001 0 + 0 3600 -1.5939 -0.0164 0 + -0.0184 -1.2931 -6.23075e+06 -290278 -0.5211 + 0.0001 -0.0023 -290278 -13523.4 -0.0243 + 0 0 -0.5211 -0.0243 0 +isPositiveSemiDefinite 0 +isPositiveDefinite 0 +Cholesky isPositiveSemiDefinite 0 +Cholesky isPositiveDefinite 0 +All diagonal Elements are >=0 0 +All diagonal Elements are >0 0 + +Testing Zero Matrix +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +isPositiveSemiDefinite 1 +isPositiveDefinite 0 +Cholesky isPositiveSemiDefinite 1 +Cholesky isPositiveDefinite 0 +All diagonal Elements are >=0 1 +All diagonal Elements are >0 0 + +Testing Dynamic Zero Matrix +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +0 0 0 0 0 +isPositiveSemiDefinite 1 +isPositiveDefinite 0 +Cholesky isPositiveSemiDefinite 1 +Cholesky isPositiveDefinite 0 +All diagonal Elements are >=0 1 +All diagonal Elements are >0 0 diff --git a/Event/EventPrimitives/share/test_Helpers.ref b/Event/EventPrimitives/share/test_Helpers.ref deleted file mode 100644 index d8ce09572c441ce46ae15bedf4911b3626c98612..0000000000000000000000000000000000000000 --- a/Event/EventPrimitives/share/test_Helpers.ref +++ /dev/null @@ -1,12 +0,0 @@ ------------------- -0 -0 ------------------- -0 -0 ------------------- -1 -1 ------------------- -1 -0 diff --git a/Event/EventPrimitives/test/test_CovarianceHelpers.cxx b/Event/EventPrimitives/test/test_CovarianceHelpers.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5edb723531110cf4541200a7c6cfb49a1423d1ea --- /dev/null +++ b/Event/EventPrimitives/test/test_CovarianceHelpers.cxx @@ -0,0 +1,125 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file test_eta.cxx + * @brief test for EventPrimitivesHelpers + */ + +#include <iostream> + +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" + +int main() { + + std::cout << "Test Covariance Helpers " << '\n'; + std::cout << '\n' << "Testing Matrix A " << '\n'; + { + AmgSymMatrix(5) A; + A << 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 << A << '\n'; + std::cout << "isPositiveSemiDefinite " << Amg::isPositiveSemiDefiniteSlow(A) + << '\n'; + std::cout << "isPositiveDefinite " << Amg::isPositiveDefiniteSlow(A) + << '\n'; + std::cout << "Cholesky isPositiveSemiDefinite " + << Amg::isPositiveSemiDefinite(A) << '\n'; + std::cout << "Cholesky isPositiveDefinite " << Amg::isPositiveDefinite(A) + << '\n'; + std::cout << "All diagonal Elements are >=0 " + << Amg::hasPositiveOrZeroDiagElems(A) << '\n'; + std::cout << "All diagonal Elements are >0 " << Amg::hasPositiveDiagElems(A) + << '\n'; + } + + std::cout << '\n' << "Testing dynamic Matrix A" << '\n'; + { + Amg::MatrixX A; + A.resize(5, 5); + A << 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 << A << '\n'; + std::cout << "isPositiveSemiDefinite " << Amg::isPositiveSemiDefiniteSlow(A) + << '\n'; + std::cout << "isPositiveDefinite " << Amg::isPositiveDefiniteSlow(A) + << '\n'; + std::cout << "Cholesky isPositiveSemiDefinite " + << Amg::isPositiveSemiDefinite(A) << '\n'; + std::cout << "Cholesky isPositiveDefinite " << Amg::isPositiveDefinite(A) + << '\n'; + std::cout << "All diagonal Elements are >=0 " + << Amg::hasPositiveOrZeroDiagElems(A) << '\n'; + std::cout << "All diagonal Elements are >0 " << Amg::hasPositiveDiagElems(A) + << '\n'; + } + + std::cout << '\n' << "Testing Matrix B" << '\n'; + { + AmgSymMatrix(5) B; + B << 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 << B << '\n'; + std::cout << "isPositiveSemiDefinite " << Amg::isPositiveSemiDefiniteSlow(B) + << '\n'; + std::cout << "isPositiveDefinite " << Amg::isPositiveDefiniteSlow(B) + << '\n'; + std::cout << "Cholesky isPositiveSemiDefinite " + << Amg::isPositiveSemiDefinite(B) << '\n'; + std::cout << "Cholesky isPositiveDefinite " << Amg::isPositiveDefinite(B) + << '\n'; + std::cout << "All diagonal Elements are >=0 " + << Amg::hasPositiveOrZeroDiagElems(B) << '\n'; + std::cout << "All diagonal Elements are >0 " << Amg::hasPositiveDiagElems(B) + << '\n'; + } + + std::cout << '\n' << "Testing Zero Matrix" << '\n'; + { + AmgSymMatrix(5) zero; + zero.setZero(); + std::cout << zero << '\n'; + std::cout << "isPositiveSemiDefinite " + << Amg::isPositiveSemiDefiniteSlow(zero) << '\n'; + std::cout << "isPositiveDefinite " << Amg::isPositiveDefiniteSlow(zero) + << '\n'; + std::cout << "Cholesky isPositiveSemiDefinite " + << Amg::isPositiveSemiDefinite(zero) << '\n'; + std::cout << "Cholesky isPositiveDefinite " << Amg::isPositiveDefinite(zero) + << '\n'; + std::cout << "All diagonal Elements are >=0 " + << Amg::hasPositiveOrZeroDiagElems(zero) << '\n'; + std::cout << "All diagonal Elements are >0 " + << Amg::hasPositiveDiagElems(zero) << '\n'; + } + + std::cout << '\n' << "Testing Dynamic Zero Matrix" << '\n'; + { + Amg::MatrixX zero; + zero.resize(5, 5); + zero.setZero(); + std::cout << zero << '\n'; + std::cout << "isPositiveSemiDefinite " + << Amg::isPositiveSemiDefiniteSlow(zero) << '\n'; + std::cout << "isPositiveDefinite " << Amg::isPositiveDefiniteSlow(zero) + << '\n'; + std::cout << "Cholesky isPositiveSemiDefinite " + << Amg::isPositiveSemiDefinite(zero) << '\n'; + std::cout << "Cholesky isPositiveDefinite " << Amg::isPositiveDefinite(zero) + << '\n'; + std::cout << "All diagonal Elements are >=0 " + << Amg::hasPositiveOrZeroDiagElems(zero) << '\n'; + std::cout << "All diagonal Elements are >0 " + << Amg::hasPositiveDiagElems(zero) << '\n'; + } +} diff --git a/Event/EventPrimitives/test/test_Helpers.cxx b/Event/EventPrimitives/test/test_Helpers.cxx deleted file mode 100644 index 9df7d4b13fae15f57a75459951a384838998d93f..0000000000000000000000000000000000000000 --- a/Event/EventPrimitives/test/test_Helpers.cxx +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @file test_eta.cxx - * @brief test for EventPrimitivesHelpers - */ - -#include <iostream> -#include "EventPrimitives/EventPrimitivesHelpers.h" - -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<<"------------------"<<'\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.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'; - - - -} diff --git a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3ESD_Alg.cxx b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3ESD_Alg.cxx index 7bcec9f78dc217e3c4f6264f5fd811099ff09c8e..f849457fa38fd532ca160699863186dc4f5c58c9 100644 --- a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3ESD_Alg.cxx +++ b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3ESD_Alg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "TRTMonitoringRun3/TRTMonitoringRun3ESD_Alg.h" @@ -21,6 +21,7 @@ #include "InDetConditionsSummaryService/IInDetConditionsSvc.h" #include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include <sstream> #include <iomanip> diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx index 07946cd0c684fe1a3999e75f0c204fc7e16890b0..639fe1d07020294a2136ef1ebb993a2b54e54e8f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx @@ -1,10 +1,11 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "MuonSystemExtensionTool.h" #include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "MuonCombinedEvent/InDetCandidate.h" #include "MuonCombinedEvent/TagBase.h" #include "MuonDetDescrUtils/MuonChamberLayerDescription.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx index dd0c1cbbaa95ebdc17ccc4e529c3b272e5c5617e..9dae848e5dc2f18978c02e5bcad167f737ed5794 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "MuonChamberHoleRecoveryTool.h" @@ -7,6 +7,7 @@ #include <map> #include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "GeoPrimitives/GeoPrimitivesToStringConverter.h" #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" #include "MuonPrepRawData/MuonCluster.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx index 2aeb40b6b3ef797b5ab80a4bfe04de003ae67abf..42e06d2484055952583ccccab7877669b30d5611 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "MuonSegmentRegionRecoveryTool.h" @@ -7,6 +7,7 @@ #include <ostream> #include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "EventPrimitives/EventPrimitivesToStringConverter.h" #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" #include "MuonPrepRawData/CscPrepDataCollection.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSelectorTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSelectorTool.cxx index 389cc62d4442af98eb18eab70a45cf69baa6057a..f1ee053131e1b12d2622b27b4626577fcfa704f8 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSelectorTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSelectorTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "MuonTrackSelectorTool.h" @@ -14,7 +14,7 @@ #include "TrkTrack/Track.h" #include "TrkTrackSummary/MuonTrackSummary.h" #include "TrkTrackSummary/TrackSummary.h" -#include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" namespace Muon { MuonTrackSelectorTool::MuonTrackSelectorTool(const std::string& ty, const std::string& na, const IInterface* pa) : diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx index 746a132fbe1214fe657ace3e8cf80a5462b47632..25e3f398bd5c3ea8b94c2e55c884a7e65465dc39 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx @@ -1,10 +1,11 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "MuonTruthDecorationAlg.h" #include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "GeneratorObjects/McEventCollection.h" #include "MCTruthClassifier/IMCTruthClassifier.h" #include "MuonReadoutGeometry/CscReadoutElement.h" diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx index fe84bd852abaf30fc604b39075b8b9f600173482..b99e494e9d66b35bacfe092483899e50aa4d89b4 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////// @@ -19,6 +19,7 @@ #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" #include "AthenaKernel/Units.h" #include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "EventPrimitives/EventPrimitivesToStringConverter.h" #include "FourMomUtils/xAODP4Helpers.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackFitter.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackFitter.cxx index 1208cb5c581702316eabf5e49b5d466c8c996e5c..cbe7c61cabaaa9fdbb67eaac6a67c99f22470b7b 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackFitter.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackFitter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////// @@ -17,7 +17,7 @@ #include <iomanip> #include <memory> #include "AthenaKernel/Units.h" -#include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "EventPrimitives/EventPrimitivesToStringConverter.h" #include "FourMomUtils/xAODP4Helpers.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx index a61d0866e948cf09578264624bdb230615c20f5c..6f4204dbce5d45d78424ed72097f1477ef34b4d7 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////// @@ -11,7 +11,7 @@ #include "MuonCombinedStacoTagTool.h" -#include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "FourMomUtils/xAODP4Helpers.h" #include "MuonCombinedEvent/InDetCandidate.h" #include "MuonCombinedEvent/InDetCandidateToTagMap.h" diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx index 449014b55065c3ee89369d3ca212d89f491a753f..99f686a5281077154a9e6aeded639ae2cc81387e 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////// @@ -17,7 +17,7 @@ #include <vector> #include "AthLinks/ElementLink.h" -#include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "MuonCombinedEvent/InDetCandidate.h" #include "MuonCombinedEvent/MuonCandidate.h" #include "MuonCombinedEvent/MuonSegmentInfo.h" diff --git a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx index f27d3a9c8e89ab36e54b2b6c3e455a2adb385169..1355ff3f7986d980c0eca4a619ac8c46829feb4a 100755 --- a/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx +++ b/Tracking/TrkExtrapolation/TrkExSTEP_Propagator/src/STEP_Propagator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////// @@ -38,6 +38,7 @@ // Gaudi #include "EventPrimitives/EventPrimitives.h" #include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "EventPrimitives/EventPrimitivesToStringConverter.h" // #include <cmath> diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx index 4d56e4a453f008065ef9f0b2fbed0ead61fdceb3..23e529de70f15a9087c8af1c48291db5fa9916e2 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -12,7 +12,7 @@ #include <cmath> #include <iomanip> -#include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "GaudiKernel/SystemOfUnits.h" #include "GeoPrimitives/GeoPrimitives.h" #include "Identifier/Identifier.h" diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx b/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx index 7f05984b477e97c355d7b200d19c12813a1ad1ad..ceb03809479b146dc653bb1a59eccf320395e9ab 100755 --- a/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx +++ b/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ #include <iomanip> #include <iostream> -#include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "GaudiKernel/SystemOfUnits.h" #include "TrkExUtils/TrackSurfaceIntersection.h" #include "TrkiPatFitterUtils/FitMeasurement.h" diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/src/MeasurementProcessor.cxx b/Tracking/TrkFitter/TrkiPatFitterUtils/src/MeasurementProcessor.cxx index dddf434ffbbe71fa3d1e0f0c74854a5737bd6a3c..3fd57fdf0e66b2ff1193f39c21b906578ee99232 100755 --- a/Tracking/TrkFitter/TrkiPatFitterUtils/src/MeasurementProcessor.cxx +++ b/Tracking/TrkFitter/TrkiPatFitterUtils/src/MeasurementProcessor.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -13,7 +13,7 @@ #include <iomanip> #include <iostream> -#include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/SystemOfUnits.h" #include "TrkExInterfaces/IIntersector.h" diff --git a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx index 6eb7ad5c4c7639dc7e3975c7641aa9d81ae8567a..12913e88332cb6248d447e4058a011c529b92476 100644 --- a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx +++ b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "TrkMaterialProviderTool.h" @@ -20,6 +20,7 @@ // Amg::error #include "EventPrimitives/EventPrimitivesHelpers.h" +#include "EventPrimitives/EventPrimitivesCovarianceHelpers.h" // For measured energy loss #include "CLHEP/Units/SystemOfUnits.h"