-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlotLayer.py
263 lines (214 loc) · 7.25 KB
/
PlotLayer.py
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# This Simple Code Overlays Histograms Plots from Different Files
# Cannot DO IT with C++ because It root chokes especially when Number bins are
# not the same.
## Aurthor Tambe E. Norbert a.k.a TEN (norbert@physics.umn.edu)
#!/usr/bin/env python
""" OverLay Myhist.png from several Directories identical structure!"""
__version__ = "1.0"
import sys
import optparse
import shutil
import os
import re
from ROOT import *
from array import array
# ROOT general options
gROOT.SetBatch(kTRUE)
gROOT.SetStyle("Plain")
gStyle.SetOptStat("emruo")
gStyle.SetCanvasColor(kWhite) # // background is no longer mouse-dropping white
gStyle.SetPalette(1) # // blue to red false color palette. Use 9 for b/w
gStyle.SetCanvasBorderMode(0) # // turn off canvas borders
gStyle.SetPadBorderMode(0)
gStyle.SetPaintTextFormat("5.2f") # // What precision to put numbers if plotted with "TEXT"
# // For publishing:
gStyle.SetLineWidth(2)
gStyle.SetTextSize(1.1)
gStyle.SetLabelSize(0.06,"xy")
gStyle.SetTitleSize(0.06,"xy")
gStyle.SetTitleOffset(1.2,"x")
gStyle.SetTitleOffset(1.0,"y")
#gStyle.SetPadTopMargin(0.1)
#gStyle.SetPadRightMargin(0.1)
gStyle.SetPadBottomMargin(0.16)
gStyle.SetPadLeftMargin(0.12)
# Get Files!
f1 = TFile("lessThan3JetsPhoton2011B.root")
f2 = TFile("MoreThan3JetsPhoton2011B.root")
f3 = TFile("MCgmsbctau250lambda100.root")
#Get input directories
#d1 = TDirectory("/afs/cern.ch/user/t/tambe/www/GMSBAnalysis/NJetsEffect/NewPlotsMay22/MoreThan3Jets","","",)
#d2 = TDirectory("/afs/cern.ch/user/t/tambe/www/GMSBAnalysis/NJetsEffect/NewPlotsMay22/LessThan3Jets","","",)
#d3 = TDirectory("/afs/cern.ch/user/t/tambe/www/GMSBAnalysis/NJetsEffect/NewPlotsMay22/GmsB250cmMC","","",)
ph_time1 = f1.Get("NeutKin/h_Time")
ph_time2 = f2.Get("NeutKin/h_Time")
ph_time3 = f3.Get("NeutKin/h_Time")
#Event Met
evt_met1 = f1.Get("NeutKin/evt_met")
evt_met2 = f2.Get("NeutKin/evt_met")
evt_met3 = f3.Get("NeutKin/evt_met")
# Mean Time
#tA_EE_low6 = f6.Get("single-bias/timeVsAoSigmaHighEElog_1")
#tA_EE_low7 = f7.Get("single-bias/timeVsAoSigmaHighEElog_1")
# Sigma of Time
#sA_EE_low4 = f4.Get("single-bias/timeVsAoSigmaHighEElog_2")
#sA_EE_low5 = f5.Get("single-bias/timeVsAoSigmaHighEElog_2")
#sA_EE_low6 = f6.Get("single-bias/timeVsAoSigmaHighEElog_2")
#sA_EE_low7 = f7.Get("single-bias/timeVsAoSigmaHighEElog_2")
# Choose Line Colors
ph_time1.SetLineColor(6)
ph_time2.SetLineColor(9)
ph_time3.SetLineColor(12)
evt_met1.SetLineColor(6)
evt_met2.SetLineColor(9)
evt_met3.SetLineColor(12)
ph_time1.SetLineWidth(1)
ph_time2.SetLineWidth(2)
ph_time3.SetLineWidth(3)
evt_met1.SetLineWidth(1)
evt_met2.SetLineWidth(2)
evt_met3.SetLineWidth(3)
#sA_EE_low3.SetLineColor(4)
#sA_EE_low4.SetLineColor(5)
#sA_EE_low5.SetLineColor(6)
#sA_EE_low6.SetLineColor(7)
#sA_EE_low7.SetLineColor(8)
# Choose Fill Colors
#ph_time1.SetFillColor(6)
#ph_time2.SetFillColor(9)
#ph_time3.SetFillColor(12)
#evt_met1.SetFillColor(6)
#evt_met2.SetFillColor(9)
#evt_met3.SetFillColor(12)
#tA_EBMod4.SetFillColor(1)
#tA_EE_low1.SetFillColor(2)
#tA_EE_low2.SetFillColor(3)
#tA_EE_low3.SetFillColor(4)
#tA_EE_low4.SetFillColor(5)
#tA_EE_low5.SetFillColor(6)
#tA_EE_low6.SetFillColor(7)
#tA_EE_low7.SetFillColor(8)
#sA_EBMod4.SetFillColor(1)
#sA_EE_low1.SetFillColor(2)
#sA_EE_low2.SetFillColor(3)
#sA_EE_low3.SetFillColor(4)
#sA_EE_low4.SetFillColor(5)
#sA_EE_low5.SetFillColor(6)
#sA_EE_low6.SetFillColor(7)
#sA_EE_low7.SetFillColor(8)
#Choose Marker Style!
ph_time1.SetMarkerStyle(6)
ph_time2.SetMarkerStyle(9)
ph_time3.SetMarkerStyle(12)
evt_met1.SetMarkerStyle(6)
evt_met2.SetMarkerStyle(9)
evt_met3.SetMarkerStyle(12)
#tA_EBMod4.SetMarkerStyle(1)
#tA_EE_low1.SetMarkerStyle(2)
#tA_EE_low2.SetMarkerStyle(3)
#tA_EE_low3.SetMarkerStyle(4)
#tA_EE_low4.SetMarkerStyle(5)
#tA_EE_low5.SetMarkerStyle(6)
#tA_EE_low6.SetMarkerStyle(7)
#tA_EE_low7.SetMarkerStyle(8)
#SIgma
#sA_EBMod4.SetMarkerStyle(1)
#sA_EE_low1.SetMarkerStyle(2)
#sA_EE_low2.SetMarkerStyle(3)
#sA_EE_low3.SetMarkerStyle(4)
#sA_EE_low4.SetMarkerStyle(5)
#sA_EE_low5.SetMarkerStyle(6)
#sA_EE_low6.SetMarkerStyle(7)
#sA_EE_low7.SetMarkerStyle(8)
#SetMaxRange XY Axis
#tA_EBMod4.GetYaxis().SetRangeUser(-1.0,0.4)
#tA_EBMod4.GetXaxis().SetRangeUser(0.0,10000.0)
ph_time1.GetXaxis().SetTitle("Photon Time(ns)")
ph_time1.GetYaxis().SetTitle("Event Number")
evt_met1.GetXaxis().SetTitle("MET(GeV)")
evt_met2.GetYaxis().SetTitle("Event Number")
#sA_EBMod4.GetYaxis().SetRangeUser(0.0,3.5)
#sA_EBMod4.GetXaxis().SetRangeUser(0.0,10000.0)
#sA_EBMod4.GetXaxis().SetTitle("Amplitude(ADC Counts)")
#sA_EBMod4.GetYaxis().SetTitle("#sigma Time(ns)")
# Draw Plots now
# *************************************************************************************
c1 = TCanvas("c1", "Photon Time", 800, 800)
c1.cd()
# ht->GetXaxis()->SetTitle("Energy(GeV)");
# ht->GetYaxis()->SetTitle("Mean Time(ns)");
# ht->GetYaxis()->SetRangeUser(-0.8,0.3);
# ht->GetXaxis()->SetRangeUser(0, 10000);
ph_time1.SetTitle("Photon Time Distribution")
#tA_EBMod4.SetTitle("Mean Time Vs Amplitude Stability")
ph_time1.Draw()
ph_time2.Draw("sames")
ph_time3.Draw("sames")
#tA_EBMod4.Draw()
#tA_EE_low1.Draw("sames")
#tA_EE_low2.Draw("sames")
#tA_EE_low3.Draw("sames")
#tA_EE_low4.Draw("sames")
#tA_EE_low5.Draw("sames")
#tA_EE_low6.Draw("sames")
#tA_EE_low7.Draw("sames")
#Add Legend
leg1 = TLegend( 0.14, 0.70, 0.47, 0.90)
leg1.SetBorderSize(1)
leg1.SetFillColor(0)
leg1.AddEntry(ph_time1,"< 3Jets + VLIso#gamma + MET>30GeV","l")
leg1.AddEntry(ph_time2,">= 3Jets + VLIso#gamma + MET>30GeV","l")
leg1.AddEntry(ph_time3,"GMSB-c#tau=250mm-#Lambda=100TeV","l")
leg1.SetTextSize(0.018)
leg1.SetHeader("Samples")
#leg1.AddEntry(tA_EE_low3,"1.9 <|#eta|<2.2","l")
#leg1.AddEntry(tA_EE_low4,"2.2 <|#eta|<2.4","l")
#leg1.AddEntry(tA_EE_low5,"2.4 <|#eta|<2.6","l")
#leg1.AddEntry(tA_EE_low6,"2.6 <|#eta|<2.8","l")
#leg1.AddEntry(tA_EE_low7,"2.8 <|#eta|<3.0","l")
leg1.Draw()
# Use for MET Plot
c2 = TCanvas ( "c2", "Sigma Time Stability", 800, 800)
c2.cd()
# ht->GetXaxis()->SetTitle("Energy(GeV)");
# ht->GetYaxis()->SetTitle("#sigma Time(ns)");
# ht->GetYaxis()->SetRangeUser(0,3.5);
# ht->GetXaxis()->SetRangeUser(0, 10000);
evt_met1.SetTitle("Missing Energy Distribution")
evt_met1.Draw()
evt_met2.Draw("sames")
evt_met3.Draw("sames")
#sA_EE_low3.Draw("sames")
#sA_EE_low4.Draw("sames")
#sA_EE_low5.Draw("sames")
#sA_EE_low6.Draw("sames")
#sA_EE_low7.Draw("sames")
# Add Legend
#Add Legend
leg2 = TLegend( 0.35, 0.55, 0.73, 0.77)
leg2.SetBorderSize(1)
leg2.SetFillColor(0)
leg2.AddEntry(evt_met1,"< 3Jets + VLIso#gamma + MET>30GeV","l")
leg2.AddEntry(evt_met2,">= 3Jets + VLIso#gamma + MET>30GeV","l")
leg2.AddEntry(evt_met3,"GMSB-c#tau=250mm-#Lambda=100TeV","l")
leg2.SetHeader("Samples")
leg2.SetTextSize(0.02)
#leg2 = TLegend( 0.8, 0.55, 0.98,0.77)
#leg2.SetBorderSize(1)
#leg2.SetFillColor(0)
#leg2.AddEntry(sA_EBMod4,"EB Mod4","l")
#leg2.AddEntry(sA_EE_low1,"1.5 <|#eta|<1.7","l")
#leg2.AddEntry(sA_EE_low2,"1.7 <|#eta|<1.9","l")
#leg2.AddEntry(sA_EE_low3,"1.9 <|#eta|<2.2","l")
#leg2.AddEntry(sA_EE_low4,"2.2 <|#eta|<2.4","l")
#leg2.AddEntry(sA_EE_low5,"2.4 <|#eta|<2.6","l")
#leg2.AddEntry(sA_EE_low6,"2.6 <|#eta|<2.8","l")
#leg2.AddEntry(sA_EE_low7,"2.8 <|#eta|<3.0","l")
leg2.Draw()
# Save Plots
c1.SaveAs("PhotonTimeComparing.png")
c1.SetLogy(1)
c1.SaveAs("LogPhotonTimeComparing.png")
c2.SaveAs("EventMet.png")
c2.SetLogy(1)
c2.SaveAs("LogEventMet.png")