Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:32:30

0001 // Compare the histograms from the ECAL TPG validation 
0002 void displayHistos( char *Current, char *Reference=0 ){
0003 
0004  TText* te = new TText();
0005  te->SetTextSize(0.1);
0006  
0007  TFile * curfile = new TFile( TString(Current)+".root" );
0008 
0009  //1-Dimension Histogram
0010  TList* list = curfile->GetListOfKeys();
0011  TObject*  object = list->First();
0012  int iHisto = 0; char title[50];
0013  while (object) {
0014    iHisto++;
0015    
0016    // find histo objects
0017    std::cout << " Histo number = " << iHisto << " object :" << object->GetName() << std::endl;
0018    TH1I * h1 = dynamic_cast<TH1I*>( curfile->Get(object->GetName()));
0019 
0020      char titleHisto[50]; 
0021      char title[50];
0022      // draw and  compare
0023      std::cout << " Start draw and save the histograms" << std::endl;
0024      TCanvas c1;
0025      c1.SetFillColor(0);
0026      c1.SetFrameFillColor(0);
0027    
0028      h1->SetLineColor(2);
0029      h1->SetLineStyle(1);
0030      h1->SetLineWidth(3);
0031      h1->SetMarkerColor(3);
0032      
0033      if (iHisto == 1 || iHisto == 4) 
0034         sprintf(titleHisto,"%s [ADC units]",object->GetName());
0035      else
0036         sprintf(titleHisto,"%s",object->GetName());
0037      h1->GetXaxis()->SetTitle(titleHisto);
0038      h1->SetTitle("TPG validation for the 326 release");
0039      //TLegend leg(0.6,0.7,0.8,0.9);
0040      //leg.AddEntry(h1, "Validation of the 320 release", "l");
0041 
0042      h1->Draw();
0043      //leg.Draw();
0044      c1.SetLogy();
0045      
0046      
0047      sprintf(title,"%s%s", object->GetName(),".gif");
0048      c1.Print(title);
0049    
0050     // go to next object
0051     object = list->After(object);
0052    }
0053 }