Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:24

0001 #include "Alignment/SurveyAnalysis/interface/Chi2.h"
0002 
0003 Chi2::Chi2(TMatrixD &m, TMatrixD &ym, TMatrixD &merrors) {
0004   TMatrixD mt = m;
0005   mt.T();
0006   TMatrixD yt = ym;
0007   yt.T();
0008   TMatrixD m_leftMatrix(mt * merrors * m);
0009   TMatrixD m_rightMatrix(mt * merrors * ym);
0010   leftMatrix.ResizeTo(m_leftMatrix.GetNrows(), m_leftMatrix.GetNcols());
0011   rightMatrix.ResizeTo(m_rightMatrix.GetNrows(), m_rightMatrix.GetNcols());
0012   covariance.ResizeTo(m_leftMatrix.GetNrows(), m_leftMatrix.GetNrows());
0013   rightMatrix = m_rightMatrix;
0014   leftMatrix = m_leftMatrix;
0015   covariance = m_leftMatrix.Invert();
0016   TMatrixD m_solution(covariance * m_rightMatrix);
0017   solution.ResizeTo(m_solution.GetNrows(), m_solution.GetNcols());
0018   solution = m_solution;
0019   TMatrixD m_Chi2((yt - m_solution.T() * mt) * merrors * (ym - m * solution));
0020   myChi2 = m_Chi2(0, 0);
0021   dof = ym.GetNrows() - solution.GetNrows();
0022 }
0023 
0024 Chi2::~Chi2() {}
0025 
0026 TMatrixD &Chi2::getCovariance() { return covariance; }
0027 TMatrixD &Chi2::getSolution() { return solution; }
0028 double Chi2::getChi2() { return myChi2; }
0029 int Chi2::getDOF() { return dof; }