ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/dhidas/OSUAnalysis/Tools/scripts/plot2D.py
Revision: 1.1.1.1 (vendor branch)
Committed: Thu Dec 1 16:28:48 2011 UTC (13 years, 5 months ago) by dhidas
Content type: text/x-python
Branch: dhidas, MAIN
CVS Tags: START, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
osu copy modified

File Contents

# User Rev Content
1 dhidas 1.1 from __future__ import division
2    
3     from tdrStyle import *
4     from ROOT import *
5    
6     canvases = []
7     scanvases = []
8     counter = 0
9    
10     def plotMttbar():
11     tdrstyle = setTDRStyle();
12     gStyle.SetHatchesSpacing(1.0);
13     gStyle.SetPalette(1);
14     lumi = 5000;
15     oldLumi = 5000;
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_5000pb_PFElectron_PF2PATJets_PFMET.root");
21     ttbar = TFile.Open("TTJets_5000pb_PFElectron_PF2PATJets_PFMET.root");
22     # ttbar = TFile.Open("TT_Tune_5000pb_PFElectron_PF2PATJets_PFMET.root");
23     # wjets = TFile.Open("WJetsToLNu_5000pb_PFElectron_PF2PATJets_PFMET.root");
24     # wjets = TFile.Open("WToENu_5000pb_PFElectron_PF2PATJets_PFMET.root");
25     # zjets = TFile.Open("DYJetsToLL_5000pb_PFElectron_PF2PATJets_PFMET.root");
26     # bce1 = TFile.Open("QCD_Pt-20to30_BCtoE_5000pb_PFElectron_PF2PATJets_PFMET.root");
27     # bce2 = TFile.Open("QCD_Pt-30to80_BCtoE_5000pb_PFElectron_PF2PATJets_PFMET.root");
28     # bce3 = TFile.Open("QCD_Pt-80to170_BCtoE_5000pb_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_5000pb_PFElectron_PF2PATJets_PFMET.root");
34     # Zprime1500 = TFile.Open("Zprime_M1500GeV_W15GeV_5000pb_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_5000pb_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_5000pb_PFElectron_PF2PATJets_PFMET.root");
42     WprimeTToTTD_M600 = TFile.Open("WprimeTToTTD_M600_5000pb_PFElectron_PF2PATJets_PFMET.root");
43     WprimeTToTTD_M800 = TFile.Open("WprimeTToTTD_M800_5000pb_PFElectron_PF2PATJets_PFMET.root");
44     # WprimeToTTBbar_M1000 = TFile.Open("WprimeToTBbar_M-1000_5000pb_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("mass_vs_transMass");
75     hists.append("good_vs_badwp1topmass");
76     #
77     # hists.append("mttbar_withAsymJetsCut");
78     # hists.append("mttbar_2ndSolution_withAsymJetsCut");
79     # hists.append("mttbar_3rdSolution_withAsymJetsCut");
80     # hists.append("mttbar_allSolutions_withAsymJetsCut");
81     #
82     # hists.append("ttbar_pt_2ndSolution");
83     # hists.append("ttbar_pt_3rdSolution");
84     # hists.append("ttbar_pt_allSolutions");
85     #
86     # hists.append("ttbar_pt_withMETCut");
87     # hists.append("ttbar_pt_2ndSolution_withMETCut");
88     # hists.append("ttbar_pt_3rdSolution_withMETCut");
89     # hists.append("ttbar_pt_allSolutions_withMETCut");
90     #
91     # hists.append("ttbar_pt_withMETAndAsymJets");
92     # hists.append("ttbar_pt_2ndSolution_withMETAndAsymJets");
93     # hists.append("ttbar_pt_3rdSolution_withMETAndAsymJets");
94     # hists.append("ttbar_pt_allSolutions_withMETAndAsymJets");
95     #
96     # hists.append("ttbar_pt_withAsymJetsCut");
97     # hists.append("ttbar_pt_2ndSolution_withAsymJetsCut");
98     # hists.append("ttbar_pt_3rdSolution_withAsymJetsCut");
99     # # hists.append("ttbar_pt_allSolutions_withAsymJetsCut");
100     # hists.append("angleTops");
101     # hists.append("angleTops_withMETCut");
102     # hists.append("angleTops_withMETAndAsymJets");
103     # hists.append("angleTops_withAsymJetsCut");
104     #
105     # hists.append("pt_leadingTop");
106     # hists.append("pt_loneLepTop");
107     # hists.append("pt_lepTop");
108     # hists.append("pt_hadTop");
109     # hists.append("pt_loneHadTop");
110     # hists.append("pt_leadingTop_withMETCut");
111     # hists.append("pt_leadingTop_withMETAndAsymJets");
112     # hists.append("pt_leadingTop_withAsymJetsCut");
113     #
114     # hists.append("pt_NextToLeadingTop");
115     # hists.append("pt_NextToLeadingTop_withMETCut");
116     # hists.append("pt_NextToLeadingTop_withMETAndAsymJets");
117     # hists.append("pt_NextToLeadingTop_withAsymJetsCut");
118     #
119     # hists.append("mAllTop");
120     #
121     # hists.append("ttbar_px");
122     # hists.append("ttbar_py");
123     # hists.append("ttbar_pz");
124     #
125     # hists.append("m3");
126     # hists.append("HT");
127     # hists.append("qkjet_eta");
128     # hists.append("qkjet_rapid");
129     # hists.append("leadjet_rap");
130     # hists.append("lepb_angle");
131     # hists.append("angleHadTopD");
132     # hists.append("METtopangle_ltop");
133     # hists.append("HT3jet_ltop");
134     # hists.append("HT4jet_ltop");
135     # hists.append("mt2jbothchglep4j");
136     # hists.append("mt2jbothchgelec4j");
137     # hists.append("mt2jbothchgmu4j");
138     # hists.append("mt2jbothchglep5j");
139     # hists.append("mt2jbothchgmu5j");
140     # hists.append("mt2jbothchgelec5j");
141     # hists.append("mt2jpluselec4j");
142     # hists.append("mt2jplusmu4j");
143     # hists.append("mt2jpluslep4j");
144     # hists.append("mt2jpluslep5j");
145     # hists.append("mt2jpluselec5j");
146     # hists.append("mt2jplusmu5j");
147     # hists.append("mt2jminuselec4j");
148     # hists.append("mt2jminusmu4j");
149     # hists.append("mt2jminuslep4j");
150     # hists.append("mt2jminuselec5j");
151     # hists.append("mt2jminusmu5j");
152     # hists.append("mt2jminuslep5j");
153     # hists.append("mt4jbothchglep4j");
154     # hists.append("mt4jbothchgelec4j");
155     # hists.append("mt4jbothchgmu4j");
156     # hists.append("mt4jbothchglep5j");
157     # hists.append("mt4jbothchgmu5j");
158     # hists.append("mt4jbothchgelec5j");
159     # hists.append("mt4jpluselec4j");
160     # hists.append("mt4jplusmu4j");
161     # hists.append("mt4jpluslep4j");
162     # hists.append("mt4jpluslep5j");
163     # hists.append("mt4jpluselec5j");
164     # hists.append("mt4jplusmu5j");
165     # hists.append("mt4jminuselec4j");
166     # hists.append("mt4jminusmu4j");
167     # hists.append("mt4jminuslep4j");
168     # hists.append("mt4jminuselec5j");
169     # hists.append("mt4jminusmu5j");
170     # hists.append("mt4jminuslep5j");
171     # hists.append("leadingJetMass");
172     # hists.append("mtW");
173     # hists.append("neutrino_pz");
174     # hists.append("lone_neutrino_pz");
175     suffixes = ["0orMoreBtag",
176     "1orMoreBtag",
177     "2orMoreBtags",
178     "3orMoreBtags",'4orMoreBtags' ]
179     hists = [hist + '_' + suffix for hist in hists for suffix in suffixes]
180    
181     print hists
182    
183     # jetBinned = ["allJets",
184     # "1orMoreJets",
185     # "2orMoreJets",
186     # "3orMoreJets" , "4orMoreJets"]
187     # jetBinnedhists = []
188     # jetBinnedhists.append("QCDest_CombRelIso")
189     # jetBinnedhists.append("QCDest_CombRelIso_1btag")
190     # jetBinnedhists.append("QCDest_CombRelIso_2btag")
191     # jetBinnedhists.append("QCDest_CombRelIso_controlRegion")
192     # jetBinnedhists.append("QCDest_CombRelIso_controlRegion_1btag")
193     # jetBinnedhists.append("QCDest_CombRelIso_controlRegion_2btag")
194     #
195     # jetBinnedhists.append("QCDest_PFIsolation")
196     # jetBinnedhists.append("QCDest_PFIsolation_WithMETCut")
197     # jetBinnedhists.append("QCDest_PFIsolation_WithMETCutAndAsymJetCuts")
198     # jetBinnedhists.append("QCDest_PFIsolation_WithAsymJetCuts")
199    
200     # jetBinnedhists.append("QCDest_PFIsolation_1btag")
201     # jetBinnedhists.append("QCDest_PFIsolation_2btag")
202     # jetBinnedhists.append("QCDest_PFIsolation_controlRegion")
203     # jetBinnedhists.append("QCDest_PFIsolation_controlRegion_1btag")
204     # jetBinnedhists.append("QCDest_PFIsolation_controlRegion_2btag")
205     # jetBinnedhists.append("QCDest_PFIsolation_controlRegion2")
206     # jetBinnedhists.append("QCDest_PFIsolation_controlRegion2_WithMETCut")
207     # jetBinnedhists.append("QCDest_PFIsolation_controlRegion2_WithMETCutAndAsymJetCuts")
208     # jetBinnedhists.append("QCDest_PFIsolation_controlRegion2_WithAsymJetCuts")
209     # jetBinnedhists.append("QCDest_PFIsolation_controlRegion2_1btag")
210     # jetBinnedhists.append("QCDest_PFIsolation_controlRegion2_2btag")
211    
212     # jetBinnedhists = [hist + '_' + suffix for hist in jetBinnedhists for suffix in jetBinned]
213     # hists.extend(jetBinnedhists)
214     gcd = gROOT.cd
215    
216     for histname in hists:
217     currentSelection = 'default'
218     if 'withMETAndAsymJets' in histname:
219     currentSelection = 'withMETAndAsymJets'
220     gcd()
221     print histname
222     # hist_data = data.Get(histname);
223    
224     # hist_data2;
225     # if (histname == "mttbar_rebinned")
226     # hist_data2 = data2.Get(histname);
227     # else
228     # hist_data2 = TH1F(*hist_data);
229     # hist_data.Sumw2();
230     # hist_data2.Sumw2();
231     hist_ttbar = ttbar.Get(histname);
232     # hist_wjets = wjets.Get(histname);
233     # hist_zjets = zjets.Get(histname);
234    
235     # hist_bce1 = bce1.Get(histname);
236     # hist_bce2 = bce2.Get(histname);
237     # hist_bce3 = bce3.Get(histname);
238     # hist_enri1 = enri1.Get(histname);
239     # hist_enri2 = enri2.Get(histname);
240     # hist_enri3 = enri3.Get(histname);
241     # # hist_pj1 = pj1.Get(histname);
242     # # hist_pj2 = pj2.Get(histname);
243     # hist_pj3 = pj3.Get(histname);
244     # hist_singleTop = tW.Get(histname)
245     # hist_singleTop.Add(tchan.Get(histname))
246    
247     # hist_Zprime500 = Zprime500.Get(histname);
248     # hist_Zprime750 = Zprime750.Get(histname);
249     # hist_Zprime1000 = Zprime1000.Get(histname);
250     # hist_Zprime1500 = Zprime1500.Get(histname);
251     # hist_Zprime2000 = Zprime2000.Get(histname);
252     # hist_Zprime4000 = Zprime4000.Get(histname);
253     # hist_Tprime300 = Tprime300.Get(histname);
254     # hist_Tprime350 = Tprime350.Get(histname);
255     # # hist_Zprime1250 = Zprime1250.Get(histname);
256     hist_wpm1000 = WprimeTToTTD_M1000.Get(histname);
257     hist_wpm600 = WprimeTToTTD_M600.Get(histname);
258     hist_wpm800 = WprimeTToTTD_M800.Get(histname);
259     # hist_wptb1000 = WprimeToTTBbar_M1000.Get(histname);
260    
261    
262     # hist_qcd = hist_bce1.Clone("qcd")#TH1F(*hist_bce1);
263     # hist_qcd.Add(hist_bce2);
264     # hist_qcd.Add(hist_bce3);
265     # hist_qcd.Add(hist_enri1);
266     # hist_qcd.Add(hist_enri2);
267     # hist_qcd.Add(hist_enri3);
268     # hist_qcd.Add(hist_pj1);
269     # hist_qcd.Add(hist_pj2);
270     # hist_qcd.Add(hist_pj3);
271     # hist_qcd.Scale(qcdScale[currentSelection]);
272     # ndata = hist_data.Integral();
273     # ntop = hist_ttbar.Integral();
274     # nwj = hist_wjets.Integral();
275     # nzj = hist_zjets.Integral();
276     # nqcd = hist_qcd.Integral();
277     # sumMC = ntop + nwj + nzj + nqcd;
278     # cout << ndata << " " << sumMC << endl;
279     # hist_wjets.Scale(ndata / sumMC);
280     # hist_ttbar.Scale(ndata / sumMC);
281     # hist_zjets.Scale(ndata / sumMC);
282     # hist_qcd.Scale(ndata / sumMC);
283     # mttbars = ['mttbar_' + suffix for suffix in suffixes]
284     # mttbars2 = ['mttbar_withMETAndAsymJets_' + suffix for suffix in suffixes]
285     # if histname in mttbars or histname in mttbars2:
286     # print "taking QCD shape from DATA"
287     # name = histname.replace('mttbar', 'mttbar_conversions')
288     # hist_qcd = data.Get(name)
289     # if( hist_qcd.Integral() > 0):
290     # hist_qcd.Scale(nqcd/hist_qcd.Integral())
291     # hist_mc = hist_qcd.Clone("all_mc")
292     # hist_mc.Add(hist_ttbar);
293     # hist_mc.Add(hist_zjets);
294     # hist_mc.Add(hist_wjets);
295     # hist_mc.Add(hist_singleTop);
296    
297     # hist_data = hist_ttbar.Clone("test");
298     hist_data = hist_wpm600.Clone("test");
299     # hist_data = hist_wpm800.Clone("test");
300     # hist_data = hist_wpm1000.Clone("test");
301     # hist_data = hist_ttbar.Clone("test");
302     rebin = 1;
303     Urange = (0,5000)
304     if ("mass_vs_transMass" in histname):
305     hist_data.SetXTitle("mass(lepton+1bjet)/GeV");
306     hist_data.SetYTitle("transMass(lepton+MET+1bjet)/GeV");
307     rebin = 4;
308     Urange = (0, 2000)
309     elif ("good_vs_badwp1topmass" in histname):
310     hist_data.SetXTitle("W' mass good reco/GeV");
311     hist_data.SetYTitle("W' mass bad reco/GeV");
312     rebin = 4;
313     Urange = (0, 2000)
314     elif ("tPrimeMass" in histname):
315     hist_data.SetXTitle("T' mass/GeV");
316     hist_data.SetYTitle("Events/(100 GeV)");
317     rebin = 200;
318     Urange = (0, 2000)
319     elif ("wpmass" in histname or "wpnegmass" in histname or "wpanglmass" in histname):
320     hist_data.SetXTitle("W' mass/GeV");
321     hist_data.SetYTitle("Events/(60 GeV)");
322     rebin = 60;
323     Urange = (0, 2000)
324     elif ("jet12" in histname or "jet13" in histname):
325     hist_data.SetXTitle("Jet mass/GeV");
326     hist_data.SetYTitle("Jet mass/GeV)");
327     elif ("tPrimepT" in histname):
328     hist_data.SetXTitle("T' pT/GeV");
329     hist_data.SetYTitle("Events/(8 GeV)");
330     rebin = 8;
331     Urange = (0, 200)
332     elif ("tPrimeHT" in histname):
333     hist_data.SetXTitle("T' HT");
334     hist_data.SetYTitle("Events");
335     rebin = 4;
336     Urange = (0, 1.5)
337     elif ("m3" in histname):
338     hist_data.SetXTitle("M3/GeV");
339     hist_data.SetYTitle("Events/(50 GeV)");
340     rebin = 50;
341     Urange = (0, 1500)
342     elif (histname == "electron_et"):
343     hist_data.SetXTitle("electron E_{T}/GeV");
344     hist_data.SetYTitle("Events/(10 GeV)");
345     rebin = 10;
346     Urange = (0, 300)
347     elif (histname == "electron_pt" or histname == "electminus_pt" or histname == "positron_pt"):
348     hist_data.SetXTitle("electron p_{T}/GeV");
349     hist_data.SetYTitle("Events/(10 GeV)");
350     rebin = 10;
351     Urange = (0, 300)
352     elif (histname == "muon_et"):
353     hist_data.SetXTitle("muon E_{T}/GeV");
354     hist_data.SetYTitle("Events/(10 GeV)");
355     rebin = 10;
356     Urange = (0, 300)
357     elif (histname == "muon_pt"):
358     hist_data.SetXTitle("muon p_{T}/GeV");
359     hist_data.SetYTitle("Events/(10 GeV)");
360     rebin = 10;
361     Urange = (0, 300)
362     elif ("ttbar_pt" in histname):
363     hist_data.SetXTitle("p_{T} of t#bar{t} system/GeV");
364     hist_data.SetYTitle("Events/(10 GeV)");
365     rebin = 10;
366     Urange = (0, 500)
367     elif ("ttbar_px" in histname):
368     hist_data.SetXTitle("p_{x} of t#bar{t} system/GeV");
369     hist_data.SetYTitle("Events/(10 GeV)");
370     rebin = 10;
371     Urange = (0, 500)
372     elif ("ttbar_py" in histname):
373     hist_data.SetXTitle("p_{y} of t#bar{t} system/GeV");
374     hist_data.SetYTitle("Events/(10 GeV)");
375     rebin = 10;
376     Urange = (0, 500)
377     elif ("ttbar_pz" in histname):
378     hist_data.SetXTitle("p_{z} of t#bar{t} system/GeV");
379     hist_data.SetYTitle("Events/(50 GeV)");
380     rebin = 50;
381     Urange = (0, 2000)
382     elif ("METpt_ltop" in histname):
383     hist_data.SetXTitle("MET p_{T}/GeV");
384     hist_data.SetYTitle("Events/(10 GeV)");
385     rebin = 10;
386     Urange = (0, 400)
387     elif ("tPrime_pt" in histname):
388     hist_data.SetXTitle("p_{T} of T' system/GeV");
389     hist_data.SetYTitle("Events/(20 GeV)");
390     rebin = 20;
391     Urange = (0, 200)
392     elif ("tPrime_px" in histname):
393     hist_data.SetXTitle("p_{x} of T' system/GeV");
394     hist_data.SetYTitle("Events/(20 GeV)");
395     rebin = 20;
396     Urange = (0, 200)
397     elif ("tPrime_py" in histname):
398     hist_data.SetXTitle("p_{y} of T' system/GeV");
399     hist_data.SetYTitle("Events/(20 GeV)");
400     rebin = 20;
401     Urange = (0, 200)
402     elif ("tPrime_pz" in histname):
403     hist_data.SetXTitle("p_{z} of T' system/GeV");
404     hist_data.SetYTitle("Events/(100 GeV)");
405     rebin = 200;
406     Urange = (0, 1800)
407     elif ("HT_" in histname):
408     hist_data.SetXTitle("#Sigma p_{T}/GeV");
409     hist_data.SetYTitle("Events/(20 GeV)");
410     rebin = 20;
411     Urange = (0, 2000)
412     elif ("ST" in histname):
413     hist_data.SetXTitle("ST/GeV");
414     hist_data.SetYTitle("Events/(30 GeV)");
415     rebin = 30;
416     Urange = (0, 1000)
417     elif ("HT3jet_ltop" in histname):
418     hist_data.SetXTitle("#Sigma p_{T} of leading 3 jets/GeV");
419     hist_data.SetYTitle("Events/(20 GeV)");
420     rebin = 20;
421     Urange = (0, 1000)
422     elif ("HT4jet_ltop" in histname):
423     hist_data.SetXTitle("#Sigma p_{T} of leading 4 jets/GeV");
424     hist_data.SetYTitle("Events/(50 GeV)");
425     rebin = 50;
426     Urange = (0, 1200)
427     elif (histname == "numberOfJets"):
428     hist_data.SetXTitle("number of jets");
429     hist_data.SetYTitle("Events");
430     elif (histname == "numberOfBJets"):
431     hist_data.SetXTitle("number of b-tagged jets (SSVHE medium)");
432     hist_data.SetYTitle("Events");
433     elif ('MET_' in histname and 'MET_ltop' not in histname):
434     hist_data.SetXTitle("MET/GeV");
435     hist_data.SetYTitle("Events/(10 GeV)");
436     rebin = 2;
437     Urange = (0, 400)
438     elif ('MET_ltop' in histname):
439     hist_data.SetXTitle("MET/GeV");
440     hist_data.SetYTitle("Events/(10 GeV)");
441     rebin = 20;
442     Urange = (0, 400)
443     elif ("leadingJetMass" in histname):
444     hist_data.SetXTitle("leading jet mass/GeV");
445     hist_data.SetYTitle("Events/(5 GeV)");
446     rebin = 5;
447     Urange = (0, 150)
448     elif ("mtW" in histname):
449     hist_data.SetXTitle("transverse W-boson mass/GeV");
450     hist_data.SetYTitle("Events/(10 GeV)");
451     rebin = 10;
452     elif ("both" in histname or "plus" in histname or "minus" in histname):
453     hist_data.SetXTitle("transverse mass/GeV");
454     hist_data.SetYTitle("Events/(100 GeV)");
455     rebin = 100;
456     Urange = (0, 2000)
457     elif ("transMasslm1b" in histname):
458     hist_data.SetXTitle("M_{T} (lep+MET+1b)/GeV");
459     hist_data.SetYTitle("Events/(50 GeV)");
460     rebin = 50;
461     Urange = (0, 700)
462     elif ("electronD0" in histname):
463     hist_data.SetXTitle("electron d_{0} / cm");
464     hist_data.SetYTitle("Events/(0.001 cm)");
465     rebin = 10;
466     elif ("angleTops" in histname or "deltaPhiTops" in histname):
467     hist_data.SetXTitle("angle between top quarks");
468     hist_data.SetYTitle("Events/(0.1 rad)");
469     rebin = 10;
470     elif ("lepb_angle" in histname):
471     hist_data.SetXTitle("angle between electron and b jet");
472     hist_data.SetYTitle("Events/(0.1 rad)");
473     rebin = 10;
474     elif ("angleHadTopD" in histname):
475     hist_data.SetXTitle("angle between hadronic top and light jet");
476     hist_data.SetYTitle("Events/(0.2 rad)");
477     rebin = 20;
478     elif ("METtopangle_ltop" in histname):
479     hist_data.SetXTitle("angle between MET and top p_{T}");
480     hist_data.SetYTitle("Events/(0.1 rad)");
481     rebin = 10;
482     Urange = (-2, 2)
483     elif ("qkjet_eta" in histname):
484     hist_data.SetXTitle("#eta of b jet");
485     hist_data.SetYTitle("Events/(0.1 rad)");
486     Urange = (-3, 3)
487     rebin = 10;
488     elif ("_rap" in histname):
489     hist_data.SetXTitle("Jet Rapidity");
490     hist_data.SetYTitle("Events/(0.1 rad)");
491     Urange = (-3, 3)
492     rebin = 20;
493     elif ("neutrino_pz" in histname):
494     hist_data.SetXTitle("neutrino p_{Z} /GeV");
495     hist_data.SetYTitle("Events/(20 GeV)");
496     rebin = 20;
497     Urange = (-500, 500)
498     elif ('mHadTopLone' in histname or 'mHadTopLoneNM' in histname):
499     hist_data.SetXTitle("top mass /GeV");
500     hist_data.SetYTitle("Events/(10 GeV)");
501     rebin = 10;
502     Urange = (0, 400)
503     elif ('mass4jets' in histname):
504     hist_data.SetXTitle("4-jet mass /GeV");
505     hist_data.SetYTitle("Events/(50 GeV)");
506     rebin = 50;
507     Urange = (0, 1500)
508     elif ('mLeptonicTopLone' in histname or 'mLepTopLoneNM' in histname or 'mLepTopLone' in histname):
509     hist_data.SetXTitle("top mass /GeV");
510     hist_data.SetYTitle("Events/(10 GeV)");
511     rebin = 10;
512     Urange = (0, 400)
513     elif ('chiHadronicTop' in histname or 'chiLeptonicTop' in histname):
514     hist_data.SetXTitle("top #chi^{2} /GeV");
515     hist_data.SetYTitle("Events/(1)");
516     rebin = 1;
517     Urange = (0, 30)
518     elif ('chiGlobal' in histname or 'chiTotal' in histname):
519     hist_data.SetXTitle("Event #chi^{2} /GeV");
520     hist_data.SetYTitle("Events/(100)");
521     rebin = 100;
522     elif ('numHadTopMCMatches' in histname or 'numLepTopMCMatches' in histname):
523     hist_data.SetXTitle("Number of MC-Truth Matches");
524     hist_data.SetYTitle("Events");
525     elif ('numHadTopCorrectID' in histname or 'numLepTopCorrectID' in histname):
526     hist_data.SetXTitle("Number of Reco Candidates Matched to MC-Truth Particles");
527     hist_data.SetYTitle("Events");
528     elif ('lepTopDeltaR' in histname or 'hadTopDeltaR' in histname):
529     hist_data.SetXTitle("#Delta R of MC truth top");
530     hist_data.SetYTitle("Events");
531     rebin = 2;
532     elif ('lepTopLep' in histname or 'hadTopHad' in histname):
533     hist_data.SetXTitle("top MC truth identity");
534     hist_data.SetYTitle("Events");
535     Urange = (0, 2)
536     elif ('mHadronicTop' in histname or 'mAllTop' in histname):
537     hist_data.SetXTitle("top mass /GeV");
538     hist_data.SetYTitle("Events/(40 GeV)");
539     rebin = 40;
540     Urange = (0, 1000)
541     elif ('mLeptonicTop' in histname):
542     hist_data.SetXTitle("top mass /GeV");
543     hist_data.SetYTitle("Events/(25 GeV)");
544     rebin = 25;
545     Urange = (0, 600)
546     elif ('pt_' in histname and 'Top' in histname):
547     hist_data.SetXTitle("top p_{T} /GeV");
548     hist_data.SetYTitle("Events/(50 GeV)");
549     rebin = 50;
550     Urange = (0, 500)
551     elif ('leadingJetPt' in histname):
552     hist_data.SetXTitle("leading jet p_{T} /GeV");
553     hist_data.SetYTitle("Events/(50 GeV)");
554     rebin = 50;
555     Urange = (0, 500)
556     elif('QCDest_CombRelIso' in histname):
557     hist_data.SetXTitle("relative isolation");
558     hist_data.SetYTitle("Events/(0.1)");
559     rebin = 10;
560     Urange = (0, 2)
561     elif('QCDest_PFIsolation' in histname):
562     hist_data.SetXTitle("ParticleFlow isolation");
563     hist_data.SetYTitle("Events/(0.1)");
564     rebin = 10
565     Urange = (0, 2)
566    
567    
568     hist_data.SetTitleOffset(1.3, "Y");
569     hist_data.Rebin2D(rebin, rebin);
570     hist_ttbar.Rebin2D(rebin, rebin);
571     hist_wpm1000.Rebin2D(rebin, rebin);
572     hist_wpm600.Rebin2D(rebin, rebin);
573     hist_wpm800.Rebin2D(rebin, rebin);
574     if ('jet1' in histname):
575     hist_data.Rebin2D();
576     # hist_ttbar.Rebin2D();
577     hist_Tprime300.Rebin2D();
578     hist_Tprime350.Rebin2D();
579     hist_data.SetAxisRange(0, 600, "X");
580     hist_data.SetAxisRange(0, 600, "Y");
581     # hist_ttbar.SetAxisRange(0, 600, "X");
582     # hist_ttbar.SetAxisRange(0, 600, "Y");
583     # hist_Tprime300.SetAxisRange(0, 600, "X");
584     # hist_Tprime300.SetAxisRange(0, 600, "Y");
585     # hist_Tprime350.SetAxisRange(0, 600, "X");
586     # hist_Tprime350.SetAxisRange(0, 600, "Y");
587    
588     # hist_data.SetMarkerStyle(8);
589     # hist_data.SetMarkerColor(kRed);
590     # hist_data.SetMarkerSize(1.5);
591     # hist_data.SetMarkerSize(1);
592    
593     # hist_data.SetFillStyle(1001);
594     # hist_data.SetFillColor(kRed);
595     hist_ttbar.SetMarkerColor(kRed);
596     hist_ttbar.SetMarkerStyle(2);
597     hist_ttbar.SetMarkerSize(2);
598     # hist_wjets.SetFillStyle(1001);
599     # hist_wjets.SetFillColor(4);
600     # hist_zjets.SetFillStyle(1001);
601     # hist_zjets.SetFillColor(8);
602     # hist_qcd.SetFillStyle(1001);
603     # hist_qcd.SetFillColor(kYellow);
604     # hist_qcd.SetFillColor(12);
605     # hist_singleTop.SetFillStyle(1001);
606     # hist_singleTop.SetFillColor(kMagenta)
607     # nbins = hist_qcd.GetXaxis().GetNbins();
608     # binwidth = (hist_qcd.GetXaxis().GetXmax() - hist_qcd.GetXaxis().GetXmin()) / nbins;
609     # for i in range(1, nbins + 1):
610     # yvalue = hist_qcd.GetBinContent(i);
611     # # float xvalue = hist_qcd.GetBinCenter(i);
612     # # float ymin = yvalue - yvalue*0.5;
613     # # float ymax = yvalue + yvalue*0.5;
614     # # float xmin = xvalue - 0.5*binwidth;
615     # # float xmax = xvalue + 0.5*binwidth;
616     # error = yvalue * 0.5;
617     # hist_mc.SetBinError(i, error);
618     # # qcdUncert.SetPointError(i, xmin, xmax, ymin, ymax);
619     #
620     # qcdUncert = TGraphAsymmErrors(hist_mc);
621    
622     linewidth = 6;
623     # hist_Zprime500.SetLineColor(6);
624     # hist_Zprime500.SetLineWidth(linewidth);
625     # hist_Zprime500.SetFillStyle(0);
626     # hist_Zprime500.SetFillColor(kWhite);
627    
628     # hist_Zprime750.SetLineColor(5);
629     # hist_Zprime750.SetLineWidth(linewidth);
630     # hist_Zprime750.SetFillStyle(0);
631     # hist_Zprime750.SetFillColor(kWhite);
632    
633     # hist_Zprime1000.SetLineColor(7);
634     # hist_Zprime1000.SetLineWidth(linewidth);
635     # hist_Zprime1000.SetFillStyle(0);
636     # hist_Zprime1000.SetFillColor(kWhite);
637     # hist_Zprime2000.SetLineColor(42);
638     # hist_Zprime2000.SetLineWidth(linewidth);
639     # hist_Zprime2000.SetFillStyle(0);
640     # hist_Zprime2000.SetFillColor(kWhite);
641     # # hist_Zprime4000.SetLineColor(50);
642     # hist_Zprime4000.SetLineWidth(linewidth);
643     # hist_Zprime4000.SetFillStyle(0);
644     # hist_Zprime4000.SetFillColor(kWhite);
645    
646     # hist_Tprime300.SetLineColor(kOrange + 1);
647     # hist_Tprime300.SetLineWidth(linewidth);
648     # hist_Tprime350.SetLineColor(kGray + 3);
649     # hist_Tprime350.SetLineWidth(linewidth);
650     #
651     # hist_Zprime1250.SetLineColor(kCyan - 5);
652     # hist_Zprime1250.SetLineWidth(linewidth);
653     # hist_Zprime1250.SetFillStyle(0);
654     # hist_Zprime1250.SetFillColor(kWhite);
655     #
656     # hist_Zprime1500.SetLineColor(42);
657     # hist_Zprime1500.SetLineWidth(linewidth);
658     # hist_Zprime1500.SetFillStyle(0);
659     # hist_Zprime1500.SetFillColor(kWhite);
660    
661     hist_wpm1000.SetMarkerColor(kOrange + 1);
662     hist_wpm600.SetMarkerColor(kGray + 3);
663     hist_wpm800.SetMarkerColor(kBlack);
664     hist_wpm1000.SetMarkerStyle(2);
665     hist_wpm600.SetMarkerStyle(2);
666     hist_wpm800.SetMarkerStyle(1);
667     hist_wpm600.SetMarkerSize(2);
668     hist_wpm800.SetMarkerSize(1);
669     hist_wpm1000.SetMarkerSize(2);
670     # hist_wptb1000.SetLineColor(kCyan);
671     # hist_wptb1000.SetLineWidth(linewidth);
672    
673     # qcdUncert.SetFillColor(kGray + 3);
674     # qcdUncert.SetFillStyle(3003);
675    
676     leg = TLegend(0.696, 0.15, 0.95, 0.72);
677     leg.SetBorderSize(1);
678     leg.SetLineStyle(0);
679     leg.SetTextFont(42);
680     leg.SetFillStyle(0);
681    
682     # leg.AddEntry(hist_data, "data", "P");
683     # leg.AddEntry(hist_data2, "data(no HLT)", "P");
684     # leg.AddEntry(hist_ttbar, "t#bar{t}", "P");
685     # leg.AddEntry(hist_wjets, "W#rightarrowl#nu", "f");
686     # leg.AddEntry(hist_zjets, "Z/#gamma*#rightarrowl^{+}l^{-}", "f");
687     # leg.AddEntry(hist_qcd, "QCD", "F");
688     # leg.AddEntry(hist_qcd, "QCD/#gamma + jets");
689     # leg.AddEntry(hist_singleTop, "Single-Top")
690     # leg.AddEntry(hist_Zprime500, "Z' 0.5TeV (50 pb)", "L");
691     # leg.AddEntry(hist_Zprime750, "Z' 0.75TeV", "L");
692     # leg.AddEntry(hist_Zprime1000, "Z' 1TeV", "L");
693     # leg.AddEntry(hist_Zprime1500, "Z' 1.5TeV (50 pb)", "L");
694     # leg.AddEntry(hist_Zprime2000, "Z' 2TeV", "L");
695     # leg.AddEntry(hist_Zprime4000, "Z' 4TeV (50 pb)", "L");
696     # leg.AddEntry(hist_Tprime300, "T' 300GeV", "L");
697     # leg.AddEntry(hist_Tprime350, "T' 350GeV", "L");
698     # leg.AddEntry(hist_Zprime1250, "Z' 1.25TeV");
699     leg.AddEntry(hist_wpm600, "W't .6TeV (8 pb)", "P");
700     leg.AddEntry(hist_wpm800, "W't .8TeV (2.2 pb)", "P");
701     leg.AddEntry(hist_wpm1000, "W't 1TeV (0.72 pb)", "P");
702     # leg.AddEntry(hist_wptb1000, "W'-> tb 1TeV (8 pb)", "L");
703    
704    
705     # Need to loop through samples to be plotted *****
706    
707     canvases.append(TCanvas("cname" + histname, histname, 1200, 900))
708     canvases[-1].cd().SetRightMargin(0.1);
709     if ('jet1' in histname):
710     hist_data.SetMarkerStyle(8);
711     # hist_ttbar.SetMarkerStyle(21);
712     # hist_ttbar.SetMarkerColor(kRed);
713     hist_Tprime300.SetMarkerColor(kOrange + 1);
714     hist_Tprime300.SetMarkerStyle(22);
715     hist_Tprime350.SetMarkerColor(kGray + 3);
716     hist_Tprime350.SetMarkerStyle(3);
717    
718     # hist_data.SetStats(1);
719     # hist_data.Draw('error');
720     # hist_data.Draw("box");
721     hist_data.Draw("axis");
722     # NOTE: "scat" doesn't work with the histograms from W'600.
723     # This script slows way down and the plots are missing most points.
724     # "box" produces the plots OK. Only W'600 shows this problem.
725     # Its 2D histograms are inherently messed up.
726    
727     # hist_data.SetMarkerStyle(8);
728     # hist_Zprime500.Draw("same");
729     # hist_Zprime750.Draw("same");
730     # hist_Zprime1000.Draw("same");
731     # hist_Zprime2000.Draw("same");
732     # hist_Zprime4000.Draw("same");
733     # hist_Tprime300.Draw("same");
734     # hist_Tprime350.Draw("same");
735     # hist_Zprime1250.Draw("same");
736     # hist_Zprime1500.Draw("same");
737     # hist_wpm600.Draw("colz same");
738     # hist_wpm800.Draw("same");
739     # hist_wpm1000.Draw("same");
740     hist_ttbar.Draw("colz same");
741     # hist_wptb1000.Draw("same");
742     # qcdUncert.Draw("1 same");
743     # hist_data2.Draw("error same");
744     # hist_data.Draw("error same");
745     # hist_data.Draw("same");
746     # leg.Draw();
747    
748     text1 = TLatex(3.570061, 23.08044, "CMS Preliminary");
749     text1.SetNDC();
750     text1.SetTextAlign(13);
751     text1.SetX(0.38);
752     text1.SetY(0.928);
753     #text1.SetLineWidth(2);
754     text1.SetTextFont(42);
755     text1.SetTextSizePixels(24);# dflt=28
756     text1.SetTextSize(0.03);
757     text1.Draw();
758    
759     text2 = TLatex(3.570061, 23.08044, "%d pb^{-1} at #sqrt{s} = 7 TeV" % lumi);
760     text2.SetNDC();
761     text2.SetTextAlign(13);
762     text2.SetX(0.38);
763     text2.SetY(0.88);
764     #text2.SetLineWidth(2);
765     text2.SetTextFont(42);
766     text2.SetTextSizePixels(24);# dflt=28
767     text2.SetTextSize(0.03);
768     text2.Draw();
769     canvases[-1].SaveAs('plots/' + histname + '.png')
770     # canvases[-1].SaveAs('plots/' + histname + '.root')
771     # canvases[-1].SaveAs('/storage/results/' + histname + '.png')
772    
773     # cu_hist_data = getCumulativePlot(hist_data, "data");
774     # cu_hist_ttbar = getCumulativePlot(hist_ttbar, "ttbar");
775     # cu_hist_wjets = getCumulativePlot(hist_wjets, "wjets");
776     # cu_hist_zjets = getCumulativePlot(hist_zjets, "zjets");
777     # cu_hist_qcd = getCumulativePlot(hist_qcd, "qcd");
778     # cu_hist_singleTop = getCumulativePlot(hist_singleTop, "singleTop");
779     # cu_hist_wpm1000 = getCumulativePlot(hist_wpm1000, "Wprimet1000");
780     # cu_hist_wpm600 = getCumulativePlot(hist_wpm600, "Wprimet600");
781     # cu_hist_wpm800 = getCumulativePlot(hist_wpm800, "Wprimet800");
782     # cu_hist_wptb1000 = getCumulativePlot(hist_wptb1000, "Wprimetb1000");
783     # cu_hist_Zprime500 = getCumulativePlot(hist_Zprime500, "Zprime500");
784     # cu_hist_Zprime750 = getCumulativePlot(hist_Zprime750, "Zprime750");
785     # cu_hist_Zprime1000 = getCumulativePlot(hist_Zprime1000, "Zprime1000");
786     # cu_hist_Zprime2000 = getCumulativePlot(hist_Zprime2000, "Zprime2000");
787     # cu_hist_Zprime4000 = getCumulativePlot(hist_Zprime4000, "Zprime4000");
788     # cu_hist_Tprime300 = getCumulativePlot(hist_Tprime300, "Tprime300");
789     # cu_hist_Tprime350 = getCumulativePlot(hist_Tprime350, "Tprime350");
790     ## cu_hist_Zprime1250 = getCumulativePlot(hist_Zprime1250, "Zprime1250");
791     ## cu_hist_Zprime1500 = getCumulativePlot(hist_Zprime1500, "Zprime1500");
792     # cu_hist_data.SetYTitle("Integrated Events/(50 GeV)");
793     ##
794     #
795     # cu_hist_data.SetAxisRange(Urange[0], Urange[1]);
796     # cu_hist_ttbar.SetAxisRange(Urange[0], Urange[1]);
797     # cu_hist_wjets.SetAxisRange(Urange[0], Urange[1]);
798     # cu_hist_zjets.SetAxisRange(Urange[0], Urange[1]);
799     # cu_hist_qcd.SetAxisRange(Urange[0], Urange[1]);
800     # cu_hist_singleTop.SetAxisRange(Urange[0], Urange[1]);
801     # cu_hist_wpm1000.SetAxisRange(Urange[0], Urange[1]);
802     # cu_hist_wpm600.SetAxisRange(Urange[0], Urange[1]);
803     # cu_hist_wpm800.SetAxisRange(Urange[0], Urange[1]);
804     # cu_hist_wptb1000.SetAxisRange(Urange[0], Urange[1]);
805    
806     # cu_hs = THStack("cu_MC", "cu_MC");
807     # cu_hs.Add(cu_hist_qcd);
808     # cu_hs.Add(cu_hist_zjets);
809     # cu_hs.Add(cu_hist_wjets);
810     # cu_hs.Add(cu_hist_ttbar);
811    
812     # scanvases.append(TCanvas("cu_cname" + histname, histname + "(cu)", 1200, 900))
813     # scanvases[-1].cd().SetRightMargin(0.04);
814     # cu_hist_data.Draw("error");
815     # cu_hs.Draw("hist same");
816     # cu_hist_wpm1000.Draw("same");
817     # cu_hist_wpm600.Draw("same");
818     # cu_hist_wpm800.Draw("same");
819     # cu_hist_wptb1000.Draw("same");
820     # cu_hist_Zprime500.Draw("same");
821     # cu_hist_Zprime750.Draw("same");
822     # cu_hist_Zprime1000.Draw("same");
823     # cu_hist_Zprime2000.Draw("same");
824     # cu_hist_Zprime4000.Draw("same");
825     # cu_hist_Tprime300.Draw("same");
826     # cu_hist_Tprime350.Draw("same");
827     ### cu_hist_Zprime1250.Draw("same");
828     ### cu_hist_Zprime1500.Draw("same");
829     ## # cu_hist_data2.Draw("error same");
830     # cu_hist_data.Draw("error same");
831     # leg.Draw();
832     ##
833     # text1.Draw();
834     ##
835     # text2.Draw();
836     # scanvases[-1].SaveAs('/storage/results/' + histname + '_integrated.png')
837     # scanvases[-1].SaveAs('plots/' + histname + '_integrated.png')
838    
839    
840    
841     # tdrGrid: Turns the grid lines on (true) or off (false)
842    
843     #def tdrGrid(bool gridOn):
844     # tdrStyle.SetPadGridX(gridOn);
845     # tdrStyle.SetPadGridY(gridOn);
846     #
847    
848     # fixOverlay: Redraws the axis
849    
850     def plusminuscmp():
851     WprimeTToTTD_M600 = TFile.Open("WprimeTToTTD_M600_5000pb_PFElectron_PF2PATJets_PFMET.root");
852     hist_wpm600pl = WprimeTToTTD_M600.Get("wpmassplus_1orMoreBtag");
853     hist_wpm600mi = WprimeTToTTD_M600.Get("wpmassminus_1orMoreBtag");
854     rebin = 60;
855     Urange = (0, 2000)
856     hist_wpm600pl.SetXTitle("Reco W' mass/GeV");
857     hist_wpm600pl.SetYTitle("Events/(60 GeV)");
858     hist_wpm600pl.Rebin(rebin);
859     hist_wpm600pl.SetAxisRange(Urange[0], Urange[1]);
860     hist_wpm600mi.Rebin(rebin);
861     hist_wpm600mi.SetAxisRange(Urange[0], Urange[1]);
862     hist_wpm600pl.SetLineColor(kGray + 3);
863     hist_wpm600mi.SetLineColor(kCyan);
864     linewidth = 6;
865     hist_wpm600pl.SetLineWidth(linewidth);
866     hist_wpm600mi.SetLineWidth(linewidth);
867     leg = TLegend(0.696, 0.35, 0.95, 0.92);
868     leg.SetBorderSize(0);
869     leg.SetLineStyle(0);
870     leg.SetTextFont(42);
871     leg.SetFillStyle(0);
872     leg.AddEntry(hist_wpm600pl, "W't+ .6TeV (8 pb)", "L");
873     leg.AddEntry(hist_wpm600mi, "W't- .6TeV (8 pb)", "L");
874     hist_wpm600pl.SetStats(1);
875     hist_wpm600pl.Draw();
876     hist_wpm600mi.Draw("same");
877     leg.Draw();
878     canvases[-1].SaveAs('plots/' + 'wpmassplusminus' + '.png')
879    
880    
881     def fixOverlay():
882     gPad.RedrawAxis();
883    
884    
885     def getCumulativePlot(initial, type):
886     global counter
887     counter = counter + 1;
888     name = initial.GetName()
889     name = "cu_" + name + "_" + type + str(counter);
890     title = initial.GetTitle()
891     title = "cu_" + title + "_" + type;
892     xaxis = initial.GetXaxis().GetTitle();
893     yaxis = initial.GetYaxis().GetTitle();
894     nBins = initial.GetNbinsX();
895     cu = TH1F(name, title, nBins, initial.GetXaxis().GetXmin(), initial.GetXaxis().GetXmax());
896     for bin in range(1,nBins+1):
897     cu.SetBinContent(bin, initial.Integral(bin, nBins));
898    
899     cu.SetFillStyle(initial.GetFillStyle());
900     cu.SetFillColor(initial.GetFillColor());
901     cu.SetLineColor(initial.GetLineColor());
902     cu.SetMarkerSize(initial.GetMarkerSize());
903     cu.SetMarkerStyle(initial.GetMarkerStyle());
904     cu.SetMarkerColor(initial.GetMarkerColor());
905     cu.SetLineWidth(initial.GetLineWidth());
906     cu.GetXaxis().SetTitle(xaxis);
907     cu.GetYaxis().SetTitle(yaxis);
908     return cu;
909    
910     if __name__ == "__main__":
911     gROOT.SetBatch(True)
912     gROOT.ProcessLine('gErrorIgnoreLevel = 1001;')
913     plotMttbar()
914     # print "press enter to quit"
915     # a = raw_input()