CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Chi2.cc
Go to the documentation of this file.
2 
3 Chi2::Chi2(TMatrixD &m, TMatrixD &ym, TMatrixD &merrors) {
4 
5  TMatrixD mt = m;
6  mt.T();
7  TMatrixD yt = ym;
8  yt.T();
9  TMatrixD m_leftMatrix(mt*merrors*m);
10  TMatrixD m_rightMatrix(mt*merrors*ym);
11  leftMatrix.ResizeTo(m_leftMatrix.GetNrows(), m_leftMatrix.GetNcols());
12  rightMatrix.ResizeTo(m_rightMatrix.GetNrows(), m_rightMatrix.GetNcols());
13  covariance.ResizeTo(m_leftMatrix.GetNrows(), m_leftMatrix.GetNrows());
14  rightMatrix = m_rightMatrix;
15  leftMatrix = m_leftMatrix;
16  covariance = m_leftMatrix.Invert();
17  TMatrixD m_solution(covariance*m_rightMatrix);
18  solution.ResizeTo(m_solution.GetNrows(), m_solution.GetNcols());
19  solution = m_solution;
20  TMatrixD m_Chi2((yt-m_solution.T()*mt)*merrors*(ym-m*solution));
21  myChi2 = m_Chi2(0,0);
22  dof = ym.GetNrows()-solution.GetNrows();
23 
24 
25 }
26 
28 
29 TMatrixD & Chi2::getCovariance() {return covariance;}
30 TMatrixD & Chi2::getSolution() {return solution;}
31 double Chi2::getChi2() {return myChi2;}
32 int Chi2::getDOF() {return dof;}
33 
34 
TMatrixD covariance
Definition: Chi2.h:32
TMatrixD rightMatrix
Definition: Chi2.h:34
double getChi2()
Definition: Chi2.cc:31
TMatrixD solution
Definition: Chi2.h:35
Chi2(TMatrixD &, TMatrixD &, TMatrixD &)
Definition: Chi2.cc:3
double myChi2
Definition: Chi2.h:30
TMatrixD & getCovariance()
Definition: Chi2.cc:29
TMatrixD & getSolution()
Definition: Chi2.cc:30
TMatrixD leftMatrix
Definition: Chi2.h:33
~Chi2()
Definition: Chi2.cc:27
int dof
Definition: Chi2.h:31
int getDOF()
Definition: Chi2.cc:32