1 |
from ROOT import *
|
2 |
import sys
|
3 |
import os
|
4 |
import sys
|
5 |
|
6 |
# CMS Style
|
7 |
if os.path.isfile('tdrstyle.C'):
|
8 |
gROOT.ProcessLine('.L tdrstyle.C')
|
9 |
ROOT.setTDRStyle()
|
10 |
print "Found tdrstyle.C file, using this style."
|
11 |
HasCMSStyle = True
|
12 |
if os.path.isfile('CMSTopStyle.cc'):
|
13 |
gROOT.ProcessLine('.L CMSTopStyle.cc+')
|
14 |
style = CMSTopStyle()
|
15 |
style.setupDefault()
|
16 |
print "Found CMSTopStyle.cc file, use TOP style if requested in xml file."
|
17 |
|
18 |
gROOT.SetBatch()
|
19 |
|
20 |
filename = sys.argv[1] #'mu_templates.root'
|
21 |
file = TFile(filename)
|
22 |
|
23 |
sample = sys.argv[2]
|
24 |
systname = sys.argv[3]
|
25 |
variable = sys.argv[4]
|
26 |
|
27 |
#SF_Wbb = 1.21
|
28 |
#SF_Wcc = 1.66
|
29 |
#SF_Wqq = 1.
|
30 |
|
31 |
#outfile = TFile(filename,"RECREATE")
|
32 |
|
33 |
file.cd()
|
34 |
list = file.GetListOfKeys()
|
35 |
|
36 |
hbb = {}
|
37 |
#hcc = {}
|
38 |
#hqq = {}
|
39 |
|
40 |
for key in list:
|
41 |
file.cd()
|
42 |
#print "key name "+key.GetName()
|
43 |
#print "name = "+ key.GetName() +" title = "+ key.GetTitle()
|
44 |
name = key.GetName()
|
45 |
#print "key name = " + name
|
46 |
obj = file.Get(name)
|
47 |
#obj.SetName( key.GetName() )
|
48 |
#print "obj name = "+ obj.GetName() +" title = "+ obj.GetTitle()
|
49 |
if name =="mu_"+variable+"__"+sample:
|
50 |
hbb['nominal'] = obj
|
51 |
if name == "mu_"+variable+"__"+sample+"__"+systname+"__plus":
|
52 |
hbb['plus'] = obj
|
53 |
if name == "mu_"+variable+"__"+sample+"__"+systname+"__minus":
|
54 |
hbb['minus'] = obj
|
55 |
|
56 |
#if name.find("mu1allb_mass__wqq") !=-1: obj.Scale( SF_Wqq)
|
57 |
#outfile.cd()
|
58 |
#obj.Write()
|
59 |
|
60 |
|
61 |
|
62 |
cbb = TCanvas("cbb","cbb",700,700)
|
63 |
hbb['plus'].SetLineColor(2)
|
64 |
hbb['nominal'].SetLineColor(1)
|
65 |
hbb['minus'].SetLineColor(4)
|
66 |
hbb['plus'].SetMarkerColor(2)
|
67 |
hbb['nominal'].SetMarkerColor(1)
|
68 |
hbb['minus'].SetMarkerColor(4)
|
69 |
hbb['plus'].SetMarkerStyle(2)
|
70 |
hbb['nominal'].SetMarkerStyle(2)
|
71 |
hbb['minus'].SetMarkerStyle(2)
|
72 |
hbb['plus'].GetYaxis().SetTitle("Unit Area")
|
73 |
|
74 |
hbb['plus'].DrawNormalized()
|
75 |
hbb['nominal'].DrawNormalized("same")
|
76 |
hbb['minus'].DrawNormalized("same")
|
77 |
|
78 |
|
79 |
aleg = TLegend(0.6,0.65,0.93,0.93)
|
80 |
SetOwnership( aleg, 0 )
|
81 |
aleg.SetHeader("#splitline{CMS 2011 Simulation}{"+sample+" "+systname+" syst.}")
|
82 |
aleg.SetMargin(0.12)
|
83 |
aleg.SetTextSize(0.035)
|
84 |
aleg.SetFillColor(0)
|
85 |
aleg.SetFillStyle(0)
|
86 |
aleg.SetBorderSize(0)
|
87 |
|
88 |
aleg.AddEntry(hbb['plus'],"plus","PL")
|
89 |
aleg.AddEntry(hbb['nominal'],"nominal","PL")
|
90 |
aleg.AddEntry(hbb['minus'],"minus","PL")
|
91 |
aleg.Draw()
|
92 |
|
93 |
cbb.Print(sample+"_"+variable+"_"+systname+"_syst.pdf")
|
94 |
|
95 |
#sigma_bb = 0.28
|
96 |
#sigma_cc = 0.06
|
97 |
#sigma_qq = 0.5
|
98 |
#outfile.Close()
|
99 |
#os.system('rm tmp_'+filename)
|
100 |
|
101 |
raw_input ("Enter to quit:")
|