File indexing completed on 2023-03-17 11:26:38
0001 #include "TrackingTools/TrajectoryParametrization/interface/LocalTrajectoryError.h"
0002 #include "DataFormats/Math/interface/invertPosDefMatrix.h"
0003 #include "FWCore/Utilities/interface/Likely.h"
0004
0005 LocalTrajectoryError::LocalTrajectoryError(float dx, float dy, float dxdir, float dydir, float dpinv)
0006 : theCovarianceMatrix(), theWeightMatrixPtr() {
0007 theCovarianceMatrix(3, 3) = dx * dx;
0008 theCovarianceMatrix(4, 4) = dy * dy;
0009 theCovarianceMatrix(1, 1) = dxdir * dxdir;
0010 theCovarianceMatrix(2, 2) = dydir * dydir;
0011 theCovarianceMatrix(0, 0) = dpinv * dpinv;
0012 }
0013
0014 const AlgebraicSymMatrix55& LocalTrajectoryError::weightMatrix() const {
0015 if UNLIKELY (theWeightMatrixPtr.get() == nullptr) {
0016 theWeightMatrixPtr.reset(new AlgebraicSymMatrix55());
0017 invertPosDefMatrix(theCovarianceMatrix, *theWeightMatrixPtr);
0018 }
0019 return *theWeightMatrixPtr;
0020 }