Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:33:57

0001 void DoCompare(char *Current, char *Reference=0) {
0002 
0003   static const int NPages = 6;
0004 
0005   TText* te = new TText();
0006   te->SetTextSize(0.1);
0007   
0008   gROOT->ProcessLine(".x HistoCompare.C");
0009   gStyle->SetCanvasColor(0);
0010   gStyle->SetOptStat(111111);
0011 
0012   HistoCompare * myPV = new HistoCompare();
0013   TFile * curfile = new TFile( TString(Current)+".root" );
0014   TFile * reffile = curfile;
0015   if (Reference) reffile = new TFile(TString(Reference)+".root");
0016 
0017   
0018   if (Reference) reffile->ls();
0019   curfile->ls();
0020 
0021 
0022   TCanvas* c1 = new TCanvas("c1","c1");
0023   c1->Divide(3,2); c1->cd(1); 
0024 
0025   TList* list = reffile->GetListOfKeys();  
0026   TObject*  object = list->First();
0027   int iHisto = 0; char title[50];
0028   while (object) {
0029     TH1F * h1 = dynamic_cast<TH1F*>( reffile->Get(object->GetName()));
0030     TH1F * h2 = dynamic_cast<TH1F*>( curfile->Get(object->GetName()));
0031     bool isHisto = (reffile->Get(object->GetName()))->InheritsFrom("TH1F");
0032 
0033     if (isHisto && h1 && h2 && *h1->GetName()== *h2->GetName()) {
0034       iHisto++;
0035       c1->cd( (iHisto-1) % NPages + 1);
0036       h1->SetLineColor(2);
0037       h1->SetLineStyle(3);
0038       h1->DrawCopy();
0039       if (Reference) {
0040         h2->SetLineColor(4);
0041         h2->SetLineStyle(5);
0042         h2->DrawCopy("Same"); 
0043         myPV->PVCompute(h1,h2, te);
0044       }
0045       if ((iHisto % NPages) == 0) {
0046         sprintf(title,"%s%s%d%s", Current, "_", iHisto/NPages-1, ".eps");
0047         c1->Print(title);
0048       }
0049     }
0050     if(Reference) delete h1;
0051     delete h2;
0052     object = list->After(object);
0053   }
0054   if ((iHisto % NPages) != 0) {
0055     sprintf(title,"%s%s%d%s", Current, "_", iHisto/NPages, ".eps");
0056     c1->Print(title);
0057   }
0058 
0059 }
0060