Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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 *res;
0038 
0039   Double_t mypv = myoldHisto1->Chi2Test(mynewHisto1,"UU",res);
0040   std::strstream buf;
0041   std::string value;
0042   buf<<"PV="<<mypv<<std::endl;
0043   buf>>value;
0044   
0045   myte->DrawTextNDC(0.2,0.7, value.c_str());
0046 
0047   std::cout << "[OVAL] " << myoldHisto1->GetName() << " PV = " << mypv << std::endl;
0048   return;
0049 
0050 }
0051 
0052 HistoCompare::PVCompute(TH2 * oldHisto , TH2 * newHisto , TText * te )
0053 {
0054 
0055   myoldHisto2 = oldHisto;
0056   mynewHisto2 = newHisto;
0057   myte = te;
0058 
0059   Double_t *res ;
0060   Double_t mypv = myoldHisto2->Chi2Test(mynewHisto2,"UU",res);
0061   std::strstream buf;
0062   std::string value;
0063   buf<<"PV="<<mypv<<std::endl;
0064   buf>>value;
0065   
0066   myte->DrawTextNDC(0.2,0.7, value.c_str());
0067 
0068   std::cout << "[OVAL] " << myoldHisto2->GetName() << " PV = " << mypv << std::endl;
0069   return;
0070 
0071 }
0072 
0073 
0074 HistoCompare::PVCompute(TProfile * oldHisto , TProfile * newHisto , TText * te )
0075 {
0076 
0077   myoldProfile = oldHisto;
0078   mynewProfile = newHisto;
0079   myte = te;
0080 
0081   Double_t *res ;
0082 
0083   Double_t mypv = myoldProfile->Chi2Test(mynewProfile,"UU",res);
0084   std::strstream buf;
0085   std::string value;
0086   buf<<"PV="<<mypv<<std::endl;
0087   buf>>value;
0088   
0089   myte->DrawTextNDC(0.2,0.7, value.c_str());
0090 
0091   std::cout << "[OVAL] " << myoldProfile->GetName() << " PV = " << mypv << std::endl;
0092   return;
0093 
0094 }