1 |
from __future__ import division
|
2 |
|
3 |
from tdrStyle import *
|
4 |
from math import sqrt
|
5 |
from ROOT import *
|
6 |
|
7 |
canvases = []
|
8 |
scanvases = []
|
9 |
counter = 0
|
10 |
|
11 |
def plotMttbar():
|
12 |
tdrstyle = setTDRStyle();
|
13 |
gStyle.SetHatchesSpacing(1.0);
|
14 |
lumi = 4000;
|
15 |
oldLumi = 4000;
|
16 |
scale = lumi / oldLumi;
|
17 |
qcdScale = {'default':1.72, 'withMETAndAsymJets': 3.03};
|
18 |
# data = TFile.Open("data2.9pb_fullSetOfVars.root");
|
19 |
|
20 |
# data = TFile.Open("Run_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
21 |
# ttbar = TFile.Open("TTJets_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
22 |
# ttbar = TFile.Open("TT_Tune_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
23 |
# wjets = TFile.Open("WJetsToLNu_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
24 |
# wjets = TFile.Open("WToENu_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
25 |
# zjets = TFile.Open("DYJetsToLL_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
26 |
# bce1 = TFile.Open("QCD_Pt-20to30_BCtoE_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
27 |
# bce2 = TFile.Open("QCD_Pt-30to80_BCtoE_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
28 |
# bce3 = TFile.Open("QCD_Pt-80to170_BCtoE_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
29 |
# enri1 = TFile.Open("QCD_Pt-20to30_EMEnriched_35.9pb_PFElectron_PF2PATJets_PFMET.root");
|
30 |
# enri2 = TFile.Open("QCD_Pt-30to80_EMEnriched_35.9pb_PFElectron_PF2PATJets_PFMET.root");
|
31 |
# enri3 = TFile.Open("QCD_Pt-80to170_EMEnriched_35.9pb_PFElectron_PF2PATJets_PFMET.root");
|
32 |
# zjets = TFile.Open("DYJets_35.9pb_PFElectron_PF2PATJets_PFMET.root");
|
33 |
# Zprime500 = TFile.Open("Zprime_M500GeV_W50GeV_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
34 |
# Zprime1500 = TFile.Open("Zprime_M1500GeV_W15GeV_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
35 |
# Zprime750 = TFile.Open("Zprime_M750GeV_W7500MeV_35.9pb_PFElectron_PF2PATJets_PFMET.root");
|
36 |
# Zprime1000 = TFile.Open("Zprime_M1000GeV_W10GeV_35.9pb_PFElectron_PF2PATJets_PFMET.root");
|
37 |
# Zprime2000 = TFile.Open("Zprime_M2000GeV_W20GeV_35.9pb_PFElectron_PF2PATJets_PFMET.root");
|
38 |
# Zprime4000 = TFile.Open("Zprime_M4000GeV_W400GeV_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
39 |
# Tprime300 = TFile.Open("TprimeToWb_M300_35.9pb_PFElectron_PF2PATJets_PFMET.root");
|
40 |
# Tprime350 = TFile.Open("TprimeToWb_M350_35.9pb_PFElectron_PF2PATJets_PFMET.root");
|
41 |
WprimeTToTTD_M1000 = TFile.Open("WprimeTToTTD_M1000_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
42 |
WprimeTToTTD_M600 = TFile.Open("WprimeTToTTD_M600_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
43 |
WprimeTToTTD_M800 = TFile.Open("WprimeTToTTD_M800_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
44 |
# WprimeToTTBbar_M1000 = TFile.Open("WprimeToTBbar_M-1000_4000pb_PFElectron_PF2PATJets_PFMET.root");
|
45 |
|
46 |
# pj1 = TFile.Open("pj1_36.145pb_PFElectron_PF2PATJets_PFMET.root");
|
47 |
# pj2 = TFile.Open("pj2_36.145pb_PFElectron_PF2PATJets_PFMET.root");
|
48 |
# pj3 = TFile.Open("pj3_36.145pb_PFElectron_PF2PATJets_PFMET.root");
|
49 |
# tW = TFile.Open("tW_36.145pb_PFElectron_PF2PATJets_PFMET.root");
|
50 |
# tchan = TFile.Open("tchan_36.145pb_PFElectron_PF2PATJets_PFMET.root");
|
51 |
# vqq = TFile.Open("vqq_7.22pb_V4PFCalo.root__fullSetOfVars.root");
|
52 |
# Zprime1250 = TFile.Open("/storage/workspace/BristolAnalysisTools/outputfiles/Zprime_M1250GeV_W12500MeV_36.135pb.root");
|
53 |
# Zprime1500 = TFile.Open("/storage/workspace/BristolAnalysisTools/outputfiles/Zprime_M1500GeV_W15GeV_36.135pb.root");
|
54 |
|
55 |
hists = [];
|
56 |
# hists.append('mttbar_QCDEnriched')
|
57 |
# hists.append('mttbar_conversions')
|
58 |
# hists.append('mttbar_conversions_withMETCut')
|
59 |
# hists.append('mttbar_conversions_withMETAndAsymJets')
|
60 |
# hists.append('mttbar_conversions_withAsymJetsCut')
|
61 |
# hists.append('mttbar_controlRegion')
|
62 |
# hists.append("jet12vsjet13");
|
63 |
# hists.append("jet12vsjet23");
|
64 |
# hists.append("jet13vsjet23");
|
65 |
# hists.append("mttbar");
|
66 |
# hists.append("tPrimeMass");
|
67 |
# hists.append("tPrimepT");
|
68 |
# hists.append("tPrimeHT");
|
69 |
# hists.append("tPrime_pt");
|
70 |
# hists.append("tPrime_px");
|
71 |
# hists.append("tPrime_py");
|
72 |
# hists.append("tPrime_pz");
|
73 |
# hists.append("mLeptonicTopLone");
|
74 |
# hists.append("mLepTopLone");
|
75 |
# hists.append("mLepTopLoneNM");
|
76 |
# hists.append("mHadTopLoneNM");
|
77 |
# hists.append("mHadTopLone");
|
78 |
# hists.append("chiHadronicTop");
|
79 |
# hists.append("chiLeptonicTop");
|
80 |
# hists.append("chiGlobal");
|
81 |
# hists.append("chiTotal");
|
82 |
hists.append("lepTopDeltaR");
|
83 |
hists.append("hadTopDeltaR");
|
84 |
hists.append("lepTopLep");
|
85 |
hists.append("hadTopHad");
|
86 |
hists.append("numHadTopMCMatches");
|
87 |
hists.append("numLepTopMCMatches");
|
88 |
hists.append("numHadTopCorrectID");
|
89 |
hists.append("numLepTopCorrectID");
|
90 |
# hists.append("mttbar_2ndSolution");
|
91 |
# hists.append("mttbar_3rdSolution");
|
92 |
# hists.append("mttbar_allSolutions");
|
93 |
##
|
94 |
# hists.append("mttbar_withMETCut");
|
95 |
# hists.append("mttbar_2ndSolution_withMETCut");
|
96 |
# hists.append("mttbar_3rdSolution_withMETCut");
|
97 |
# hists.append("mttbar_allSolutions_withMETCut");
|
98 |
#
|
99 |
# hists.append("mttbar_withMETAndAsymJets");
|
100 |
# hists.append("mttbar_2ndSolution_withMETAndAsymJets");
|
101 |
# hists.append("mttbar_3rdSolution_withMETAndAsymJets");
|
102 |
# hists.append("mttbar_allSolutions_withMETAndAsymJets");
|
103 |
#
|
104 |
# hists.append("mttbar_withAsymJetsCut");
|
105 |
# hists.append("mttbar_2ndSolution_withAsymJetsCut");
|
106 |
# hists.append("mttbar_3rdSolution_withAsymJetsCut");
|
107 |
# hists.append("mttbar_allSolutions_withAsymJetsCut");
|
108 |
#
|
109 |
# hists.append("ttbar_pt");
|
110 |
# hists.append("ttbar_pt_2ndSolution");
|
111 |
# hists.append("ttbar_pt_3rdSolution");
|
112 |
# hists.append("ttbar_pt_allSolutions");
|
113 |
#
|
114 |
# hists.append("ttbar_pt_withMETCut");
|
115 |
# hists.append("ttbar_pt_2ndSolution_withMETCut");
|
116 |
# hists.append("ttbar_pt_3rdSolution_withMETCut");
|
117 |
# hists.append("ttbar_pt_allSolutions_withMETCut");
|
118 |
#
|
119 |
# hists.append("ttbar_pt_withMETAndAsymJets");
|
120 |
# hists.append("ttbar_pt_2ndSolution_withMETAndAsymJets");
|
121 |
# hists.append("ttbar_pt_3rdSolution_withMETAndAsymJets");
|
122 |
# hists.append("ttbar_pt_allSolutions_withMETAndAsymJets");
|
123 |
#
|
124 |
# hists.append("ttbar_pt_withAsymJetsCut");
|
125 |
# hists.append("ttbar_pt_2ndSolution_withAsymJetsCut");
|
126 |
# hists.append("ttbar_pt_3rdSolution_withAsymJetsCut");
|
127 |
# # hists.append("ttbar_pt_allSolutions_withAsymJetsCut");
|
128 |
# hists.append("angleTops");
|
129 |
# hists.append("angleTops_withMETCut");
|
130 |
# hists.append("angleTops_withMETAndAsymJets");
|
131 |
# hists.append("angleTops_withAsymJetsCut");
|
132 |
#
|
133 |
# hists.append("leadingJetPt");
|
134 |
# hists.append("pt_leadingTop");
|
135 |
# hists.append("pt_loneLepTop");
|
136 |
# hists.append("pt_lepTop");
|
137 |
# hists.append("pt_hadTop");
|
138 |
# hists.append("pt_loneHadTop");
|
139 |
# hists.append("pt_leadingTop_withMETCut");
|
140 |
# hists.append("pt_leadingTop_withMETAndAsymJets");
|
141 |
# hists.append("pt_leadingTop_withAsymJetsCut");
|
142 |
#
|
143 |
# hists.append("pt_NextToLeadingTop");
|
144 |
# hists.append("pt_NextToLeadingTop_withMETCut");
|
145 |
# hists.append("pt_NextToLeadingTop_withMETAndAsymJets");
|
146 |
# hists.append("pt_NextToLeadingTop_withAsymJetsCut");
|
147 |
#
|
148 |
hists.append("mLeptonicTop");
|
149 |
hists.append("mHadronicTop");
|
150 |
# hists.append("mAllTop");
|
151 |
#
|
152 |
# hists.append("ttbar_px");
|
153 |
# hists.append("ttbar_py");
|
154 |
# hists.append("ttbar_pz");
|
155 |
#
|
156 |
# hists.append("m3");
|
157 |
# hists.append("HT");
|
158 |
# hists.append("qkjet_eta");
|
159 |
# hists.append("qkjet_rapid");
|
160 |
# hists.append("leadjet_rap");
|
161 |
# hists.append("lepb_angle");
|
162 |
# hists.append("angleHadTopD");
|
163 |
hists.append("wpmassplus");
|
164 |
hists.append("wpmassminus");
|
165 |
# hists.append("MET");
|
166 |
# hists.append("METtopangle_ltop");
|
167 |
# hists.append("HT3jet_ltop");
|
168 |
# hists.append("HT4jet_ltop");
|
169 |
# hists.append("mt2jbothchglep4j");
|
170 |
# hists.append("mt2jbothchgelec4j");
|
171 |
# hists.append("mt2jbothchgmu4j");
|
172 |
# hists.append("mt2jbothchglep5j");
|
173 |
# hists.append("mt2jbothchgmu5j");
|
174 |
# hists.append("mt2jbothchgelec5j");
|
175 |
# hists.append("mt2jpluselec4j");
|
176 |
# hists.append("mt2jplusmu4j");
|
177 |
# hists.append("mt2jpluslep4j");
|
178 |
# hists.append("mt2jpluslep5j");
|
179 |
# hists.append("mt2jpluselec5j");
|
180 |
# hists.append("mt2jplusmu5j");
|
181 |
# hists.append("mt2jminuselec4j");
|
182 |
# hists.append("mt2jminusmu4j");
|
183 |
# hists.append("mt2jminuslep4j");
|
184 |
# hists.append("mt2jminuselec5j");
|
185 |
# hists.append("mt2jminusmu5j");
|
186 |
# hists.append("mt2jminuslep5j");
|
187 |
# hists.append("mt4jbothchglep4j");
|
188 |
# hists.append("mt4jbothchgelec4j");
|
189 |
# hists.append("mt4jbothchgmu4j");
|
190 |
# hists.append("mt4jbothchglep5j");
|
191 |
# hists.append("mt4jbothchgmu5j");
|
192 |
# hists.append("mt4jbothchgelec5j");
|
193 |
# hists.append("mt4jpluselec4j");
|
194 |
# hists.append("mt4jplusmu4j");
|
195 |
# hists.append("mt4jpluslep4j");
|
196 |
# hists.append("mt4jpluslep5j");
|
197 |
# hists.append("mt4jpluselec5j");
|
198 |
# hists.append("mt4jplusmu5j");
|
199 |
# hists.append("mt4jminuselec4j");
|
200 |
# hists.append("mt4jminusmu4j");
|
201 |
# hists.append("mt4jminuslep4j");
|
202 |
# hists.append("mt4jminuselec5j");
|
203 |
# hists.append("mt4jminusmu5j");
|
204 |
# hists.append("mt4jminuslep5j");
|
205 |
# hists.append("leadingJetMass");
|
206 |
# hists.append("mtW");
|
207 |
# hists.append("neutrino_pz");
|
208 |
# hists.append("lone_neutrino_pz");
|
209 |
suffixes = ["0orMoreBtag",
|
210 |
"1orMoreBtag",
|
211 |
"2orMoreBtags",
|
212 |
"3orMoreBtags",'4orMoreBtags' ]
|
213 |
hists = [hist + '_' + suffix for hist in hists for suffix in suffixes]
|
214 |
|
215 |
histslep = [];
|
216 |
# histslep.append("HT_ltop");
|
217 |
# histslep.append("MET_ltop");
|
218 |
# histslep.append("METpt_ltop");
|
219 |
# histslep.append("mass4jets");
|
220 |
# histslep.append("ST_ltop");
|
221 |
histslep.append("wpmass");
|
222 |
histslep.append("wpnegmass");
|
223 |
histslep.append("wpnegmassbad");
|
224 |
histslep.append("wpnegmasspos");
|
225 |
histslep.append("wpnegmassneg");
|
226 |
histslep.append("wpanglmass");
|
227 |
histslep.append("deltaPhiTops");
|
228 |
histslep.append("deltaphilepjetpos");
|
229 |
histslep.append("deltaphilepdjetpos");
|
230 |
histslep.append("deltaphilepjetneg");
|
231 |
histslep.append("deltaphilepdjetneg");
|
232 |
histslep.append("transMasslm1b");
|
233 |
suffixes = ["elec", "mu", "lepton"]
|
234 |
histslep = [hist + '_' + suffix for hist in histslep for suffix in suffixes]
|
235 |
|
236 |
hists += histslep;
|
237 |
print hists
|
238 |
# hists.append("electron_et");
|
239 |
# hists.append("electminus_pt");
|
240 |
# hists.append("positron_pt");
|
241 |
# hists.append("electron_pt");
|
242 |
# hists.append("muon_et");
|
243 |
# hists.append("muon_pt");
|
244 |
|
245 |
# jetBinned = ["allJets",
|
246 |
# "1orMoreJets",
|
247 |
# "2orMoreJets",
|
248 |
# "3orMoreJets" , "4orMoreJets"]
|
249 |
# jetBinnedhists = []
|
250 |
# jetBinnedhists.append("QCDest_CombRelIso")
|
251 |
# jetBinnedhists.append("QCDest_CombRelIso_1btag")
|
252 |
# jetBinnedhists.append("QCDest_CombRelIso_2btag")
|
253 |
# jetBinnedhists.append("QCDest_CombRelIso_controlRegion")
|
254 |
# jetBinnedhists.append("QCDest_CombRelIso_controlRegion_1btag")
|
255 |
# jetBinnedhists.append("QCDest_CombRelIso_controlRegion_2btag")
|
256 |
#
|
257 |
# jetBinnedhists.append("QCDest_PFIsolation")
|
258 |
# jetBinnedhists.append("QCDest_PFIsolation_WithMETCut")
|
259 |
# jetBinnedhists.append("QCDest_PFIsolation_WithMETCutAndAsymJetCuts")
|
260 |
# jetBinnedhists.append("QCDest_PFIsolation_WithAsymJetCuts")
|
261 |
|
262 |
# jetBinnedhists.append("QCDest_PFIsolation_1btag")
|
263 |
# jetBinnedhists.append("QCDest_PFIsolation_2btag")
|
264 |
# jetBinnedhists.append("QCDest_PFIsolation_controlRegion")
|
265 |
# jetBinnedhists.append("QCDest_PFIsolation_controlRegion_1btag")
|
266 |
# jetBinnedhists.append("QCDest_PFIsolation_controlRegion_2btag")
|
267 |
# jetBinnedhists.append("QCDest_PFIsolation_controlRegion2")
|
268 |
# jetBinnedhists.append("QCDest_PFIsolation_controlRegion2_WithMETCut")
|
269 |
# jetBinnedhists.append("QCDest_PFIsolation_controlRegion2_WithMETCutAndAsymJetCuts")
|
270 |
# jetBinnedhists.append("QCDest_PFIsolation_controlRegion2_WithAsymJetCuts")
|
271 |
# jetBinnedhists.append("QCDest_PFIsolation_controlRegion2_1btag")
|
272 |
# jetBinnedhists.append("QCDest_PFIsolation_controlRegion2_2btag")
|
273 |
|
274 |
# jetBinnedhists = [hist + '_' + suffix for hist in jetBinnedhists for suffix in jetBinned]
|
275 |
# hists.extend(jetBinnedhists)
|
276 |
gcd = gROOT.cd
|
277 |
|
278 |
for histname in hists:
|
279 |
currentSelection = 'default'
|
280 |
if 'withMETAndAsymJets' in histname:
|
281 |
currentSelection = 'withMETAndAsymJets'
|
282 |
gcd()
|
283 |
print histname
|
284 |
# hist_data = data.Get(histname);
|
285 |
|
286 |
# hist_data2;
|
287 |
# if (histname == "mttbar_rebinned")
|
288 |
# hist_data2 = data2.Get(histname);
|
289 |
# else
|
290 |
# hist_data2 = TH1F(*hist_data);
|
291 |
# hist_data.Sumw2();
|
292 |
# hist_data2.Sumw2();
|
293 |
# hist_ttbar = ttbar.Get(histname);
|
294 |
# hist_wjets = wjets.Get(histname);
|
295 |
# hist_zjets = zjets.Get(histname);
|
296 |
|
297 |
# hist_bce1 = bce1.Get(histname);
|
298 |
# hist_bce2 = bce2.Get(histname);
|
299 |
# hist_bce3 = bce3.Get(histname);
|
300 |
# hist_enri1 = enri1.Get(histname);
|
301 |
# hist_enri2 = enri2.Get(histname);
|
302 |
# hist_enri3 = enri3.Get(histname);
|
303 |
# # hist_pj1 = pj1.Get(histname);
|
304 |
# # hist_pj2 = pj2.Get(histname);
|
305 |
# hist_pj3 = pj3.Get(histname);
|
306 |
# hist_singleTop = tW.Get(histname)
|
307 |
# hist_singleTop.Add(tchan.Get(histname))
|
308 |
|
309 |
# hist_Zprime500 = Zprime500.Get(histname);
|
310 |
# hist_Zprime750 = Zprime750.Get(histname);
|
311 |
# hist_Zprime1000 = Zprime1000.Get(histname);
|
312 |
# hist_Zprime1500 = Zprime1500.Get(histname);
|
313 |
# hist_Zprime2000 = Zprime2000.Get(histname);
|
314 |
# hist_Zprime4000 = Zprime4000.Get(histname);
|
315 |
# hist_Tprime300 = Tprime300.Get(histname);
|
316 |
# hist_Tprime350 = Tprime350.Get(histname);
|
317 |
# # hist_Zprime1250 = Zprime1250.Get(histname);
|
318 |
hist_wpm1000 = WprimeTToTTD_M1000.Get(histname);
|
319 |
hist_wpm600 = WprimeTToTTD_M600.Get(histname);
|
320 |
hist_wpm800 = WprimeTToTTD_M800.Get(histname);
|
321 |
# hist_wptb1000 = WprimeToTTBbar_M1000.Get(histname);
|
322 |
|
323 |
# hist_ttbar.Scale(scale);
|
324 |
# hist_wjets.Scale(scale);
|
325 |
# hist_zjets.Scale(scale);
|
326 |
|
327 |
# hist_bce1.Scale(scale);
|
328 |
# hist_bce2.Scale(scale);
|
329 |
# hist_bce3.Scale(scale);
|
330 |
|
331 |
# hist_enri1.Scale(scale);
|
332 |
# hist_enri2.Scale(scale);
|
333 |
# hist_enri3.Scale(scale);
|
334 |
|
335 |
# hist_pj1.Scale(scale);
|
336 |
# hist_pj2.Scale(scale);
|
337 |
# hist_pj3.Scale(scale);
|
338 |
|
339 |
# scale = scale * 10.0;
|
340 |
# hist_Zprime500.Scale(scale);
|
341 |
# hist_Zprime750.Scale(scale);
|
342 |
# hist_Zprime1000.Scale(scale);
|
343 |
# hist_Zprime2000.Scale(scale);
|
344 |
# hist_Zprime1500.Scale(scale);
|
345 |
# hist_Zprime4000.Scale(scale);
|
346 |
# hist_Tprime300.Scale(scale);
|
347 |
# hist_Tprime350.Scale(scale);
|
348 |
# hist_Zprime1250.Scale(scale);
|
349 |
hist_wpm1000.Scale(scale);
|
350 |
hist_wpm600.Scale(scale);
|
351 |
hist_wpm800.Scale(scale);
|
352 |
# hist_wptb1000.Scale(scale);
|
353 |
|
354 |
# hist_qcd = hist_bce1.Clone("qcd")#TH1F(*hist_bce1);
|
355 |
# hist_qcd.Add(hist_bce2);
|
356 |
# hist_qcd.Add(hist_bce3);
|
357 |
# hist_qcd.Add(hist_enri1);
|
358 |
# hist_qcd.Add(hist_enri2);
|
359 |
# hist_qcd.Add(hist_enri3);
|
360 |
# hist_qcd.Add(hist_pj1);
|
361 |
# hist_qcd.Add(hist_pj2);
|
362 |
# hist_qcd.Add(hist_pj3);
|
363 |
# hist_qcd.Scale(qcdScale[currentSelection]);
|
364 |
# ndata = hist_data.Integral();
|
365 |
# ntop = hist_ttbar.Integral();
|
366 |
# nwj = hist_wjets.Integral();
|
367 |
# nzj = hist_zjets.Integral();
|
368 |
# nqcd = hist_qcd.Integral();
|
369 |
# sumMC = ntop + nwj + nzj + nqcd;
|
370 |
# cout << ndata << " " << sumMC << endl;
|
371 |
# hist_wjets.Scale(ndata / sumMC);
|
372 |
# hist_ttbar.Scale(ndata / sumMC);
|
373 |
# hist_zjets.Scale(ndata / sumMC);
|
374 |
# hist_qcd.Scale(ndata / sumMC);
|
375 |
# mttbars = ['mttbar_' + suffix for suffix in suffixes]
|
376 |
# mttbars2 = ['mttbar_withMETAndAsymJets_' + suffix for suffix in suffixes]
|
377 |
# if histname in mttbars or histname in mttbars2:
|
378 |
# print "taking QCD shape from DATA"
|
379 |
# name = histname.replace('mttbar', 'mttbar_conversions')
|
380 |
# hist_qcd = data.Get(name)
|
381 |
# if( hist_qcd.Integral() > 0):
|
382 |
# hist_qcd.Scale(nqcd/hist_qcd.Integral())
|
383 |
# hist_mc = hist_qcd.Clone("all_mc")
|
384 |
# hist_mc.Add(hist_ttbar);
|
385 |
# hist_mc.Add(hist_zjets);
|
386 |
# hist_mc.Add(hist_wjets);
|
387 |
# hist_mc.Add(hist_singleTop);
|
388 |
|
389 |
# hist_data = hist_ttbar.Clone("test");
|
390 |
hist_data = hist_wpm600.Clone("test");
|
391 |
rebin = 1;
|
392 |
Urange = (0,5000)
|
393 |
if ("mttbar" in histname):
|
394 |
hist_data.SetXTitle("M_{t#bar{t}}/GeV");
|
395 |
hist_data.SetYTitle("Events/(100 GeV)");
|
396 |
rebin = 100;
|
397 |
Urange = (0, 2000)
|
398 |
elif ("tPrimeMass" in histname):
|
399 |
hist_data.SetXTitle("T' mass/GeV");
|
400 |
hist_data.SetYTitle("Events/(100 GeV)");
|
401 |
rebin = 200;
|
402 |
Urange = (0, 2000)
|
403 |
elif ("wpmass" in histname or "wpnegmass" in histname or "wpanglmass" in histname):
|
404 |
hist_data.SetXTitle("W' mass/GeV");
|
405 |
hist_data.SetYTitle("Events/(60 GeV)");
|
406 |
rebin = 60;
|
407 |
Urange = (0, 1500)
|
408 |
elif ("jet12" in histname or "jet13" in histname):
|
409 |
hist_data.SetXTitle("Jet mass/GeV");
|
410 |
hist_data.SetYTitle("Jet mass/GeV)");
|
411 |
elif ("tPrimepT" in histname):
|
412 |
hist_data.SetXTitle("T' pT/GeV");
|
413 |
hist_data.SetYTitle("Events/(8 GeV)");
|
414 |
rebin = 8;
|
415 |
Urange = (0, 200)
|
416 |
elif ("tPrimeHT" in histname):
|
417 |
hist_data.SetXTitle("T' HT");
|
418 |
hist_data.SetYTitle("Events");
|
419 |
rebin = 4;
|
420 |
Urange = (0, 1.5)
|
421 |
elif ("m3" in histname):
|
422 |
hist_data.SetXTitle("M3/GeV");
|
423 |
hist_data.SetYTitle("Events/(50 GeV)");
|
424 |
rebin = 50;
|
425 |
Urange = (0, 1500)
|
426 |
elif (histname == "electron_et"):
|
427 |
hist_data.SetXTitle("electron E_{T}/GeV");
|
428 |
hist_data.SetYTitle("Events/(10 GeV)");
|
429 |
rebin = 10;
|
430 |
Urange = (0, 300)
|
431 |
elif (histname == "electron_pt" or histname == "electminus_pt" or histname == "positron_pt"):
|
432 |
hist_data.SetXTitle("electron p_{T}/GeV");
|
433 |
hist_data.SetYTitle("Events/(10 GeV)");
|
434 |
rebin = 10;
|
435 |
Urange = (0, 300)
|
436 |
elif (histname == "muon_et"):
|
437 |
hist_data.SetXTitle("muon E_{T}/GeV");
|
438 |
hist_data.SetYTitle("Events/(10 GeV)");
|
439 |
rebin = 10;
|
440 |
Urange = (0, 300)
|
441 |
elif (histname == "muon_pt"):
|
442 |
hist_data.SetXTitle("muon p_{T}/GeV");
|
443 |
hist_data.SetYTitle("Events/(10 GeV)");
|
444 |
rebin = 10;
|
445 |
Urange = (0, 300)
|
446 |
elif ("ttbar_pt" in histname):
|
447 |
hist_data.SetXTitle("p_{T} of t#bar{t} system/GeV");
|
448 |
hist_data.SetYTitle("Events/(10 GeV)");
|
449 |
rebin = 10;
|
450 |
Urange = (0, 500)
|
451 |
elif ("ttbar_px" in histname):
|
452 |
hist_data.SetXTitle("p_{x} of t#bar{t} system/GeV");
|
453 |
hist_data.SetYTitle("Events/(10 GeV)");
|
454 |
rebin = 10;
|
455 |
Urange = (0, 500)
|
456 |
elif ("ttbar_py" in histname):
|
457 |
hist_data.SetXTitle("p_{y} of t#bar{t} system/GeV");
|
458 |
hist_data.SetYTitle("Events/(10 GeV)");
|
459 |
rebin = 10;
|
460 |
Urange = (0, 500)
|
461 |
elif ("ttbar_pz" in histname):
|
462 |
hist_data.SetXTitle("p_{z} of t#bar{t} system/GeV");
|
463 |
hist_data.SetYTitle("Events/(50 GeV)");
|
464 |
rebin = 50;
|
465 |
Urange = (0, 2000)
|
466 |
elif ("METpt_ltop" in histname):
|
467 |
hist_data.SetXTitle("MET p_{T}/GeV");
|
468 |
hist_data.SetYTitle("Events/(10 GeV)");
|
469 |
rebin = 10;
|
470 |
Urange = (0, 400)
|
471 |
elif ("tPrime_pt" in histname):
|
472 |
hist_data.SetXTitle("p_{T} of T' system/GeV");
|
473 |
hist_data.SetYTitle("Events/(20 GeV)");
|
474 |
rebin = 20;
|
475 |
Urange = (0, 200)
|
476 |
elif ("tPrime_px" in histname):
|
477 |
hist_data.SetXTitle("p_{x} of T' system/GeV");
|
478 |
hist_data.SetYTitle("Events/(20 GeV)");
|
479 |
rebin = 20;
|
480 |
Urange = (0, 200)
|
481 |
elif ("tPrime_py" in histname):
|
482 |
hist_data.SetXTitle("p_{y} of T' system/GeV");
|
483 |
hist_data.SetYTitle("Events/(20 GeV)");
|
484 |
rebin = 20;
|
485 |
Urange = (0, 200)
|
486 |
elif ("tPrime_pz" in histname):
|
487 |
hist_data.SetXTitle("p_{z} of T' system/GeV");
|
488 |
hist_data.SetYTitle("Events/(100 GeV)");
|
489 |
rebin = 200;
|
490 |
Urange = (0, 1800)
|
491 |
elif ("HT_" in histname):
|
492 |
hist_data.SetXTitle("#Sigma p_{T}/GeV");
|
493 |
hist_data.SetYTitle("Events/(20 GeV)");
|
494 |
rebin = 20;
|
495 |
Urange = (0, 2000)
|
496 |
elif ("ST" in histname):
|
497 |
hist_data.SetXTitle("ST/GeV");
|
498 |
hist_data.SetYTitle("Events/(30 GeV)");
|
499 |
rebin = 30;
|
500 |
Urange = (0, 1000)
|
501 |
elif ("HT3jet_ltop" in histname):
|
502 |
hist_data.SetXTitle("#Sigma p_{T} of leading 3 jets/GeV");
|
503 |
hist_data.SetYTitle("Events/(20 GeV)");
|
504 |
rebin = 20;
|
505 |
Urange = (0, 1000)
|
506 |
elif ("HT4jet_ltop" in histname):
|
507 |
hist_data.SetXTitle("#Sigma p_{T} of leading 4 jets/GeV");
|
508 |
hist_data.SetYTitle("Events/(50 GeV)");
|
509 |
rebin = 50;
|
510 |
Urange = (0, 1200)
|
511 |
elif (histname == "numberOfJets"):
|
512 |
hist_data.SetXTitle("number of jets");
|
513 |
hist_data.SetYTitle("Events");
|
514 |
elif (histname == "numberOfBJets"):
|
515 |
hist_data.SetXTitle("number of b-tagged jets (SSVHE medium)");
|
516 |
hist_data.SetYTitle("Events");
|
517 |
elif ('MET_' in histname and 'MET_ltop' not in histname):
|
518 |
hist_data.SetXTitle("MET/GeV");
|
519 |
hist_data.SetYTitle("Events/(10 GeV)");
|
520 |
rebin = 2;
|
521 |
Urange = (0, 400)
|
522 |
elif ('MET_ltop' in histname):
|
523 |
hist_data.SetXTitle("MET/GeV");
|
524 |
hist_data.SetYTitle("Events/(10 GeV)");
|
525 |
rebin = 20;
|
526 |
Urange = (0, 400)
|
527 |
elif ("leadingJetMass" in histname):
|
528 |
hist_data.SetXTitle("leading jet mass/GeV");
|
529 |
hist_data.SetYTitle("Events/(5 GeV)");
|
530 |
rebin = 5;
|
531 |
Urange = (0, 150)
|
532 |
elif ("mtW" in histname):
|
533 |
hist_data.SetXTitle("transverse W-boson mass/GeV");
|
534 |
hist_data.SetYTitle("Events/(10 GeV)");
|
535 |
rebin = 10;
|
536 |
elif ("both" in histname or "plus" in histname or "minus" in histname):
|
537 |
hist_data.SetXTitle("transverse mass/GeV");
|
538 |
hist_data.SetYTitle("Events/(100 GeV)");
|
539 |
rebin = 100;
|
540 |
Urange = (0, 2000)
|
541 |
elif ("transMasslm1b" in histname):
|
542 |
hist_data.SetXTitle("M_{T} (lep+MET+1b)/GeV");
|
543 |
hist_data.SetYTitle("Events/(50 GeV)");
|
544 |
rebin = 50;
|
545 |
Urange = (0, 700)
|
546 |
elif ("electronD0" in histname):
|
547 |
hist_data.SetXTitle("electron d_{0} / cm");
|
548 |
hist_data.SetYTitle("Events/(0.001 cm)");
|
549 |
rebin = 10;
|
550 |
elif ("angleTops" in histname or "deltaPhiTops" in histname):
|
551 |
hist_data.SetXTitle("angle between top quarks");
|
552 |
hist_data.SetYTitle("Events/(0.1 rad)");
|
553 |
rebin = 10;
|
554 |
elif ( "deltaphilep" in histname):
|
555 |
hist_data.SetXTitle("angle between lepton & leading jet");
|
556 |
hist_data.SetYTitle("Events/(0.2 rad)");
|
557 |
rebin = 20;
|
558 |
elif ("lepb_angle" in histname):
|
559 |
hist_data.SetXTitle("angle between electron and b jet");
|
560 |
hist_data.SetYTitle("Events/(0.1 rad)");
|
561 |
rebin = 10;
|
562 |
elif ("angleHadTopD" in histname):
|
563 |
hist_data.SetXTitle("angle between hadronic top and light jet");
|
564 |
hist_data.SetYTitle("Events/(0.2 rad)");
|
565 |
rebin = 20;
|
566 |
elif ("METtopangle_ltop" in histname):
|
567 |
hist_data.SetXTitle("angle between MET and top p_{T}");
|
568 |
hist_data.SetYTitle("Events/(0.1 rad)");
|
569 |
rebin = 10;
|
570 |
Urange = (-2, 2)
|
571 |
elif ("qkjet_eta" in histname):
|
572 |
hist_data.SetXTitle("#eta of b jet");
|
573 |
hist_data.SetYTitle("Events/(0.1 rad)");
|
574 |
Urange = (-3, 3)
|
575 |
rebin = 10;
|
576 |
elif ("_rap" in histname):
|
577 |
hist_data.SetXTitle("Jet Rapidity");
|
578 |
hist_data.SetYTitle("Events/(0.1 rad)");
|
579 |
Urange = (-3, 3)
|
580 |
rebin = 20;
|
581 |
elif ("neutrino_pz" in histname):
|
582 |
hist_data.SetXTitle("neutrino p_{Z} /GeV");
|
583 |
hist_data.SetYTitle("Events/(20 GeV)");
|
584 |
rebin = 20;
|
585 |
Urange = (-500, 500)
|
586 |
elif ('mHadTopLone' in histname or 'mHadTopLoneNM' in histname):
|
587 |
hist_data.SetXTitle("top mass /GeV");
|
588 |
hist_data.SetYTitle("Events/(10 GeV)");
|
589 |
rebin = 10;
|
590 |
Urange = (0, 400)
|
591 |
elif ('mass4jets' in histname):
|
592 |
hist_data.SetXTitle("4-jet mass /GeV");
|
593 |
hist_data.SetYTitle("Events/(50 GeV)");
|
594 |
rebin = 50;
|
595 |
Urange = (0, 1500)
|
596 |
elif ('mLeptonicTopLone' in histname or 'mLepTopLoneNM' in histname or 'mLepTopLone' in histname):
|
597 |
hist_data.SetXTitle("top mass /GeV");
|
598 |
hist_data.SetYTitle("Events/(10 GeV)");
|
599 |
rebin = 10;
|
600 |
Urange = (0, 400)
|
601 |
elif ('chiHadronicTop' in histname or 'chiLeptonicTop' in histname):
|
602 |
hist_data.SetXTitle("top #chi^{2} /GeV");
|
603 |
hist_data.SetYTitle("Events/(1)");
|
604 |
rebin = 1;
|
605 |
Urange = (0, 30)
|
606 |
elif ('chiGlobal' in histname or 'chiTotal' in histname):
|
607 |
hist_data.SetXTitle("Event #chi^{2} /GeV");
|
608 |
hist_data.SetYTitle("Events/(100)");
|
609 |
rebin = 100;
|
610 |
elif ('numHadTopMCMatches' in histname or 'numLepTopMCMatches' in histname):
|
611 |
hist_data.SetXTitle("Number of MC-Truth Matches");
|
612 |
hist_data.SetYTitle("Events");
|
613 |
elif ('numHadTopCorrectID' in histname or 'numLepTopCorrectID' in histname):
|
614 |
hist_data.SetXTitle("Number of Reco Candidates Matched to MC-Truth Particles");
|
615 |
hist_data.SetYTitle("Events");
|
616 |
elif ('lepTopDeltaR' in histname or 'hadTopDeltaR' in histname):
|
617 |
hist_data.SetXTitle("#Delta R of MC truth top");
|
618 |
hist_data.SetYTitle("Events");
|
619 |
rebin = 10;
|
620 |
elif ('lepTopLep' in histname or 'hadTopHad' in histname):
|
621 |
hist_data.SetXTitle("top MC truth identity");
|
622 |
hist_data.SetYTitle("Events");
|
623 |
Urange = (0, 2)
|
624 |
elif ('mHadronicTop' in histname or 'mAllTop' in histname):
|
625 |
hist_data.SetXTitle("top mass /GeV");
|
626 |
hist_data.SetYTitle("Events/(25 GeV)");
|
627 |
rebin = 25;
|
628 |
Urange = (0, 700)
|
629 |
elif ('mLeptonicTop' in histname):
|
630 |
hist_data.SetXTitle("top mass /GeV");
|
631 |
hist_data.SetYTitle("Events/(25 GeV)");
|
632 |
rebin = 25;
|
633 |
Urange = (0, 700)
|
634 |
elif ('pt_' in histname and 'Top' in histname):
|
635 |
hist_data.SetXTitle("top p_{T} /GeV");
|
636 |
hist_data.SetYTitle("Events/(50 GeV)");
|
637 |
rebin = 50;
|
638 |
Urange = (0, 500)
|
639 |
elif ('leadingJetPt' in histname):
|
640 |
hist_data.SetXTitle("leading jet p_{T} /GeV");
|
641 |
hist_data.SetYTitle("Events/(50 GeV)");
|
642 |
rebin = 50;
|
643 |
Urange = (0, 500)
|
644 |
elif('QCDest_CombRelIso' in histname):
|
645 |
hist_data.SetXTitle("relative isolation");
|
646 |
hist_data.SetYTitle("Events/(0.1)");
|
647 |
rebin = 10;
|
648 |
Urange = (0, 2)
|
649 |
elif('QCDest_PFIsolation' in histname):
|
650 |
hist_data.SetXTitle("ParticleFlow isolation");
|
651 |
hist_data.SetYTitle("Events/(0.1)");
|
652 |
rebin = 10
|
653 |
Urange = (0, 2)
|
654 |
|
655 |
|
656 |
hist_data.SetTitleOffset(1.3, "Y");
|
657 |
if ('jet1' in histname):
|
658 |
hist_data.Rebin2D();
|
659 |
# hist_ttbar.Rebin2D();
|
660 |
hist_Tprime300.Rebin2D();
|
661 |
hist_Tprime350.Rebin2D();
|
662 |
hist_data.SetAxisRange(0, 600, "X");
|
663 |
hist_data.SetAxisRange(0, 600, "Y");
|
664 |
# hist_ttbar.SetAxisRange(0, 600, "X");
|
665 |
# hist_ttbar.SetAxisRange(0, 600, "Y");
|
666 |
# hist_Tprime300.SetAxisRange(0, 600, "X");
|
667 |
# hist_Tprime300.SetAxisRange(0, 600, "Y");
|
668 |
# hist_Tprime350.SetAxisRange(0, 600, "X");
|
669 |
# hist_Tprime350.SetAxisRange(0, 600, "Y");
|
670 |
else:
|
671 |
hist_data.Rebin(rebin);
|
672 |
# hist_ttbar.Rebin(rebin);
|
673 |
# hist_wjets.Rebin(rebin);
|
674 |
# hist_zjets.Rebin(rebin);
|
675 |
# hist_qcd.Rebin(rebin);
|
676 |
# hist_Zprime500.Rebin(rebin);
|
677 |
# hist_Zprime1500.Rebin(rebin);
|
678 |
# hist_Zprime750.Rebin(rebin);
|
679 |
# hist_Zprime1000.Rebin(rebin);
|
680 |
# hist_Zprime2000.Rebin(rebin);
|
681 |
# hist_Zprime4000.Rebin(rebin);
|
682 |
# hist_Tprime300.Rebin(rebin);
|
683 |
# hist_Tprime350.Rebin(rebin);
|
684 |
# hist_singleTop.Rebin(rebin)
|
685 |
hist_wpm1000.Rebin(rebin);
|
686 |
hist_wpm600.Rebin(rebin);
|
687 |
hist_wpm800.Rebin(rebin);
|
688 |
# hist_wptb1000.Rebin(rebin);
|
689 |
|
690 |
hist_data.SetAxisRange(Urange[0], Urange[1]);
|
691 |
# hist_ttbar.SetAxisRange(Urange[0], Urange[1]);
|
692 |
# hist_wjets.SetAxisRange(Urange[0], Urange[1]);
|
693 |
# hist_zjets.SetAxisRange(Urange[0], Urange[1]);
|
694 |
# hist_qcd.SetAxisRange(Urange[0], Urange[1]);
|
695 |
# hist_Zprime500.SetAxisRange(Urange[0], Urange[1]);
|
696 |
# hist_Zprime750.SetAxisRange(Urange[0], Urange[1]);
|
697 |
# hist_Zprime1000.SetAxisRange(Urange[0], Urange[1]);
|
698 |
# hist_Zprime1500.SetAxisRange(Urange[0], Urange[1]);
|
699 |
# hist_Zprime2000.SetAxisRange(Urange[0], Urange[1]);
|
700 |
# hist_Zprime4000.SetAxisRange(Urange[0], Urange[1]);
|
701 |
# hist_Tprime300.SetAxisRange(Urange[0], Urange[1]);
|
702 |
# hist_Tprime350.SetAxisRange(Urange[0], Urange[1]);
|
703 |
# hist_singleTop.SetAxisRange(Urange[0], Urange[1]);
|
704 |
hist_wpm1000.SetAxisRange(Urange[0], Urange[1]);
|
705 |
hist_wpm600.SetAxisRange(Urange[0], Urange[1]);
|
706 |
hist_wpm800.SetAxisRange(Urange[0], Urange[1]);
|
707 |
# hist_wptb1000.SetAxisRange(Urange[0], Urange[1]);
|
708 |
|
709 |
|
710 |
hist_data.SetMarkerStyle(8);
|
711 |
# hist_data.SetMarkerSize(1.5);
|
712 |
hist_data.SetMarkerSize(0.1);
|
713 |
|
714 |
# hist_data.SetFillStyle(1001);
|
715 |
# hist_data.SetFillColor(kRed);
|
716 |
# hist_ttbar.SetFillStyle(1001);
|
717 |
# hist_ttbar.SetFillColor(kRed);
|
718 |
# hist_wjets.SetFillStyle(1001);
|
719 |
# hist_wjets.SetFillColor(4);
|
720 |
# hist_zjets.SetFillStyle(1001);
|
721 |
# hist_zjets.SetFillColor(8);
|
722 |
# hist_qcd.SetFillStyle(1001);
|
723 |
# hist_qcd.SetFillColor(kYellow);
|
724 |
# hist_qcd.SetFillColor(12);
|
725 |
# hist_singleTop.SetFillStyle(1001);
|
726 |
# hist_singleTop.SetFillColor(kMagenta)
|
727 |
# nbins = hist_qcd.GetXaxis().GetNbins();
|
728 |
# binwidth = (hist_qcd.GetXaxis().GetXmax() - hist_qcd.GetXaxis().GetXmin()) / nbins;
|
729 |
# for i in range(1, nbins + 1):
|
730 |
# yvalue = hist_qcd.GetBinContent(i);
|
731 |
# # float xvalue = hist_qcd.GetBinCenter(i);
|
732 |
# # float ymin = yvalue - yvalue*0.5;
|
733 |
# # float ymax = yvalue + yvalue*0.5;
|
734 |
# # float xmin = xvalue - 0.5*binwidth;
|
735 |
# # float xmax = xvalue + 0.5*binwidth;
|
736 |
# error = yvalue * 0.5;
|
737 |
# hist_mc.SetBinError(i, error);
|
738 |
# # qcdUncert.SetPointError(i, xmin, xmax, ymin, ymax);
|
739 |
#
|
740 |
# qcdUncert = TGraphAsymmErrors(hist_mc);
|
741 |
|
742 |
linewidth = 6;
|
743 |
# hist_Zprime500.SetLineColor(6);
|
744 |
# hist_Zprime500.SetLineWidth(linewidth);
|
745 |
# hist_Zprime500.SetFillStyle(0);
|
746 |
# hist_Zprime500.SetFillColor(kWhite);
|
747 |
|
748 |
# hist_Zprime750.SetLineColor(5);
|
749 |
# hist_Zprime750.SetLineWidth(linewidth);
|
750 |
# hist_Zprime750.SetFillStyle(0);
|
751 |
# hist_Zprime750.SetFillColor(kWhite);
|
752 |
|
753 |
# hist_Zprime1000.SetLineColor(7);
|
754 |
# hist_Zprime1000.SetLineWidth(linewidth);
|
755 |
# hist_Zprime1000.SetFillStyle(0);
|
756 |
# hist_Zprime1000.SetFillColor(kWhite);
|
757 |
# hist_Zprime2000.SetLineColor(42);
|
758 |
# hist_Zprime2000.SetLineWidth(linewidth);
|
759 |
# hist_Zprime2000.SetFillStyle(0);
|
760 |
# hist_Zprime2000.SetFillColor(kWhite);
|
761 |
# # hist_Zprime4000.SetLineColor(50);
|
762 |
# hist_Zprime4000.SetLineWidth(linewidth);
|
763 |
# hist_Zprime4000.SetFillStyle(0);
|
764 |
# hist_Zprime4000.SetFillColor(kWhite);
|
765 |
|
766 |
# hist_Tprime300.SetLineColor(kOrange + 1);
|
767 |
# hist_Tprime300.SetLineWidth(linewidth);
|
768 |
# hist_Tprime350.SetLineColor(kGray + 3);
|
769 |
# hist_Tprime350.SetLineWidth(linewidth);
|
770 |
#
|
771 |
# hist_Zprime1250.SetLineColor(kCyan - 5);
|
772 |
# hist_Zprime1250.SetLineWidth(linewidth);
|
773 |
# hist_Zprime1250.SetFillStyle(0);
|
774 |
# hist_Zprime1250.SetFillColor(kWhite);
|
775 |
#
|
776 |
# hist_Zprime1500.SetLineColor(42);
|
777 |
# hist_Zprime1500.SetLineWidth(linewidth);
|
778 |
# hist_Zprime1500.SetFillStyle(0);
|
779 |
# hist_Zprime1500.SetFillColor(kWhite);
|
780 |
|
781 |
hist_wpm1000.SetLineColor(kOrange + 1);
|
782 |
hist_wpm1000.SetLineWidth(linewidth);
|
783 |
hist_wpm600.SetLineColor(kGray + 3);
|
784 |
hist_wpm600.SetLineWidth(linewidth);
|
785 |
hist_wpm800.SetLineColor(kCyan);
|
786 |
hist_wpm800.SetLineWidth(linewidth);
|
787 |
# hist_wptb1000.SetLineColor(kCyan);
|
788 |
# hist_wptb1000.SetLineWidth(linewidth);
|
789 |
|
790 |
# qcdUncert.SetFillColor(kGray + 3);
|
791 |
# qcdUncert.SetFillStyle(3003);
|
792 |
|
793 |
leg = TLegend(0.696, 0.35, 0.95, 0.92);
|
794 |
leg.SetBorderSize(0);
|
795 |
leg.SetLineStyle(0);
|
796 |
leg.SetTextFont(42);
|
797 |
leg.SetFillStyle(0);
|
798 |
|
799 |
# leg.AddEntry(hist_data, "data", "P");
|
800 |
# leg.AddEntry(hist_data2, "data(no HLT)", "P");
|
801 |
# leg.AddEntry(hist_ttbar, "t#bar{t}", "f");
|
802 |
# leg.AddEntry(hist_wjets, "W#rightarrowl#nu", "f");
|
803 |
# leg.AddEntry(hist_zjets, "Z/#gamma*#rightarrowl^{+}l^{-}", "f");
|
804 |
# leg.AddEntry(hist_qcd, "QCD", "F");
|
805 |
# leg.AddEntry(hist_qcd, "QCD/#gamma + jets");
|
806 |
# leg.AddEntry(hist_singleTop, "Single-Top")
|
807 |
# leg.AddEntry(hist_Zprime500, "Z' 0.5TeV (50 pb)", "L");
|
808 |
# leg.AddEntry(hist_Zprime750, "Z' 0.75TeV", "L");
|
809 |
# leg.AddEntry(hist_Zprime1000, "Z' 1TeV", "L");
|
810 |
# leg.AddEntry(hist_Zprime1500, "Z' 1.5TeV (50 pb)", "L");
|
811 |
# leg.AddEntry(hist_Zprime2000, "Z' 2TeV", "L");
|
812 |
# leg.AddEntry(hist_Zprime4000, "Z' 4TeV (50 pb)", "L");
|
813 |
# leg.AddEntry(hist_Tprime300, "T' 300GeV", "L");
|
814 |
# leg.AddEntry(hist_Tprime350, "T' 350GeV", "L");
|
815 |
# leg.AddEntry(hist_Zprime1250, "Z' 1.25TeV");
|
816 |
leg.AddEntry(hist_wpm600, "W't .6TeV (8 pb)", "L");
|
817 |
leg.AddEntry(hist_wpm800, "W't .8TeV (2.2 pb)", "L");
|
818 |
leg.AddEntry(hist_wpm1000, "W't 1TeV (0.72 pb)", "L");
|
819 |
# leg.AddEntry(hist_wptb1000, "W'-> tb 1TeV (8 pb)", "L");
|
820 |
|
821 |
|
822 |
canvases.append(TCanvas("cname" + histname, histname, 1200, 900))
|
823 |
canvases[-1].cd().SetRightMargin(0.04);
|
824 |
if ('jet1' in histname):
|
825 |
hist_data.SetMarkerStyle(8);
|
826 |
# hist_ttbar.SetMarkerStyle(21);
|
827 |
# hist_ttbar.SetMarkerColor(kRed);
|
828 |
hist_Tprime300.SetMarkerColor(kOrange + 1);
|
829 |
hist_Tprime300.SetMarkerStyle(22);
|
830 |
hist_Tprime350.SetMarkerColor(kGray + 3);
|
831 |
hist_Tprime350.SetMarkerStyle(3);
|
832 |
else:
|
833 |
hs = THStack("MC", "MC");
|
834 |
# hs.Add(hist_qcd);
|
835 |
# hs.Add(hist_zjets);
|
836 |
# hs.Add(hist_wjets);
|
837 |
# hs.Add(hist_singleTop);
|
838 |
# hs.Add(hist_ttbar);
|
839 |
max = 0
|
840 |
if hs.GetMaximum() > hist_data.GetMaximum():
|
841 |
max = hs.GetMaximum()*1.1
|
842 |
else:
|
843 |
max = hist_data.GetMaximum()*1.1
|
844 |
if hist_wpm600.GetMaximum() > max :
|
845 |
max = hist_wpm600.GetMaximum() * 1.1
|
846 |
|
847 |
hist_data.GetYaxis().SetRangeUser(0, max);
|
848 |
hist_data.SetStats(1);
|
849 |
# hist_data.Draw('error');
|
850 |
hist_data.Draw();
|
851 |
hist_data.SetMarkerStyle(8);
|
852 |
# if ('jet1' in histname):
|
853 |
# hist_ttbar.Draw("same");
|
854 |
# else:
|
855 |
# hs.Draw("hist same");
|
856 |
# hist_Zprime500.Draw("same");
|
857 |
# hist_Zprime750.Draw("same");
|
858 |
# hist_Zprime1000.Draw("same");
|
859 |
# hist_Zprime2000.Draw("same");
|
860 |
# hist_Zprime4000.Draw("same");
|
861 |
# hist_Tprime300.Draw("same");
|
862 |
# hist_Tprime350.Draw("same");
|
863 |
# hist_Zprime1250.Draw("same");
|
864 |
# hist_Zprime1500.Draw("same");
|
865 |
hist_wpm1000.Draw("same");
|
866 |
hist_wpm600.Draw("same");
|
867 |
hist_wpm800.Draw("same");
|
868 |
# hist_wptb1000.Draw("same");
|
869 |
# qcdUncert.Draw("1 same");
|
870 |
# hist_data2.Draw("error same");
|
871 |
# hist_data.Draw("error same");
|
872 |
# hist_data.Draw("same");
|
873 |
leg.Draw();
|
874 |
|
875 |
text1 = TLatex(3.570061, 23.08044, "CMS Preliminary");
|
876 |
text1.SetNDC();
|
877 |
text1.SetTextAlign(13);
|
878 |
text1.SetX(0.38);
|
879 |
text1.SetY(0.928);
|
880 |
#text1.SetLineWidth(2);
|
881 |
text1.SetTextFont(42);
|
882 |
text1.SetTextSizePixels(24);# dflt=28
|
883 |
text1.SetTextSize(0.03);
|
884 |
text1.Draw();
|
885 |
|
886 |
text2 = TLatex(3.570061, 23.08044, "%d pb^{-1} at #sqrt{s} = 7 TeV" % lumi);
|
887 |
text2.SetNDC();
|
888 |
text2.SetTextAlign(13);
|
889 |
text2.SetX(0.38);
|
890 |
text2.SetY(0.88);
|
891 |
#text2.SetLineWidth(2);
|
892 |
text2.SetTextFont(42);
|
893 |
text2.SetTextSizePixels(24);# dflt=28
|
894 |
text2.SetTextSize(0.03);
|
895 |
text2.Draw();
|
896 |
canvases[-1].SaveAs('plots/' + histname + '.png')
|
897 |
|
898 |
# if (histname == "wpnegmass_elec"):
|
899 |
# hist_ttbargood = hist_ttbar.Clone("test");
|
900 |
# hist_wprimegood = hist_wpm600.Clone("test");
|
901 |
# elif (histname == "wpnegmassbad_elec"):
|
902 |
# asymmetryplot(hist_ttbargood, hist_ttbar, 'ttbarasym');
|
903 |
# asymmetryplot(hist_wprimegood, hist_wpm600, 'wprimeasym');
|
904 |
# asymmetry2plot(hist_ttbargood, hist_ttbar, hist_wprimegood, hist_wpm600, 'wpttcombined');
|
905 |
# plusminuscmp(hist_wpm600, hist_wprimegood, "wpnegmassgoodbad", 0);
|
906 |
# hist_wpm600.Add(hist_ttbar);
|
907 |
# hist_wprimegood.Add(hist_ttbargood);
|
908 |
# plusminuscmp(hist_wpm600, hist_wprimegood, "wpnegmtotgoodbad", 0);
|
909 |
# elif (histname == "wpnegmasspos"):
|
910 |
# hist_wprimepos = hist_wpm600.Clone("test");
|
911 |
# hist_ttbarbad = hist_ttbar.Clone("test");
|
912 |
# elif (histname == "wpnegmassneg"):
|
913 |
# plusminuscmp(hist_wprimepos, hist_wpm600, 'wpmassplusminus', 1);
|
914 |
|
915 |
|
916 |
# canvases[-1].SaveAs('plots/' + histname + '.root')
|
917 |
# canvases[-1].SaveAs('/storage/results/' + histname + '.png')
|
918 |
|
919 |
# cu_hist_data = getCumulativePlot(hist_data, "data");
|
920 |
# cu_hist_ttbar = getCumulativePlot(hist_ttbar, "ttbar");
|
921 |
# cu_hist_wjets = getCumulativePlot(hist_wjets, "wjets");
|
922 |
# cu_hist_zjets = getCumulativePlot(hist_zjets, "zjets");
|
923 |
# cu_hist_qcd = getCumulativePlot(hist_qcd, "qcd");
|
924 |
# cu_hist_singleTop = getCumulativePlot(hist_singleTop, "singleTop");
|
925 |
# cu_hist_wpm1000 = getCumulativePlot(hist_wpm1000, "Wprimet1000");
|
926 |
# cu_hist_wpm600 = getCumulativePlot(hist_wpm600, "Wprimet600");
|
927 |
# cu_hist_wpm800 = getCumulativePlot(hist_wpm800, "Wprimet800");
|
928 |
# cu_hist_wptb1000 = getCumulativePlot(hist_wptb1000, "Wprimetb1000");
|
929 |
# cu_hist_Zprime500 = getCumulativePlot(hist_Zprime500, "Zprime500");
|
930 |
# cu_hist_Zprime750 = getCumulativePlot(hist_Zprime750, "Zprime750");
|
931 |
# cu_hist_Zprime1000 = getCumulativePlot(hist_Zprime1000, "Zprime1000");
|
932 |
# cu_hist_Zprime2000 = getCumulativePlot(hist_Zprime2000, "Zprime2000");
|
933 |
# cu_hist_Zprime4000 = getCumulativePlot(hist_Zprime4000, "Zprime4000");
|
934 |
# cu_hist_Tprime300 = getCumulativePlot(hist_Tprime300, "Tprime300");
|
935 |
# cu_hist_Tprime350 = getCumulativePlot(hist_Tprime350, "Tprime350");
|
936 |
## cu_hist_Zprime1250 = getCumulativePlot(hist_Zprime1250, "Zprime1250");
|
937 |
## cu_hist_Zprime1500 = getCumulativePlot(hist_Zprime1500, "Zprime1500");
|
938 |
# cu_hist_data.SetYTitle("Integrated Events/(50 GeV)");
|
939 |
##
|
940 |
#
|
941 |
# cu_hist_data.SetAxisRange(Urange[0], Urange[1]);
|
942 |
# cu_hist_ttbar.SetAxisRange(Urange[0], Urange[1]);
|
943 |
# cu_hist_wjets.SetAxisRange(Urange[0], Urange[1]);
|
944 |
# cu_hist_zjets.SetAxisRange(Urange[0], Urange[1]);
|
945 |
# cu_hist_qcd.SetAxisRange(Urange[0], Urange[1]);
|
946 |
# cu_hist_singleTop.SetAxisRange(Urange[0], Urange[1]);
|
947 |
# cu_hist_wpm1000.SetAxisRange(Urange[0], Urange[1]);
|
948 |
# cu_hist_wpm600.SetAxisRange(Urange[0], Urange[1]);
|
949 |
# cu_hist_wpm800.SetAxisRange(Urange[0], Urange[1]);
|
950 |
# cu_hist_wptb1000.SetAxisRange(Urange[0], Urange[1]);
|
951 |
|
952 |
# cu_hs = THStack("cu_MC", "cu_MC");
|
953 |
# cu_hs.Add(cu_hist_qcd);
|
954 |
# cu_hs.Add(cu_hist_zjets);
|
955 |
# cu_hs.Add(cu_hist_wjets);
|
956 |
# cu_hs.Add(cu_hist_ttbar);
|
957 |
|
958 |
# scanvases.append(TCanvas("cu_cname" + histname, histname + "(cu)", 1200, 900))
|
959 |
# scanvases[-1].cd().SetRightMargin(0.04);
|
960 |
# cu_hist_data.Draw("error");
|
961 |
# cu_hs.Draw("hist same");
|
962 |
# cu_hist_wpm1000.Draw("same");
|
963 |
# cu_hist_wpm600.Draw("same");
|
964 |
# cu_hist_wpm800.Draw("same");
|
965 |
# cu_hist_wptb1000.Draw("same");
|
966 |
# cu_hist_Zprime500.Draw("same");
|
967 |
# cu_hist_Zprime750.Draw("same");
|
968 |
# cu_hist_Zprime1000.Draw("same");
|
969 |
# cu_hist_Zprime2000.Draw("same");
|
970 |
# cu_hist_Zprime4000.Draw("same");
|
971 |
# cu_hist_Tprime300.Draw("same");
|
972 |
# cu_hist_Tprime350.Draw("same");
|
973 |
### cu_hist_Zprime1250.Draw("same");
|
974 |
### cu_hist_Zprime1500.Draw("same");
|
975 |
## # cu_hist_data2.Draw("error same");
|
976 |
# cu_hist_data.Draw("error same");
|
977 |
# leg.Draw();
|
978 |
##
|
979 |
# text1.Draw();
|
980 |
##
|
981 |
# text2.Draw();
|
982 |
# scanvases[-1].SaveAs('/storage/results/' + histname + '_integrated.png')
|
983 |
# scanvases[-1].SaveAs('plots/' + histname + '_integrated.png')
|
984 |
|
985 |
|
986 |
|
987 |
# tdrGrid: Turns the grid lines on (true) or off (false)
|
988 |
|
989 |
#def tdrGrid(bool gridOn):
|
990 |
# tdrStyle.SetPadGridX(gridOn);
|
991 |
# tdrStyle.SetPadGridY(gridOn);
|
992 |
#
|
993 |
|
994 |
# fixOverlay: Redraws the axis
|
995 |
|
996 |
def setCorrErrs(hist_good, hist_bad, hist_diff):
|
997 |
nbins = hist_diff.GetXaxis().GetNbins();
|
998 |
for i in range(1, nbins):
|
999 |
goodval = hist_good.GetBinContent(i);
|
1000 |
badval = hist_bad.GetBinContent(i);
|
1001 |
errsum = goodval + badval;
|
1002 |
if errsum > 0:
|
1003 |
errprod = goodval * badval;
|
1004 |
# Assume 90% correlation
|
1005 |
tot = 2.0 * errprod * (errsum + 3.6 * sqrt(errprod));
|
1006 |
tot = sqrt(tot) / (errsum * errsum);
|
1007 |
hist_diff.SetBinError(i, tot);
|
1008 |
|
1009 |
|
1010 |
|
1011 |
def setUncorrErrs(hist_good, hist_bad, hist_diff):
|
1012 |
nbins = hist_diff.GetXaxis().GetNbins();
|
1013 |
for i in range(1, nbins):
|
1014 |
goodval = hist_good.GetBinContent(i);
|
1015 |
badval = hist_bad.GetBinContent(i);
|
1016 |
err = goodval + badval;
|
1017 |
err = err * err * err;
|
1018 |
if err > 0:
|
1019 |
err = 4.0 * sqrt((goodval * badval) / err);
|
1020 |
hist_diff.SetBinError(i, err);
|
1021 |
|
1022 |
|
1023 |
def asymmetryplot(hist_good, hist_bad, histname):
|
1024 |
hist_total = hist_good.Clone("test");
|
1025 |
hist_total.Sumw2();
|
1026 |
hist_total.Add(hist_bad);
|
1027 |
hist_diff = hist_good.Clone("test");
|
1028 |
hist_diff.Sumw2();
|
1029 |
hist_diff.Add(hist_bad, -1);
|
1030 |
hist_total.Scale(0.5);
|
1031 |
hist_diff.Divide(hist_total);
|
1032 |
setCorrErrs(hist_good, hist_bad, hist_diff);
|
1033 |
hist_diff.SetXTitle("W' mass/GeV");
|
1034 |
hist_diff.SetYTitle("Asymmetry");
|
1035 |
hist_diff.SetAxisRange(200, 1100);
|
1036 |
hist_diff.SetLineWidth(2);
|
1037 |
# hist_diff.SetFillStyle(1001);
|
1038 |
hist_diff.SetFillStyle(3001);
|
1039 |
hist_diff.SetFillColor(kRed);
|
1040 |
canvases[-1].SetGridy();
|
1041 |
hist_diff.GetYaxis().SetRangeUser(-1, 1);
|
1042 |
hist_diff.Draw("hist E1");
|
1043 |
canvases[-1].SaveAs('plots/' + histname + '.png')
|
1044 |
|
1045 |
|
1046 |
def asymmetry2plot(ttbar_good, ttbar_bad, wp_good, wp_bad, histname):
|
1047 |
hist_total = ttbar_good.Clone("test");
|
1048 |
hist_total.Sumw2();
|
1049 |
hist_total.Add(ttbar_bad);
|
1050 |
hist_total.Add(wp_good);
|
1051 |
hist_total.Add(wp_bad);
|
1052 |
hist_total.Scale(0.5);
|
1053 |
hist_diff = ttbar_good.Clone("test");
|
1054 |
hist_diff.Sumw2();
|
1055 |
hist_diff.Add(wp_good);
|
1056 |
hist_diff.Add(ttbar_bad, -1);
|
1057 |
hist_diff.Add(wp_bad, -1);
|
1058 |
hist_diff.Divide(hist_total);
|
1059 |
# nbins = hist_diff.GetXaxis().GetNbins();
|
1060 |
hist_good = ttbar_good.Clone("test");
|
1061 |
hist_good.Add(wp_good);
|
1062 |
hist_bad = ttbar_bad.Clone("test");
|
1063 |
hist_bad.Add(wp_bad);
|
1064 |
setCorrErrs(hist_good, hist_bad, hist_diff);
|
1065 |
hist_diff.SetXTitle("W' mass/GeV");
|
1066 |
hist_diff.SetYTitle("Asymmetry");
|
1067 |
hist_diff.SetAxisRange(200, 1100);
|
1068 |
hist_diff.SetLineWidth(2);
|
1069 |
# hist_diff.SetFillStyle(1001);
|
1070 |
hist_diff.SetFillStyle(3001);
|
1071 |
hist_diff.SetFillColor(kRed);
|
1072 |
canvases[-1].SetGridy();
|
1073 |
hist_diff.GetYaxis().SetRangeUser(-1, 1);
|
1074 |
hist_diff.Draw("hist E1");
|
1075 |
canvases[-1].SaveAs('plots/' + histname + '.png')
|
1076 |
|
1077 |
|
1078 |
|
1079 |
def plusminuscmp(hist_pos, hist_neg, hist_name, sign):
|
1080 |
hist_neg.SetXTitle("Reco W' mass/GeV");
|
1081 |
hist_neg.SetYTitle("Events/(60 GeV)");
|
1082 |
hist_pos.SetLineColor(kGray + 3);
|
1083 |
hist_neg.SetLineColor(kRed);
|
1084 |
linewidth = 6;
|
1085 |
hist_pos.SetLineWidth(linewidth);
|
1086 |
hist_neg.SetLineWidth(linewidth);
|
1087 |
leg = TLegend(0.696, 0.35, 0.95, 0.92);
|
1088 |
leg.SetBorderSize(0);
|
1089 |
leg.SetLineStyle(0);
|
1090 |
leg.SetTextFont(42);
|
1091 |
leg.SetFillStyle(0);
|
1092 |
if sign == 1:
|
1093 |
leg.AddEntry(hist_pos, "W't+ .6TeV (8 pb)", "L");
|
1094 |
leg.AddEntry(hist_neg, "W't- .6TeV (8 pb)", "L");
|
1095 |
else:
|
1096 |
leg.AddEntry(hist_pos, "W't bad .6TeV (8 pb)", "L");
|
1097 |
leg.AddEntry(hist_neg, "W't good .6TeV (8 pb)", "L");
|
1098 |
hist_pos.SetStats(1);
|
1099 |
hist_neg.Draw();
|
1100 |
hist_pos.Draw("same");
|
1101 |
leg.Draw();
|
1102 |
canvases[-1].SaveAs('plots/' + hist_name + '.png')
|
1103 |
|
1104 |
|
1105 |
def fixOverlay():
|
1106 |
gPad.RedrawAxis();
|
1107 |
|
1108 |
|
1109 |
def getCumulativePlot(initial, type):
|
1110 |
global counter
|
1111 |
counter = counter + 1;
|
1112 |
name = initial.GetName()
|
1113 |
name = "cu_" + name + "_" + type + str(counter);
|
1114 |
title = initial.GetTitle()
|
1115 |
title = "cu_" + title + "_" + type;
|
1116 |
xaxis = initial.GetXaxis().GetTitle();
|
1117 |
yaxis = initial.GetYaxis().GetTitle();
|
1118 |
nBins = initial.GetNbinsX();
|
1119 |
cu = TH1F(name, title, nBins, initial.GetXaxis().GetXmin(), initial.GetXaxis().GetXmax());
|
1120 |
for bin in range(1,nBins+1):
|
1121 |
cu.SetBinContent(bin, initial.Integral(bin, nBins));
|
1122 |
|
1123 |
cu.SetFillStyle(initial.GetFillStyle());
|
1124 |
cu.SetFillColor(initial.GetFillColor());
|
1125 |
cu.SetLineColor(initial.GetLineColor());
|
1126 |
cu.SetMarkerSize(initial.GetMarkerSize());
|
1127 |
cu.SetMarkerStyle(initial.GetMarkerStyle());
|
1128 |
cu.SetMarkerColor(initial.GetMarkerColor());
|
1129 |
cu.SetLineWidth(initial.GetLineWidth());
|
1130 |
cu.GetXaxis().SetTitle(xaxis);
|
1131 |
cu.GetYaxis().SetTitle(yaxis);
|
1132 |
return cu;
|
1133 |
|
1134 |
if __name__ == "__main__":
|
1135 |
gROOT.SetBatch(True)
|
1136 |
gROOT.ProcessLine('gErrorIgnoreLevel = 1001;')
|
1137 |
plotMttbar()
|
1138 |
# print "press enter to quit"
|
1139 |
# a = raw_input()
|