Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:52

0001 #include <iostream.h>
0002 
0003 class HistoCompare {
0004 
0005  public:
0006 
0007   HistoCompare() { std::cout << "Initializing HistoCompare... " << std::endl; } ;
0008 
0009   void PVCompute(TH1 * oldHisto , TH1 * newHisto , TText * te );
0010   void PVCompute(TH2 * oldHisto , TH2 * newHisto , TText * te );
0011   void PVCompute(TProfile * oldHisto , TProfile * newHisto , TText * te );
0012 
0013  private:
0014   
0015   Double_t mypv;
0016 
0017   TH1 * myoldHisto1;
0018   TH1 * mynewHisto1;
0019 
0020   TH2 * myoldHisto2;
0021   TH2 * mynewHisto2;
0022 
0023   TProfile * myoldProfile;
0024   TProfile * mynewProfile;
0025 
0026   TText * myte;
0027 
0028 };
0029 
0030 HistoCompare::PVCompute(TH1 * oldHisto , TH1 * newHisto , TText * te )
0031 {
0032 
0033   myoldHisto1 = oldHisto;
0034   mynewHisto1 = newHisto;
0035   myte = te;
0036 
0037   Double_t mypv = myoldHisto1->KolmogorovTest(mynewHisto1,"OUD");
0038 //  Double_t mypv = myoldHisto1->Chi2Test(mynewHisto1,"OU");
0039   std::strstream buf;
0040   std::string value;
0041   buf<<"PV="<<mypv<<std::endl;
0042   buf>>value;
0043   
0044   myte->DrawTextNDC(0.2,0.7, value.c_str());
0045 
0046   std::cout << "[OVAL] " << myoldHisto1->GetName() << " PV= "<< mypv <<std::endl;
0047   return;
0048 
0049 }
0050 
0051 HistoCompare::PVCompute(TH2 * oldHisto , TH2 * newHisto , TText * te )
0052 {
0053 
0054   myoldHisto2 = oldHisto;
0055   mynewHisto2 = newHisto;
0056   myte = te;
0057 
0058   Double_t mypv = myoldHisto2->Chi2Test(mynewHisto2,"OU");
0059   std::strstream buf;
0060   std::string value;
0061   buf<<"PV="<<mypv<<std::endl;
0062   buf>>value;
0063   
0064   myte->DrawTextNDC(0.2,0.7, value.c_str());
0065 
0066   std::cout << "[OVAL] " << myoldHisto2->GetName() << " PV = " << mypv << std::endl;
0067   return;
0068 
0069 }
0070 
0071 
0072 HistoCompare::PVCompute(TProfile * oldHisto , TProfile * newHisto , TText * te )
0073 {
0074 
0075   myoldProfile = oldHisto;
0076   mynewProfile = newHisto;
0077   myte = te;
0078 
0079   Double_t mypv = myoldProfile->Chi2Test(mynewProfile,"OU");
0080   std::strstream buf;
0081   std::string value;
0082   buf<<"PV="<<mypv<<std::endl;
0083   buf>>value;
0084   
0085   myte->DrawTextNDC(0.2,0.7, value.c_str());
0086 
0087   std::cout << "[OVAL] " << myoldProfile->GetName() << " PV = " << mypv << std::endl;
0088   return;
0089 
0090 }