Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 void DoCompare( char *Current, char *Reference=0 ){
0002 
0003  TText* te = new TText();
0004  te->SetTextSize(0.1);
0005  
0006  gROOT->ProcessLine(".x HistoCompare.C");
0007  HistoCompare * myPV = new HistoCompare();
0008 
0009  TFile * curfile = new TFile( TString(Current)+".root" );
0010  TFile * reffile = curfile;
0011  if (Reference) reffile = new TFile(TString(Reference)+".root");
0012 
0013 
0014  char * prefix="DQMData/MixingV/";
0015  //1-Dimension Histogram
0016  TDirectory * refDir=reffile->GetDirectory(prefix);
0017  TDirectory * curDir=curfile->GetDirectory(prefix);
0018  TList* list = refDir->GetListOfKeys();  
0019  TObject*  object = list->First();
0020  int iHisto = 0; char title[50];
0021  while (object) {
0022    // find histo objects
0023    TH1F * h1 = dynamic_cast<TH1F*>( refDir->Get(object->GetName()));
0024    TH1F * h2 = dynamic_cast<TH1F*>( curDir->Get(object->GetName()));
0025    bool isHisto = (refDir->Get(object->GetName()))->InheritsFrom("TH1F");
0026    if (isHisto && h1 && h2 && *h1->GetName()== *h2->GetName()) {
0027      iHisto++;
0028       char title[50];
0029       // draw and  compare
0030    TCanvas c1;
0031    TH1F htemp2;
0032    h2->Copy(htemp2);// to keep 2 distinct histos
0033 
0034    h1->SetLineColor(2);
0035    htemp2.SetLineColor(3);
0036    h1->SetLineStyle(3);
0037    htemp2.SetLineStyle(5);
0038    TLegend leg(0.1, 0.15, 0.2, 0.25);
0039    leg.AddEntry(h1, "Reference", "l");
0040    leg.AddEntry(&htemp2, "New ", "l");
0041 
0042    h1->Draw();
0043    htemp2.Draw("Same"); 
0044    leg.Draw();
0045    myPV->PVCompute(h1,&htemp2, te);
0046    sprintf(title,"%s%s", object->GetName(),".eps");
0047    c1.Print(title);
0048    }
0049    // go to next object
0050    object = list->After(object);
0051    }
0052 }
0053 
0054