File indexing completed on 2024-04-06 12:31:40
0001 #ifndef _TRACKER_CURVILINEARTRAJECTORYERROR_H_
0002 #define _TRACKER_CURVILINEARTRAJECTORYERROR_H_
0003
0004 #include "DataFormats/GeometrySurface/interface/TrivialError.h"
0005 #include "DataFormats/Math/interface/AlgebraicROOTObjects.h"
0006 #include "DataFormats/Math/interface/Error.h"
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 class CurvilinearTrajectoryError {
0028 public:
0029
0030 enum { dimension = 5 };
0031
0032 typedef math::Error<dimension>::type MathCovarianceMatrix;
0033
0034
0035 CurvilinearTrajectoryError() {}
0036
0037 CurvilinearTrajectoryError(InvalidError) : theCovarianceMatrix(ROOT::Math::SMatrixNoInit()) {
0038 theCovarianceMatrix(0, 0) = -99999.e10;
0039 }
0040
0041
0042
0043
0044 CurvilinearTrajectoryError(const AlgebraicSymMatrix55 &aCovarianceMatrix) : theCovarianceMatrix(aCovarianceMatrix) {}
0045 template <typename M55>
0046 CurvilinearTrajectoryError(const M55 &aCovarianceMatrix) : theCovarianceMatrix(aCovarianceMatrix) {}
0047
0048 bool invalid() const { return theCovarianceMatrix(0, 0) < -1.e10; }
0049 bool valid() const { return !invalid(); }
0050
0051
0052 bool posDef() const {
0053 return (theCovarianceMatrix(0, 0) >= 0) && (theCovarianceMatrix(1, 1) >= 0) && (theCovarianceMatrix(2, 2) >= 0) &&
0054 (theCovarianceMatrix(3, 3) >= 0) && (theCovarianceMatrix(4, 4) >= 0);
0055 }
0056
0057
0058
0059
0060
0061 const AlgebraicSymMatrix55 &matrix() const { return theCovarianceMatrix; }
0062
0063 AlgebraicSymMatrix55 &matrix() { return theCovarianceMatrix; }
0064
0065
0066
0067
0068 void operator*=(double factor) { theCovarianceMatrix *= factor; }
0069
0070 void zeroFieldScaling(double factor) {
0071 double root_of_factor = sqrt(factor);
0072
0073 for (unsigned int i = 1; i != 5; ++i)
0074 theCovarianceMatrix(i, 0) *= root_of_factor;
0075
0076
0077 for (unsigned int i = 1; i != 5; ++i)
0078 for (unsigned int j = i; j != 5; ++j)
0079 theCovarianceMatrix(i, j) *= factor;
0080
0081 }
0082
0083 operator MathCovarianceMatrix &() { return theCovarianceMatrix; }
0084 operator const MathCovarianceMatrix &() const { return theCovarianceMatrix; }
0085
0086 private:
0087 AlgebraicSymMatrix55 theCovarianceMatrix;
0088 };
0089
0090 #endif