-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotTurnOn.C
84 lines (70 loc) · 1.93 KB
/
plotTurnOn.C
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
74
75
76
77
78
79
80
81
82
83
84
#include <TFile.h>
#include <TH1D.h>
#include <TCanvas.h>
#include <TGraphAsymmErrors.h>
#include <TLegend.h>
#include <TLine.h>
#include <iostream>
void plotTurnOn(TString inFileName, TString outFileTag)
{
TFile *inFile = TFile::Open(inFileName);
const Int_t THRESHOLDS = 4;
const Double_t L1_THRESHOLD[THRESHOLDS] = {16, 36, 52, 80};
const Int_t COLORS[THRESHOLDS] = {kBlack, kRed, kBlue, kGreen+3};//, kMagenta+3};
TGraphAsymmErrors *asymm[THRESHOLDS];//[2];
for(int i = 0; i < THRESHOLDS; i++)
{
//for(int j = 0; j < 2; j++)
{
asymm[i] = (TGraphAsymmErrors*)inFile->Get(Form("asymm_pt_%d_0",(int)L1_THRESHOLD[i]));
asymm[i]->SetMarkerColor(COLORS[i]);
asymm[i]->SetLineColor(COLORS[i]);
}
//asymm[i][1]->SetMarkerStyle(25);
}
// these values MUST MATCH those used in makeTurnOn.C
const int nBins = 75;
const double maxPt = 300;
TH1D *hEmpty = new TH1D("hEmpty",Form(";Jet p_{T} (GeV);Efficiency"),nBins,0,maxPt);
TCanvas *c1 = new TCanvas();
hEmpty->SetMinimum(0);
hEmpty->SetMaximum(1.2);
hEmpty->Draw();
//c1->SetLogy();
TLine *line = new TLine(0,1,maxPt,1);
line->Draw();
for(int i = 0; i < THRESHOLDS; i++)
{
//for(int j = 0; j < 2; j++)
{
asymm[i]->Draw("p");
}
}
TLegend *leg = new TLegend(0.55,0.2,0.9,0.5,"|#eta| < 2");
leg->SetFillColor(0);
leg->SetTextFont(42);
leg->SetTextSizePixels(18);
for(int i = 0; i < THRESHOLDS; i++)
{
//for(int j = 0; j < 2; j++)
{
leg->AddEntry(asymm[i], Form("L1_SingleJet%d", (int)L1_THRESHOLD[i]), "lp");
}
}
leg->Draw();
c1->SaveAs(Form("%s_turnon.pdf",outFileTag.Data()));
}
int main(int argc, char **argv)
{
if(argc == 3)
{
plotTurnOn(argv[1], argv[2]);
return 0;
}
else
{
std::cout << "Usage:\nplotTurnOn.exe <input_filename> <output_tag>" << std::cout;
std::cout << "An output pdf will be named <output_tag>_turnon.pdf" << std::cout;
return 1;
}
}