1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#include <TH1F.h>
#include <TGraphAsymmErrors.h>
#include <TMath.h>
#include <TMatrixD.h>
#include <TVectorD.h>
#include <TArrayD.h>
#include <TString.h>
#include <TCanvas.h>
#include <TPostScript.h>
#include <TLegend.h>
#include <TPaveText.h>
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.)
{
hDummy->SetStats(false);
hDummy->SetTitle(histogramTitle);
hDummy->SetMinimum(Minimum);
hDummy->SetMaximum(1.2);
hDummy->GetXaxis()->SetTitle(xAxisTitle);
hDummy->GetYaxis()->CenterTitle();
hDummy->GetYaxis()->SetTitle("Efficiency");
hDummy->Reset();
if ( loglinearscale.CompareTo("LogScale")==0) {
if (Minimum<0.00001) Minimum = 0.001;
hDummy->SetMinimum(Minimum);
hDummy->SetMaximum(3.0);
canvas->SetLogy();
}
hDummy->Draw("p");
graph1->SetMarkerStyle(20);
graph1->SetMarkerSize(1);
if ( Text ) Text->Draw();
canvas->Update();
graph1->Draw("p");
canvas->Update();
graph2->SetMarkerStyle(20);
graph2->SetMarkerSize(1);
graph2->SetMarkerColor(2);
graph2->Draw("p");
canvas->Update();
graph3->SetMarkerStyle(20);
graph3->SetMarkerSize(1);
graph3->SetMarkerColor(4);
graph3->Draw("p");
canvas->Update();
graph4->SetMarkerStyle(20);
graph4->SetMarkerSize(1);
graph4->SetMarkerColor(3);
graph4->Draw("p");
// graph3->SetMarkerColor();
TLegend* legend;
legend = new TLegend(0.1, 0.84, 0.5, 0.94);
if ( PForCalo.CompareTo("Calo")==0) {
legend->AddEntry(graph1, "Jet Matching Efficiency", "p");
legend->AddEntry(graph2, "Jet + Leading Track Efficiency","p");
legend->AddEntry(graph3, "Track Isolation Efficiency", "p");
legend->AddEntry(graph4, "Ecal Isolation Efficiency", "p");
}
if (PForCalo.CompareTo("PFTaus")==0) {
legend->AddEntry(graph1, "PFTau Matching Efficiency", "p");
legend->AddEntry(graph2, "PFTau + LeadingChargedHadron Efficiency","p");
legend->AddEntry(graph3, "No Charged Hadrons Isolation", "p");
legend->AddEntry(graph4, "No Gammas Isolation", "p");
}
legend->Draw();
canvas->Update();
canvas->Print(TString(canvas->GetTitle()).Append(".gif"),"gif");
}
|