Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:05

0001 
0002 
0003 #include <TH1F.h>
0004 #include <TGraphAsymmErrors.h>
0005 #include <TMath.h>
0006 #include <TMatrixD.h>
0007 #include <TVectorD.h>
0008 #include <TArrayD.h>
0009 #include <TString.h>
0010 #include <TCanvas.h>
0011 #include <TPostScript.h>
0012 #include <TPaveText.h>
0013 #include <iostream>
0014 
0015 void drawEfficiency(TString histogramTitle, TGraphAsymmErrors* graph, TString xAxisTitle, TH1F* hDummy,TCanvas* canvas, TPaveText* Text, TString loglinearscale="LinearScale", double Minimum=0.)
0016 { 
0017 
0018   hDummy->SetStats(false);
0019   hDummy->SetTitle(histogramTitle);
0020   hDummy->SetMinimum(Minimum);
0021   hDummy->SetMaximum(1.2);
0022   hDummy->GetXaxis()->SetTitle(xAxisTitle);
0023   hDummy->GetYaxis()->CenterTitle();
0024   hDummy->GetYaxis()->SetTitle("Efficiency");
0025   hDummy->Reset();
0026   if ( loglinearscale.CompareTo("LogScale")==0) {
0027     if (Minimum<0.00001) Minimum = 0.001;
0028     hDummy->SetMinimum(Minimum);
0029     hDummy->SetMaximum(3.0);
0030     canvas->SetLogy();
0031   }
0032   hDummy->Draw("p");
0033   graph->SetMarkerStyle(20);
0034   graph->SetMarkerSize(1);
0035   graph->SetMarkerColor(1);
0036   if ( Text ) Text->Draw();
0037   canvas->Update();
0038   graph->Draw("p");  
0039   canvas->Update();
0040   canvas->Print(TString(canvas->GetTitle()).Append(".gif"),"gif");
0041   
0042 }