ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/algomez/FourTop/TreeAnalyzer/test/plotNjets.py
Revision: 1.1
Committed: Mon Nov 5 01:25:16 2012 UTC (12 years, 6 months ago) by algomez
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
Log Message:
*** empty log message ***

File Contents

# Content
1 from ROOT import *
2 import sys
3 import os
4 import sys
5 gROOT.SetStyle("Plain")
6 gStyle.SetOptStat(0)
7 gStyle.SetHistFillColor(kWhite)
8
9 # CMS Style
10 if os.path.isfile('tdrstyle.C'):
11 gROOT.ProcessLine('.L tdrstyle.C')
12 ROOT.setTDRStyle()
13 print "Found tdrstyle.C file, using this style."
14 HasCMSStyle = True
15 if os.path.isfile('CMSTopStyle.cc'):
16 gROOT.ProcessLine('.L CMSTopStyle.cc+')
17 style = CMSTopStyle()
18 style.setupDefault()
19 print "Found CMSTopStyle.cc file, use TOP style if requested in xml file."
20
21 gROOT.SetBatch()
22
23 filename = sys.argv[1] #'mu_templates.root'
24 file = TFile(filename)
25
26 variable = sys.argv[2]
27
28
29 file.cd()
30 list = file.GetListOfKeys()
31
32 hbb = {}
33 #hcc = {}
34 #hqq = {}
35
36 for key in list:
37 file.cd()
38 #print "key name "+key.GetName()
39 #print "name = "+ key.GetName() +" title = "+ key.GetTitle()
40 name = key.GetName()
41 #print "key name = " + name
42 obj = file.Get(name)
43 #obj.SetName( key.GetName() )
44 #print "obj name = "+ obj.GetName() +" title = "+ obj.GetTitle()
45 if name ==variable+"_data":
46 hbb['data'] = obj
47 if name ==variable+"_ttbar":
48 hbb['ttbar'] = obj
49 if name ==variable+"_TTbar":
50 hbb['TTbar'] = obj
51 if name ==variable+"_tttt_Gh400":
52 hbb['tttt_Gh400'] = obj
53 if name ==variable+"_tttt_Gh500":
54 hbb['tttt_Gh500'] = obj
55 if name ==variable+"_tttt_Gh600":
56 hbb['tttt_Gh600'] = obj
57 if name ==variable+"_tttt_Gh700":
58 hbb['tttt_Gh700'] = obj
59 if name ==variable+"_tttt_Gh800":
60 hbb['tttt_Gh800'] = obj
61 if name ==variable+"_tttt_Gh900":
62 hbb['tttt_Gh900'] = obj
63 if name ==variable+"_tttt_Gh1000":
64 hbb['tttt_Gh1000'] = obj
65 if name ==variable+"_tttt_SM":
66 hbb['tttt_SM'] = obj
67 #if name.find("mu1allb_mass__wqq") !=-1: obj.Scale( SF_Wqq)
68 #outfile.cd()
69 #obj.Write()
70
71
72
73 cbb = TCanvas("cbb","cbb",800,600)
74 #hbb['ttbar'].SetLineColor(1)
75 #hbb['ttbar'].SetLineWidth(2)
76 #hbb['ttbar'].SetYTitle("Unit Area")
77 #max1 = hbb['ttbar'].GetMaximum()
78 #hbb['TTbar'].SetLineColor(2)
79 #hbb['TTbar'].SetLineWidth(2)
80 #max2 = hbb['TTbar'].GetMaximum()
81 #hbb['tttt_SM'].SetLineColor(1)
82 #hbb['tttt_SM'].SetLineWidth(2)
83 #hbb['tttt_SM'].SetYTitle("Unit Area")
84 #max5 = hbb['tttt_SM'].GetMaximum()
85 #hbb['tttt_Gh400'].SetLineColor(6)
86 #hbb['tttt_Gh400'].SetLineWidth(2)
87 #hbb['tttt_Gh400'].SetLineStyle(2)
88 #max2 = hbb['tttt_Gh400'].GetMaximum()
89 ##hbb['tttt_Gh500'].SetLineColor(2)
90 ##hbb['tttt_Gh500'].SetLineWidth(2)
91 ##hbb['tttt_Gh500'].SetLineStyle(2)
92 ##max4 = hbb['tttt_Gh500'].GetMaximum()
93 #hbb['tttt_Gh600'].SetLineColor(4)
94 #hbb['tttt_Gh600'].SetLineWidth(2)
95 #hbb['tttt_Gh600'].SetLineStyle(3)
96 #max3 = hbb['tttt_Gh600'].GetMaximum()
97 ##hbb['tttt_Gh700'].SetLineColor(5)
98 ##hbb['tttt_Gh800'].SetLineColor(4)
99 ##hbb['tttt_Gh800'].SetLineWidth(2)
100 ##hbb['tttt_Gh800'].SetLineStyle(4)
101 ##hbb['tttt_Gh900'].SetLineColor(7)
102 #hbb['tttt_Gh1000'].SetLineColor(3)
103 #hbb['tttt_Gh1000'].SetLineWidth(2)
104 #hbb['tttt_Gh1000'].SetLineStyle(5)
105 #max4 = hbb['tttt_Gh1000'].GetMaximum()
106 #hbb['tttt_SM'].SetLineColor(2)
107 #hbb['tttt_SM'].SetLineWidth(2)
108 #max5 = hbb['tttt_SM'].GetMaximum()
109
110 hbb['ttbar'].SetLineColor(1)
111 hbb['ttbar'].SetFillColor(0)
112 hbb['ttbar'].SetLineWidth(2)
113 hbb['ttbar'].SetLineStyle(1)
114 hbb['ttbar'].SetYTitle("Unit Area")
115 max1 = hbb['ttbar'].GetMaximum()
116 hbb['TTbar'].SetLineColor(2)
117 hbb['TTbar'].SetFillColor(0)
118 hbb['TTbar'].SetLineWidth(2)
119 hbb['TTbar'].SetLineStyle(2)
120 max2 = hbb['TTbar'].GetMaximum()
121 list = [max1, max2]
122 theMax = max(list)
123
124 #hbb['plus'].SetMarkerColor(2)
125 #hbb['tttt_Gh400'].SetMarkerColor(1)
126 #hbb['minus'].SetMarkerColor(4)
127 #hbb['plus'].SetMarkerStyle(2)
128 #hbb['tttt_Gh400'].SetMarkerStyle(2)
129 #hbb['minus'].SetMarkerStyle(2)
130
131 #cbb.SetLogy()
132 #hbb['data'].SetMaximum(10)
133 #hbb['ttbar'].SetMaximum(theMax * 1.55 )
134 #hbb['TTbar'].SetMaximum( max1 )
135 #hbb['tttt_Gh1000'].DrawNormalized("hist")
136 hbb['ttbar'].DrawNormalized("hist")
137 hbb['TTbar'].DrawNormalized("ehist same")
138 #hbb['tttt_Gh400'].DrawNormalized("hist same")
139 ##hbb['tttt_Gh400'].DrawNormalized("hist")
140 ##hbb['tttt_Gh400'].SetMaximum( max2 * 2.00)
141 ##hbb['tttt_Gh500'].DrawNormalized("hist same")
142 #hbb['tttt_Gh600'].DrawNormalized("hist same")
143 #hbb['tttt_SM'].DrawNormalized("hist same")
144 #hbb['tttt_Gh700'].DrawNormalized("hist same")
145 #hbb['tttt_Gh800'].DrawNormalized("hist same")
146 #hbb['tttt_Gh900'].DrawNormalized("hist same")
147 #hbb['ttbar'].DrawNormalized("hist")
148 #hbb['ttbar'].SetMaximum( theMax * 2.00)
149 #hbb['TTbar'].DrawNormalized("hist esame")
150
151 #aleg = TLegend(0.2,0.20,0.50,0.40)
152 aleg = TLegend(0.65,0.70,0.93,0.93)
153 SetOwnership( aleg, 0 )
154 aleg.SetHeader("CMS Simulation #mu+jets") #Preliminary") # - 5.0 fb^{-1} at #sqrt{s}=7TeV")
155 aleg.SetMargin(0.12)
156 aleg.SetTextSize(0.035)
157 aleg.SetFillColor(0)
158 aleg.SetFillStyle(0)
159 aleg.SetBorderSize(0)
160
161 #aleg.AddEntry(hbb['data'],"Data","L")
162 aleg.AddEntry(hbb['TTbar'],"t#bar{t} Pythia8 ","L")
163 aleg.AddEntry(hbb['ttbar'],"t#bar{t} Pythia6 ","L")
164 #aleg.AddEntry(hbb['tttt_SM'],"t#bar{t}t#bar{t} SM","L")
165 #aleg.AddEntry(hbb['tttt_Gh400'],"t#bar{t}t#bar{t} G_{H} 0.4 TeV","L")
166 #aleg.AddEntry(hbb['tttt_Gh500'],"t#bar{t}t#bar{t} G_{H} 0.5 TeV","L")
167 #aleg.AddEntry(hbb['tttt_Gh600'],"t#bar{t}t#bar{t} G_{H} 0.6 TeV","L")
168 #aleg.AddEntry(hbb['tttt_Gh700'],"t#bar{t}t#bar{t} G_{H} 0.7 TeV","L")
169 #aleg.AddEntry(hbb['tttt_Gh1000'],"t#bar{t}t#bar{t} G_{H} 1.0 TeV","L")
170 #aleg.AddEntry(hbb['TTbar'],"t#bar{t} pythia8 + FastSim","L")
171 #aleg.AddEntry(hbb['ttbar'],"t#bar{t} pythia6 + FullSim","L")
172 aleg.Draw()
173
174 #cbb.Print(variable+"_ttbardiff.pdf")
175 cbb.Print(variable+"_diff.pdf")
176
177 #sigma_bb = 0.28
178 #sigma_cc = 0.06
179 #sigma_qq = 0.5
180 #outfile.Close()
181 #os.system('rm tmp_'+filename)
182
183 #raw_input ("Enter to quit:")