ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/dhidas/OSUAnalysis/Tools/scripts/makePlots.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

# Content
1 from HistGetter import *
2 from HistPlotter import *
3 from time import sleep
4 from ROOT import *
5
6 if __name__ == '__main__':
7 gROOT.SetBatch(True)
8 gROOT.ProcessLine('gErrorIgnoreLevel = 1001;')
9
10 files = {'data':"/storage/results/QCD_Estimate/Preapproval3/data_36.145pb_PFElectron_PF2PATJets_PFMET.root",
11 'ttbar' : "/storage/results/QCD_Estimate/Preapproval3/ttjet_36.145pb_PFElectron_PF2PATJets_PFMET.root",
12 'wjets' : "/storage/results/QCD_Estimate/Preapproval3/wj_36.145pb_PFElectron_PF2PATJets_PFMET.root",
13 'zjets' : "/storage/results/QCD_Estimate/Preapproval3/zj_36.145pb_PFElectron_PF2PATJets_PFMET.root",
14 'bce1' : "/storage/results/QCD_Estimate/Preapproval3/bce1_36.145pb_PFElectron_PF2PATJets_PFMET.root",
15 'bce2' : "/storage/results/QCD_Estimate/Preapproval3/bce2_36.145pb_PFElectron_PF2PATJets_PFMET.root",
16 'bce3' : "/storage/results/QCD_Estimate/Preapproval3/bce3_36.145pb_PFElectron_PF2PATJets_PFMET.root",
17 'enri1' : "/storage/results/QCD_Estimate/Preapproval3/enri1_36.145pb_PFElectron_PF2PATJets_PFMET.root",
18 'enri2' : "/storage/results/QCD_Estimate/Preapproval3/enri2_36.145pb_PFElectron_PF2PATJets_PFMET.root",
19 'enri3' : "/storage/results/QCD_Estimate/Preapproval3/enri3_36.145pb_PFElectron_PF2PATJets_PFMET.root",
20 'pj1' : "/storage/results/QCD_Estimate/Preapproval3/pj1_36.145pb_PFElectron_PF2PATJets_PFMET.root",
21 'pj2' : "/storage/results/QCD_Estimate/Preapproval3/pj2_36.145pb_PFElectron_PF2PATJets_PFMET.root",
22 'pj3' : "/storage/results/QCD_Estimate/Preapproval3/pj3_36.145pb_PFElectron_PF2PATJets_PFMET.root"}
23
24 histsNames = ['mttbar_conversions_allBtags',
25 'mttbar_conversions_withMETAndAsymJets_allBtags',
26 'mttbar_antiIsolated_withMETAndAsymJets_allBtags',
27 'mttbar_antiIsolated_allBtags',
28 'mttbar_controlRegion_withMETAndAsymJets_allBtags',
29 'mttbar_controlRegion_allBtags']
30
31 # HistGetter.samplefiles = files
32 # HG = HistGetter()
33 setStyle()
34 hists = getHistsFromFiles( histsNames, files )
35 hists = addSampleSum( hists )
36 hists = applyDefaultStylesAndColors( hists )
37
38 hists = rebin( hists, 50, 'mttbar*' )
39 hists = setXRange( hists, ( 300, 1800 ), 'mttbar*' )
40
41 hists = setXTitle( hists, 'm(t#bar{t})/GeV', 'mttbar*' )
42 hists = setYTitle( hists, 'Events/(50 GeV)', 'mttbar*' )
43
44 hists = makeDetailedMCStack( hists )
45
46 normConv = hists['data']['mttbar_conversions_withMETAndAsymJets_allBtags']
47 normContr = hists['data']['mttbar_controlRegion_withMETAndAsymJets_allBtags']
48 normAnti = hists['data']['mttbar_antiIsolated_withMETAndAsymJets_allBtags']
49
50 normConv.SetYTitle("a.u/50GeV");
51
52 normConv.Sumw2()
53 normContr.Sumw2()
54 normAnti.Sumw2()
55
56 normConv.Scale(1/normConv.Integral())
57 normContr.Scale(1/normContr.Integral())
58 normAnti.Scale(1/normAnti.Integral())
59
60 diff = normConv.Clone()
61 diff.Divide(normAnti)
62 line = TLine(300, 1, 1800, 1)
63 line.SetLineColor(1)
64 line.SetLineWidth(4)
65
66
67 c = TCanvas("cname", 'cname', 1920, 1080)
68 diff.SetYTitle("conversions/non-iso electrons /50GeV");
69 diff.Draw('error')
70 line.Draw('same')
71 c.SaveAs('shapeRatio_conversions_NonIsolatedElectrons.png')
72
73 diff = normConv.Clone()
74 diff.Divide(normContr)
75
76 c = TCanvas("cname2", 'cname2', 1920, 1080)
77 diff.SetYTitle("conversions/fake electrons /50GeV");
78 diff.Draw('error')
79 line.Draw('same')
80 c.SaveAs('shapeRatio_conversions_fakeElectrons.png')
81
82 c = TCanvas("cname3", 'cname3', 1920, 1080)
83
84 normConv.SetFillColor(kYellow)
85 normConv.SetFillStyle( 1001 )
86
87 normContr.SetFillColor(kAzure - 2)
88 normContr.SetFillStyle( 3005 )
89
90 normAnti.SetFillColor(kRed + 1)
91 normAnti.SetFillStyle( 3004 )
92 normConv.GetYaxis().SetRangeUser(0, 0.2);
93 normConv.Draw('hist')
94 normContr.Draw('hist same')
95 normAnti.Draw('hist same')
96
97 leg = TLegend(0.696, 0.35, 0.94, 0.92);
98 leg.SetBorderSize(0);
99 leg.SetLineStyle(0);
100 leg.SetTextFont(42);
101 leg.SetFillStyle(0);
102
103 leg.AddEntry(normConv, "conversions", "f");
104 leg.AddEntry(normContr, "fake electrons", "f");
105 leg.AddEntry(normAnti, "non isolated electrons", "f");
106 leg.Draw()
107
108 c.SaveAs('shape_comparison.png')
109
110 c = TCanvas("cname4", 'cname4', 1920, 1080)
111 histname = 'mttbar_antiIsolated_withMETAndAsymJets_allBtags'
112 hist = hists['allMCDetailed'][histname]
113 hists['enri1'][histname].GetYaxis().SetRangeUser(0, hist.GetMaximum()*1.4);
114 hists['enri1'][histname].Draw('hist')
115 hist.Draw('hist same')
116
117 leg = TLegend(0.696, 0.35, 0.94, 0.92);
118 leg.SetBorderSize(0);
119 leg.SetLineStyle(0);
120 leg.SetTextFont(42);
121 leg.SetFillStyle(0);
122
123 leg.AddEntry(hists['enri1'][histname], "QCD EMEnr. 20to30", "f");
124 leg.AddEntry(hists['enri2'][histname], "QCD EMEnr. 30to80", "f");
125 leg.AddEntry(hists['enri3'][histname], "QCD EMEnr. 80to170", "f");
126 leg.AddEntry(hists['bce1'][histname], "QCD BCToE. 20to30", "f");
127 leg.AddEntry(hists['bce2'][histname], "QCD BCToE. 30to80", "f");
128 leg.AddEntry(hists['bce3'][histname], "QCD BCToE. 80to170", "f");
129 leg.AddEntry(hists['pj1'][histname], "QCD #gamma + jets 40to100", "f");
130 leg.AddEntry(hists['pj2'][histname], "QCD #gamma + jets 100to200", "f");
131 leg.AddEntry(hists['pj3'][histname], "QCD #gamma + jets 200toINF", "f");
132 leg.Draw()
133
134 c.SaveAs('detailed_MC_NonIsoElectrons.png')
135
136