-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathReadHisto.C
More file actions
executable file
·84 lines (60 loc) · 1.91 KB
/
Copy pathReadHisto.C
File metadata and controls
executable file
·84 lines (60 loc) · 1.91 KB
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
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <TFile.h>
#include <TMath.h>
#include <iostream>
#include <TGraphErrors.h>
#include <TGraphAsymmErrors.h>
// define the fitting function
void ReadHisto() {
TString hfolder = "TCuts_RunBCD_new/" ;
TString plotname = hfolder + "TriggerPhotonPt.png" ;
TString fName0 = "histo_trig_pho50.root" ;
TString fName1 = "histo_trig_gmsb.root" ;
TString fName2 = "histo_trig_gj80.root" ;
TFile *file0 = TFile::Open( hfolder+fName0 );
TFile *file1 = TFile::Open( hfolder+fName1 );
TFile *file2 = TFile::Open( hfolder+fName2 );
string hName = "h_gPt_trg" ;
TH1D* h_data = (TH1D *) file0->Get( hName.c_str() ) ;
TH1D* h_gmsb = (TH1D *) file1->Get( hName.c_str() ) ;
TH1D* h_gjet = (TH1D *) file2->Get( hName.c_str() ) ;
gStyle->SetOptStat("");
// Plot
TCanvas* c0 = new TCanvas("c0","", 800, 700);
c0->SetFillColor(10);
c0->SetFillColor(10);
// Style setup
gPad->SetGridx();
gPad->SetGridy();
c0->SetLeftMargin(0.15);
c0->SetRightMargin(0.12);
c0->SetTopMargin(0.1);
c0->SetBottomMargin(0.12);
c0->cd();
gStyle->SetOptStat(kFALSE);
c0->SetLogy() ;
// draw the histograms
h_data->GetXaxis()->SetTitle( " P_{T} GeV/c" );
h_data->SetLineColor(1) ;
h_data->SetLineWidth(2) ;
h_data->Draw() ;
h_gmsb->SetLineColor(2) ; // red
h_gmsb->SetLineWidth(2) ;
h_gmsb->DrawCopy("sames") ;
h_gjet->SetLineColor(4) ; // blue
h_gjet->SetLineWidth(2) ;
h_gjet->DrawCopy("sames") ;
// Set up Legend
TLegend* leg1 = new TLegend(.7, .7, .9, .9 );
leg1->Clear();
leg1->SetTextSize(0.03) ;
leg1->AddEntry( h_data, "Data", "L");
leg1->AddEntry( h_gmsb, "GMSB", "L");
leg1->AddEntry( h_gjet, "G+jets", "L");
leg1->Draw("SAME") ;
c0->Update();
c0->Print( plotname );
delete c0 ;
}