CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Alignment/SurveyAnalysis/src/Chi2.cc

Go to the documentation of this file.
00001 #include "Alignment/SurveyAnalysis/interface/Chi2.h"
00002 
00003 Chi2::Chi2(TMatrixD &m, TMatrixD &ym, TMatrixD &merrors) {
00004   
00005   TMatrixD mt = m;
00006   mt.T();
00007   TMatrixD yt = ym;
00008   yt.T();
00009   TMatrixD m_leftMatrix(mt*merrors*m);
00010   TMatrixD m_rightMatrix(mt*merrors*ym);
00011   leftMatrix.ResizeTo(m_leftMatrix.GetNrows(), m_leftMatrix.GetNcols());
00012   rightMatrix.ResizeTo(m_rightMatrix.GetNrows(), m_rightMatrix.GetNcols());
00013   covariance.ResizeTo(m_leftMatrix.GetNrows(), m_leftMatrix.GetNrows());
00014   rightMatrix = m_rightMatrix;
00015   leftMatrix = m_leftMatrix;
00016   covariance = m_leftMatrix.Invert();
00017   TMatrixD m_solution(covariance*m_rightMatrix);
00018   solution.ResizeTo(m_solution.GetNrows(), m_solution.GetNcols());
00019   solution = m_solution;
00020   TMatrixD m_Chi2((yt-m_solution.T()*mt)*merrors*(ym-m*solution));
00021   myChi2 = m_Chi2(0,0);
00022   dof = ym.GetNrows()-solution.GetNrows();
00023 
00024 
00025 }
00026 
00027 Chi2::~Chi2(){}
00028 
00029 TMatrixD & Chi2::getCovariance() {return covariance;}
00030 TMatrixD & Chi2::getSolution() {return solution;}
00031 double Chi2::getChi2() {return myChi2;}
00032 int Chi2::getDOF() {return dof;}
00033 
00034