-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_jet_time_Plot_Overlay.py
507 lines (392 loc) · 13.8 KB
/
data_jet_time_Plot_Overlay.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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# This Simple Code Overlays Histograms Plots from Different Jet Multiplicity 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 ([email protected])
#!/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
textsize = 0.04
Lowlim = -30
Highlim = 30
ll = -30
lh = 30
# ROOT Plot Options***/
gROOT.Reset()
gROOT.Clear()
gROOT.SetStyle("Plain")
gROOT.SetBatch(kFALSE)
gStyle.SetOptTitle(0)
gStyle.SetOptStat(0)
gStyle.SetOptFit(0)
gStyle.SetStatX(.89)
gStyle.SetStatY(.89)
gStyle.SetStatBorderSize(0)
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.08,"xy")
gStyle.SetTitleOffset(1.2,"x")
gStyle.SetTitleOffset(1.8,"y")
gStyle.SetPadTopMargin(0.1)
gStyle.SetPadRightMargin(0.1)
gStyle.SetPadBottomMargin(0.16)
gStyle.SetPadLeftMargin(0.12)
gStyle.SetPadGridX(1)
gStyle.SetPadGridY(1)
TGaxis.SetMaxDigits(2) #// Set Axis to be of the form 0.11 10^N
# Get Files!
#---------------MET60Cut---------------------------
##----------------No--Met60Cut-------------------------
#f0 = TFile("LessThan3Jets_DP_All_Trig_NoJetID.root")
#f1 = TFile("MoreThan3Jets_DP_All_Trig_NoJetID.root")
#f2 = TFile("ALLJetsgmsbSum12cL140tau2000_DP_All_Trig_NoJetID.root")
#f3 = TFile("ALLJetsgmsbSum12cL140tau2000_DP_All_Trig_NoJetID.root")
#f4 = TFile("ALLJetsgmsbSum12cL140tau2000_DP_All_Trig_NoJetID.root")
#f5 = TFile("ALLJetsgmsbSum12cL140tau2000_DP_All_Trig_NoJetID.root")
f0 = TFile("Out_Put_gmsb6000mm_DP_gammaTriggger.root")
f1 = TFile("ALL_JET_Thesis_PLot-Displaced_Photon_outputfile.root")
f2 = TFile("Analysis_DPTrigger_Displaced_Photon_0_NJets_outputfile.root")
f3 = TFile("Analysis_DPTrigger_Displaced_Photon_1_NJets_outputfile.root")
f4 = TFile("Analysis_DPTrigger_Displaced_Photon_2_NJets_outputfile.root")
f5 = TFile("Analysis_DPTrigger_Displaced_Photon_3_NJets_outputfile.root")
# Seed Xtal Time
ph_time0 = f0.Get("NeutKin/my.h_Time")
ph_time1 = f1.Get("NeutKin/my.h_Time")
ph_time2 = f2.Get("NeutKin/my.h_Time")
ph_time3 = f3.Get("NeutKin/my.h_Time")
ph_time4 = f4.Get("NeutKin/my.h_Time")
ph_time5 = f5.Get("NeutKin/my.h_Time")
# my.WAveSeedBCphotime
Sbcph_time0 = f0.Get("NeutKin/my.WAveSeedBCphotime")
Sbcph_time1 = f1.Get("NeutKin/my.WAveSeedBCphotime")
Sbcph_time2 = f2.Get("NeutKin/my.WAveSeedBCphotime")
Sbcph_time3 = f3.Get("NeutKin/my.WAveSeedBCphotime")
Sbcph_time4 = f4.Get("NeutKin/my.WAveSeedBCphotime")
Sbcph_time5 = f5.Get("NeutKin/my.WAveSeedBCphotime")
#### Comparing ALL, EB Vs EE time
time_all = f1.Get("NeutKin/my.h_Time")
time_EB = f1.Get("NeutKin/my.pho_timeEB")
time_EE = f1.Get("NeutKin/my.pho_timeEE")
# my W.Ave SC photime Time
SCph_time0 = f0.Get("NeutKin/my.AveSCphotime")
SCph_time1 = f1.Get("NeutKin/my.AveSCphotime")
SCph_time2 = f2.Get("NeutKin/my.AveSCphotime")
SCph_time3 = f3.Get("NeutKin/my.AveSCphotime")
SCph_time4 = f4.Get("NeutKin/my.AveSCphotime")
SCph_time5 = f5.Get("NeutKin/my.AveSCphotime")
# For Seed Time
time_all.SetLineColor(1)
time_EB.SetLineColor(4)
time_EE.SetLineColor(2)
# Choose Line Colors
ph_time0.SetLineColor(9)
ph_time1.SetLineColor(1)
ph_time2.SetLineColor(2)
ph_time3.SetLineColor(28)
ph_time4.SetLineColor(6)
ph_time5.SetLineColor(8)
# Choose Line Style
time_all.SetLineStyle(2)
time_EB.SetLineStyle(8)
time_EE.SetLineStyle(1)
ph_time0.SetLineStyle(1)
ph_time1.SetLineStyle(2)
ph_time2.SetLineStyle(5)
ph_time3.SetLineStyle(9)
ph_time4.SetLineStyle(10)
ph_time5.SetLineStyle(3)
#Choose LineWidth
time_all.SetLineWidth(2)
time_EB.SetLineWidth(2)
time_EE.SetLineWidth(2)
ph_time0.SetLineWidth(2)
ph_time1.SetLineWidth(2)
ph_time2.SetLineWidth(2)
ph_time3.SetLineWidth(2)
ph_time4.SetLineWidth(2)
ph_time5.SetLineWidth(3)
#Choose Marker Style!
#ph_time0.SetMarkerStyle(2)
#ph_time1.SetMarkerStyle(3)
#ph_time2.SetMarkerStyle(4)
#ph_time3.SetMarkerStyle(23)
#ph_time4.SetMarkerStyle(33)
#ph_time5.SetMarkerStyle(34)
# Scale Histograms
#if ph_time0.Integral()!=0:
# ph_time0.Scale(1/ph_time0.Integral())
#if ph_time1.Integral()!=0:
# ph_time1.Scale(1/ph_time1.Integral())
#if ph_time2.Integral()!=0:
# ph_time2.Scale(1/ph_time2.Integral())
#if ph_time3.Integral()!=0:
# ph_time3.Scale(1/ph_time3.Integral())
#if ph_time4.Integral()!=0:
# ph_time4.Scale(1/ph_time4.Integral())
#if ph_time5.Integral()!=0:
# ph_time5.Scale(1/ph_time5.Integral())
# Label Axis
time_all.GetXaxis().SetTitle("ECAL Time[ns]")
time_all.GetYaxis().SetTitle("Entries")
time_all.GetXaxis().SetTitleOffset(1.4);
time_all.GetYaxis().SetTitleOffset(1.4);
time_all.GetXaxis().SetLabelSize(textsize);
time_all.GetYaxis().SetLabelSize(textsize);
ph_time1.GetXaxis().SetTitle("ECAL Time[ns]")
ph_time1.GetYaxis().SetTitle("Entries")
ph_time1.GetXaxis().SetTitleOffset(1.4);
ph_time1.GetYaxis().SetTitleOffset(1.4);
ph_time1.GetXaxis().SetLabelSize(textsize);
ph_time1.GetYaxis().SetLabelSize(textsize);
# For Seed BC Time
# Choose Line Colors
Sbcph_time0.SetLineColor(9)
Sbcph_time1.SetLineColor(1)
Sbcph_time2.SetLineColor(2)
Sbcph_time3.SetLineColor(28)
Sbcph_time4.SetLineColor(6)
Sbcph_time5.SetLineColor(8)
# Choose Line Style
Sbcph_time0.SetLineStyle(1)
Sbcph_time1.SetLineStyle(2)
Sbcph_time2.SetLineStyle(5)
Sbcph_time3.SetLineStyle(9)
Sbcph_time4.SetLineStyle(10)
Sbcph_time5.SetLineStyle(3)
#Choose LineWidth
Sbcph_time0.SetLineWidth(1)
Sbcph_time1.SetLineWidth(1)
Sbcph_time2.SetLineWidth(1)
Sbcph_time3.SetLineWidth(1)
Sbcph_time4.SetLineWidth(1)
Sbcph_time5.SetLineWidth(1)
#Choose Marker Style!
#Sbcph_time0.SetMarkerStyle(2)
#Sbcph_time1.SetMarkerStyle(3)
#Sbcph_time2.SetMarkerStyle(4)
#Sbcph_time3.SetMarkerStyle(23)
#Sbcph_time4.SetMarkerStyle(33)
#Sbcph_time5.SetMarkerStyle(34)
# Scale Histograms
if Sbcph_time0.Integral()!=0:
Sbcph_time0.Scale(1/Sbcph_time0.Integral())
if Sbcph_time1.Integral()!=0:
Sbcph_time1.Scale(1/Sbcph_time1.Integral())
if Sbcph_time2.Integral()!=0:
Sbcph_time2.Scale(1/Sbcph_time2.Integral())
if Sbcph_time3.Integral()!=0:
Sbcph_time3.Scale(1/Sbcph_time3.Integral())
if Sbcph_time4.Integral()!=0:
Sbcph_time4.Scale(1/Sbcph_time4.Integral())
if Sbcph_time5.Integral()!=0:
Sbcph_time5.Scale(1/Sbcph_time5.Integral())
# Label Axis
Sbcph_time1.GetXaxis().SetTitle("ECAL W. Ave Time [ns]")
Sbcph_time1.GetYaxis().SetTitle("Entries")
Sbcph_time1.GetXaxis().SetTitleOffset(1.4);
Sbcph_time1.GetYaxis().SetTitleOffset(1.4);
Sbcph_time1.GetXaxis().SetLabelSize(textsize);
Sbcph_time1.GetYaxis().SetLabelSize(textsize);
# For Seed Time
# Choose Line Colors
SCph_time0.SetLineColor(9)
SCph_time1.SetLineColor(1)
SCph_time2.SetLineColor(2)
SCph_time3.SetLineColor(28)
SCph_time4.SetLineColor(6)
SCph_time5.SetLineColor(3)
# Choose Line Style
SCph_time0.SetLineStyle(1)
SCph_time1.SetLineStyle(2)
SCph_time2.SetLineStyle(5)
SCph_time3.SetLineStyle(9)
SCph_time4.SetLineStyle(10)
SCph_time5.SetLineStyle(3)
#Choose LineWidth
SCph_time0.SetLineWidth(1)
SCph_time1.SetLineWidth(1)
SCph_time2.SetLineWidth(1)
SCph_time3.SetLineWidth(1)
SCph_time4.SetLineWidth(1)
SCph_time5.SetLineWidth(1)
#Choose Marker Style!
#SCph_time0.SetMarkerStyle(2)
#SCph_time1.SetMarkerStyle(3)
#SCph_time2.SetMarkerStyle(4)
#SCph_time3.SetMarkerStyle(23)
#SCph_time4.SetMarkerStyle(33)
#SCph_time5.SetMarkerStyle(34)
# Scale Histograms
if SCph_time0.Integral()!=0:
SCph_time0.Scale(1/SCph_time0.Integral())
if SCph_time1.Integral()!=0:
SCph_time1.Scale(1/SCph_time1.Integral())
if SCph_time2.Integral()!=0:
SCph_time2.Scale(1/SCph_time2.Integral())
if SCph_time3.Integral()!=0:
SCph_time3.Scale(1/SCph_time3.Integral())
if SCph_time4.Integral()!=0:
SCph_time4.Scale(1/SCph_time4.Integral())
if SCph_time5.Integral()!=0:
SCph_time5.Scale(1/SCph_time5.Integral())
# Label Axis
SCph_time1.GetXaxis().SetTitle("ECAL seed BC Time [ns]")
SCph_time1.GetYaxis().SetTitle("Entries")
SCph_time1.GetXaxis().SetTitleOffset(1.4);
SCph_time1.GetYaxis().SetTitleOffset(1.4);
SCph_time1.GetXaxis().SetLabelSize(textsize);
SCph_time1.GetYaxis().SetLabelSize(textsize);
# Draw Plots now
# ************************************************************************************
# Seed Xtal
c1 = TCanvas("c1", "Photon Time", 900, 900)
c1.cd()
ph_time1.SetTitle("Photon Time")
ph_time1.Draw()
ph_time0.Draw("sames")
ph_time2.Draw("sames")
ph_time3.Draw("sames")
ph_time4.Draw("sames")
ph_time5.Draw("sames")
ph_time1.GetXaxis().SetRangeUser(Lowlim, Highlim)
#Add Legend
leg1 = TLegend( 0.55, 0.70, 0.90, 0.90)
leg1.SetBorderSize(1)
leg1.SetFillColor(0)
leg1.AddEntry(ph_time1,"ALL Events ","l")
leg1.AddEntry(ph_time0,"MC #Lambda=180 TeV c#tau=6000 mm","l")
leg1.AddEntry(ph_time2,"0 Jet Only Events ","l")
leg1.AddEntry(ph_time3,"1 Jet Only Events ","l")
leg1.AddEntry(ph_time4,"2 Jets Only Events ","l")
leg1.AddEntry(ph_time5,"3 Jets Only Events ","l")
leg1.SetTextSize(0.02)
leg1.SetHeader("")
leg1.Draw()
## CMS Things
#s_lumi = "19.1"
s_lumi = ""
#CoMEr = "#sqrt{(S)} = 8 TeV"
CoMEr = "#sqrt{s} = 8 TeV"
#std::string lint = "#int Ldt= "+s_lumi+" fb^{-1}"
#std::string lint = s_lumi + "fb^{-1}"+ CoMEr
lint = s_lumi + CoMEr
cmstex = TLatex()
cmstex.SetTextAlign(12)
cmstex.SetTextSize(0.035)
cmstex.SetTextFont(22)
cmstex.SetTextAngle(0)
cmstex.SetTextColor(kBlack)
cmstex.SetNDC()
#cmstex.DrawLatex(0.155, 0.967, "CMS Preliminary");
#cmstex.DrawLatex(0.43, 0.967, CoMEr.c_str());
#cmstex.DrawLatex(0.75, 0.96, lint.c_str());
cmstex.DrawLatex(0.20, 0.865, "CMS");
cmstex.DrawLatex(0.20, 0.832, "Preliminary");
cmstex.DrawLatex(0.72, 0.920, lint);
# W. Ave Seed BC
c2 = TCanvas("c2", "Photon Time", 900, 900)
c2.cd()
Sbcph_time0.SetTitle("Photon(W .Ave Seed BC)Time Distribution")
Sbcph_time1.Draw()
Sbcph_time0.Draw("sames")
Sbcph_time2.Draw("sames")
Sbcph_time3.Draw("sames")
Sbcph_time4.Draw("sames")
Sbcph_time5.Draw("sames")
Sbcph_time1.GetXaxis().SetRangeUser(-30.0, 30.0)
#Add Legend
leg2 = TLegend( 0.55, 0.70, 0.90, 0.90)
leg2.SetBorderSize(1)
leg2.SetFillColor(0)
leg2.AddEntry(Sbcph_time1,"ALL Events ","l")
leg2.AddEntry(Sbcph_time0,"MC #Lambda=180 TeV c#tau=6000 mm","l")
leg2.AddEntry(Sbcph_time2,"0 Jet Only Events ","l")
leg2.AddEntry(Sbcph_time3,"1 Jets Only Events ","l")
leg2.AddEntry(Sbcph_time4,"2 Jets Only Events ","l")
leg2.AddEntry(Sbcph_time5,"3 Jets Only Events ","l")
leg2.SetTextSize(0.018)
leg2.SetHeader("Number of Jets")
leg2.Draw()
# SC Time
c3 = TCanvas("c3", "Photon Time", 900, 900)
c3.cd()
SCph_time1.SetTitle("Photon(W. Ave SC)Time Distribution")
SCph_time1.Draw()
SCph_time0.Draw("sames")
SCph_time2.Draw("sames")
SCph_time3.Draw("sames")
SCph_time4.Draw("sames")
SCph_time5.Draw("sames")
SCph_time1.GetXaxis().SetRangeUser(-30.0, 30.0)
#Add Legend
leg3 = TLegend( 0.55, 0.70, 0.90, 0.90)
leg3.SetBorderSize(1)
leg3.SetFillColor(0)
leg3.AddEntry(SCph_time1,"ALL Events ","l")
leg3.AddEntry(SCph_time0,"MC #Lambda=180 TeV c#tau=6000 mm ","l")
leg3.AddEntry(SCph_time2,"0 Jet Only Events ","l")
leg3.AddEntry(SCph_time3,"1 Jet Only Events ","l")
leg3.AddEntry(SCph_time4,"2 Jet Only Events ","l")
leg3.AddEntry(SCph_time5,"3 Jet Only Events ","l")
leg3.SetTextSize(0.018)
leg3.SetHeader("Number of Jets")
leg3.Draw()
c4 = TCanvas("c4", "Photon Time", 800, 800)
c4.cd()
time_all.SetTitle("Photon Time")
time_all.Draw()
time_EB.Draw("sames")
time_EE.Draw("sames")
time_all.GetXaxis().SetRangeUser(ll, lh)
#Add Legend
lg1 = TLegend( 0.60, 0.75, 0.90, 0.90)
lg1.SetBorderSize(1)
lg1.SetFillColor(0)
lg1.AddEntry(time_all,"ALL ECALL","l")
lg1.AddEntry(time_EB,"EB, |#eta| < 1.47","l")
lg1.AddEntry(time_EE,"EE, 1.47 < #eta < 3.0","l")
lg1.SetTextSize(0.029)
lg1.SetHeader("")
lg1.Draw()
Lint= s_lumi + CoMEr
cmstex1 = TLatex()
cmstex1.SetTextAlign(12)
cmstex1.SetTextSize(0.035)
cmstex1.SetTextFont(22)
cmstex1.SetTextAngle(0)
cmstex1.SetTextColor(kBlack)
cmstex1.SetNDC()
#cmstex1.DrawLatex(0.155, 0.967, "CMS Preliminary");
#cmstex1.DrawLatex(0.43, 0.967, CoMEr.c_str());
#cmstex1.DrawLatex(0.75, 0.96, lint.c_str());
cmstex1.DrawLatex(0.20, 0.865, "CMS");
cmstex1.DrawLatex(0.20, 0.832, "Preliminary");
cmstex1.DrawLatex(0.72, 0.920, Lint);
#_______________________ Save Plots_______________________#
gPad.SetLogy()
c1.SaveAs("/home/user1/norbert/public_html/ECALTiming/ZeeTimePerformance/ECAL-TIME-2013-2014/Photon_SeedXtalTime_Distribution_VsJetMultiplicity.png")
c1.SaveAs("/home/user1/norbert/public_html/ECALTiming/ZeeTimePerformance/ECAL-TIME-2013-2014/Photon_SeedXtalTime_Distribution_VsJetMultiplicity.pdf")
c1.SaveAs("/home/user1/norbert/public_html/ECALTiming/ZeeTimePerformance/ECAL-TIME-2013-2014/Photon_SeedXtalTime_Distribution_VsJetMultiplicity.eps")
gPad.SetLogy()
c2.SaveAs("Photon_W_AveSeedBCTime_Distribution_VsJetMultiplicity.png")
c2.SaveAs("Photon_W_AveSeedBCTime_Distribution_VsJetMultiplicity.pdf")
gPad.SetLogy()
c3.SaveAs("Photon_W_AveSCTime_Distribution_VsJetMultiplicity.png")
c3.SaveAs("Photon_W_AveSCTime_Distribution_VsJetMultiplicity.pdf")
gPad.SetLogy()
c4.SaveAs("/home/user1/norbert/public_html/ECALTiming/ZeeTimePerformance/ECAL-TIME-2013-2014/PhotonTimeALLVsEBVsEE.png")
c4.SaveAs("/home/user1/norbert/public_html/ECALTiming/ZeeTimePerformance/ECAL-TIME-2013-2014/PhotonTimeALLVsEBVsEE.pdf")
c4.SaveAs("/home/user1/norbert/public_html/ECALTiming/ZeeTimePerformance/ECAL-TIME-2013-2014/PhotonTimeALLVsEBVsEE.eps")