CMS 3D CMS Logo

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