File indexing completed on 2024-04-06 12:31:40
0001 #ifndef _TRACKER_LOCALTRAJECTORYERROR_H_
0002 #define _TRACKER_LOCALTRAJECTORYERROR_H_
0003
0004 #include "DataFormats/GeometrySurface/interface/LocalError.h"
0005 #include "DataFormats/Math/interface/AlgebraicROOTObjects.h"
0006 #include <memory>
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 class LocalTrajectoryError {
0021 public:
0022
0023 LocalTrajectoryError() {}
0024
0025 LocalTrajectoryError(InvalidError) : theCovarianceMatrix(ROOT::Math::SMatrixNoInit()) {
0026 theCovarianceMatrix(0, 0) = -99999.e10;
0027 }
0028
0029 ~LocalTrajectoryError() {}
0030
0031 bool invalid() const { return theCovarianceMatrix(0, 0) < -1.e10; }
0032 bool valid() const { return !invalid(); }
0033
0034
0035 bool posDef() const {
0036 return (theCovarianceMatrix(0, 0) >= 0) && (theCovarianceMatrix(1, 1) >= 0) && (theCovarianceMatrix(2, 2) >= 0) &&
0037 (theCovarianceMatrix(3, 3) >= 0) && (theCovarianceMatrix(4, 4) >= 0);
0038 }
0039
0040
0041
0042
0043
0044 LocalTrajectoryError(const AlgebraicSymMatrix55 &aCovarianceMatrix)
0045 : theCovarianceMatrix(aCovarianceMatrix), theWeightMatrixPtr() {}
0046
0047
0048
0049
0050
0051
0052
0053 LocalTrajectoryError(float dx, float dy, float dxdir, float dydir, float dpinv);
0054
0055
0056
0057
0058
0059
0060 const AlgebraicSymMatrix55 &matrix() const { return theCovarianceMatrix; }
0061
0062
0063
0064 const AlgebraicSymMatrix55 &weightMatrix() const;
0065
0066
0067
0068
0069 LocalTrajectoryError &operator*=(double factor) {
0070 theCovarianceMatrix *= factor;
0071 if ((theWeightMatrixPtr.get() != nullptr) && (factor != 0.0)) {
0072 (*theWeightMatrixPtr) /= factor;
0073 }
0074 return *this;
0075 }
0076
0077
0078
0079
0080
0081 LocalError positionError() const {
0082 return LocalError(theCovarianceMatrix(3, 3), theCovarianceMatrix(3, 4), theCovarianceMatrix(4, 4));
0083 }
0084
0085 private:
0086 AlgebraicSymMatrix55 theCovarianceMatrix;
0087 mutable std::shared_ptr<AlgebraicSymMatrix55> theWeightMatrixPtr;
0088 };
0089
0090 #endif