Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:59

0001 
0002 #include <TH1F.h>
0003 #include <TGraphAsymmErrors.h>
0004 #include <TMath.h>
0005 #include <TMatrixD.h>
0006 #include <TVectorD.h>
0007 #include <TArrayD.h>
0008 #include <TString.h>
0009 #include <TCanvas.h>
0010 #include <TPostScript.h>
0011 #include <TLegend.h>
0012 #include <TPaveText.h>
0013 
0014 void drawEfficiencies(TString histogramTitle, TGraphAsymmErrors* graph1,  TGraphAsymmErrors* graph2, TGraphAsymmErrors* graph3, TGraphAsymmErrors* graph4, TString xAxisTitle, TH1F* hDummy,TCanvas* canvas, TPaveText* Text, TString PForCalo, TString loglinearscale="LinearScale", double Minimum=0.)
0015 { 
0016 
0017   hDummy->SetStats(false);
0018   hDummy->SetTitle(histogramTitle);
0019   hDummy->SetMinimum(Minimum);
0020   hDummy->SetMaximum(1.2);
0021   hDummy->GetXaxis()->SetTitle(xAxisTitle);
0022   hDummy->GetYaxis()->CenterTitle();
0023   hDummy->GetYaxis()->SetTitle("Efficiency");
0024   hDummy->Reset();
0025   if ( loglinearscale.CompareTo("LogScale")==0) {
0026     if (Minimum<0.00001) Minimum = 0.001;
0027     hDummy->SetMinimum(Minimum);
0028     hDummy->SetMaximum(3.0);
0029     canvas->SetLogy();
0030   }
0031 
0032   hDummy->Draw("p");
0033   graph1->SetMarkerStyle(20);
0034   graph1->SetMarkerSize(1);
0035   if ( Text ) Text->Draw();
0036   canvas->Update();
0037   graph1->Draw("p");
0038   canvas->Update();
0039   graph2->SetMarkerStyle(20);
0040   graph2->SetMarkerSize(1);  
0041   graph2->SetMarkerColor(2);  
0042   graph2->Draw("p");
0043   canvas->Update();
0044   graph3->SetMarkerStyle(20);
0045   graph3->SetMarkerSize(1);  
0046   graph3->SetMarkerColor(4);  
0047   graph3->Draw("p");
0048   canvas->Update();
0049   graph4->SetMarkerStyle(20);
0050   graph4->SetMarkerSize(1);  
0051   graph4->SetMarkerColor(3);  
0052   graph4->Draw("p");
0053 
0054   //  graph3->SetMarkerColor();
0055 
0056   TLegend* legend;
0057   legend = new TLegend(0.1, 0.84, 0.5, 0.94);
0058   if ( PForCalo.CompareTo("Calo")==0) {
0059     legend->AddEntry(graph1, "Jet Matching Efficiency", "p");
0060     legend->AddEntry(graph2, "Jet + Leading Track Efficiency","p");
0061     legend->AddEntry(graph3, "Track Isolation Efficiency", "p");
0062     legend->AddEntry(graph4, "Ecal Isolation Efficiency", "p");
0063   }
0064   if (PForCalo.CompareTo("PFTaus")==0) {
0065     legend->AddEntry(graph1, "PFTau Matching Efficiency", "p");
0066     legend->AddEntry(graph2, "PFTau + LeadingChargedHadron Efficiency","p");
0067     legend->AddEntry(graph3, "No Charged Hadrons Isolation", "p");
0068     legend->AddEntry(graph4, "No Gammas Isolation", "p");
0069   }
0070   legend->Draw();
0071   canvas->Update();
0072   canvas->Print(TString(canvas->GetTitle()).Append(".gif"),"gif");
0073 }