Fork me on GitHub

Ticket #1168: JetPlot.C

File JetPlot.C, 3.4 KB (added by Goko, 7 years ago)
Line 
1
2TCanvas *EventProfile;
3
4void JetPlot(Char_t *cFileNameZS="Wplus1Jet_PYTHIA6_ATLAS_cteq6l1_delphes_events_all.root",Char_t *cFileNameNZS="Wplus1Jet_PYTHIA8_ATLAS_cteq6l1_delphes_events_all.root",Char_t *cPrefix="Overlap"){
5
6
7 gROOT->SetStyle("Plain");
8 gStyle->SetOptTitle(1);
9 gStyle->SetOptStat(0);
10 gStyle->SetStatFont(40);
11 gStyle->SetTitleFont(40);
12 gStyle->SetStatX(0.98);
13 gStyle->SetStatY(0.99);
14 gStyle->SetStatH(0.45);
15 gStyle->SetStatW(0.2);
16 gStyle->SetTitleBorderSize(0);
17 gStyle->SetStatBorderSize(0);
18 gStyle->SetStatFontSize(0.06);
19 gStyle->SetTitleSize(0.06);
20 gStyle->SetStatTextColor(2);
21 gStyle->SetStatColor(0);
22 gStyle->SetStatStyle(0);
23 gStyle->SetPalette(1);
24 gSystem->Load("/home/yl1/MG5_aMC_v2_5_3/Delphes/libDelphes.so");
25
26 EventProfile = new TCanvas("CanResponse","CanResponse",400,400);
27 EventProfile->SetFillColor(0);
28 EventProfile->SetBorderMode(0);
29 EventProfile->SetBorderSize(0);
30 EventProfile->SetTickx();
31 EventProfile->SetTicky();
32 EventProfile->SetLeftMargin(0.18);
33 EventProfile->SetRightMargin(0.06);
34 EventProfile->SetTopMargin(0.06);
35 EventProfile->SetBottomMargin(0.18 );
36 EventProfile->SetFrameBorderMode(0);
37 EventProfile->SetFrameBorderSize(0);
38
39
40
41
42
43 TFile *fRecHitZS=new TFile(cFileNameZS);
44 fRecHitZS->ls();
45 fRecHitZS->cd("Delphes");
46 TH1F *E1_ZS=(TH1F*)gDirectory->Get("Delphes")->Clone("E1_ZS");
47
48
49
50
51 TFile *fRecHitNZS=new TFile(cFileNameNZS);
52 fRecHitNZS->ls();
53 fRecHitNZS->cd("Delphes");
54 TH1F *E1_NZS=(TH1F*)gDirectory->Get("Delphes")->Clone("E1_NZS");
55
56
57
58 SavePlot(E1_ZS,E1_NZS,"PFJet Eta AK7 Without Any Cut","JetEta",cPrefix);
59
60
61
62 fRecHitZS->Close();
63 fRecHitNZS->Close();
64
65
66}
67
68
69
70void SavePlot(TH1F *hTempZS,TH1F *hTempNZS,Char_t *cHistTitle,Char_t *cSubDec,Char_t *cPrefix){
71
72 EventProfile->SetLogy(kFALSE);
73 EventProfile->SetLeftMargin(0.18);
74 hTempNZS->GetYaxis()->CenterTitle();
75 hTempNZS->GetXaxis()->CenterTitle();
76 hTempNZS->GetYaxis()->SetTitleFont(42);
77 hTempNZS->GetXaxis()->SetTitleFont(42);
78 hTempNZS->GetYaxis()->SetTitleSize(0.06);
79 hTempNZS->GetYaxis()->SetTitleOffset(1.5);
80 hTempNZS->GetXaxis()->SetTitleSize(0.06);
81 hTempNZS->GetYaxis()->SetLabelFont(42);
82 hTempNZS->GetXaxis()->SetLabelFont(42);
83 hTempNZS->GetYaxis()->SetLabelSize(0.055);
84 hTempNZS->GetXaxis()->SetLabelSize(0.055);
85 hTempNZS->GetYaxis()->SetDecimals();
86 hTempNZS->GetXaxis()->SetDecimals();
87 hTempNZS->GetXaxis()->SetNdivisions(505);
88 hTempNZS->SetTitle(cHistTitle);
89 hTempNZS->GetXaxis()->SetTitle("Jet #eta");
90 hTempNZS->SetMarkerStyle(21);
91 hTempNZS->SetMarkerSize(0.75);
92 hTempNZS->SetMarkerColor(2);
93
94
95
96 hTempZS->SetMarkerStyle(20);
97 hTempZS->SetMarkerColor(1);
98 hTempZS->SetLineColor(1);
99 hTempZS->SetMarkerSize(0.75);
100
101
102
103
104
105 hTempNZS->SetFillColor(kRed);
106 hTempNZS->DrawCopy("");
107 hTempZS->DrawCopy("sameP");
108
109
110
111 Char_t cTemp[200];
112 sprintf(cTemp,"ETA/%s_%s.gif",cPrefix,cSubDec);
113
114 EventProfile->Print(cTemp,"gif");
115 EventProfile->SetLogy();
116
117
118 EventProfile->SetLeftMargin(0.1);
119 hTempNZS->SetFillColor(kRed);
120 hTempNZS->DrawCopy("");
121 hTempZS->DrawCopy("sameP");
122
123 leg->Draw();
124
125 sprintf(cTemp,"ETA/%s_%s_Log.gif",cPrefix,cSubDec);
126 EventProfile->Print(cTemp,"gif");
127
128}