ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/plot_systematics.py
Revision: 1.2
Committed: Mon Jun 25 11:43:56 2012 UTC (12 years, 10 months ago) by peller
Content type: text/x-python
Branch: MAIN
CVS Tags: hcpPreAppFreeze, ICHEP8TeV
Changes since 1.1: +94 -94 lines
Log Message:
bugfix and removed conflicts

File Contents

# Content
1 #!/usr/bin/env python
2 import ROOT
3 from ROOT import TFile
4 from Ratio import getRatio
5
6
7 #Abin='RMed4'
8 #mass='125'
9 #channel='Zee'
10 path='~/VHbb/Limits/ICHEP'
11 outpath='~/VHbb/Stacks/ICHEP/'
12
13 xMin=-1
14 xMax=1
15 #MC='ZjCF'
16 #syst='CMS_beff'
17
18 for mass in ['110','115','120','125','130','135']:
19 for Abin in ['RMed4','RTight4']:
20 for channel in ['Zee','Zmm']:
21
22 input = TFile.Open(path+'/vhbb_TH_BDT'+Abin+'_M'+mass+'_'+channel+'.root','read')
23
24
25 for MC in ['VH','ZjLF','ZjHF','VV','TT','s_Top']:
26 for syst in ['JER','JEC','Btag','BtagFake']:
27 #for syst in ['CMS_vhbb_stats_']:
28
29 ROOT.gROOT.SetStyle("Plain")
30 c = ROOT.TCanvas('canvas','canvas', 800, 700)
31 oben = ROOT.TPad('oben','oben',0,0.2 ,1.0,1.0,10)
32 unten = ROOT.TPad('unten','unten',0,0.05,1.0,0.2,10)
33 oben.Draw()
34 unten.Draw()
35 oben.cd()
36 ROOT.gPad.SetTicks(1,1)
37
38
39 Ntotal=input.Get(MC)
40 Utotal=input.Get(MC+syst+'Up')
41 #Utotal=input.Get(MC+syst+MC+'_'+channel+'Up')
42 Dtotal=input.Get(MC+syst+'Down')
43 #Dtotal=input.Get(MC+syst+MC+'_'+channel+'Down')
44 l = ROOT.TLegend(0.11, 0.89, 0.3, 0.7)
45 l.AddEntry(Ntotal,'nominal','PL')
46 l.AddEntry(Utotal,'up','PL')
47 l.AddEntry(Dtotal,'down','PL')
48 Ntotal.SetMarkerStyle(8)
49 Ntotal.SetLineColor(1)
50 Ntotal.SetStats(0)
51 Ntotal.SetTitle(MC +' '+syst)
52 Ntotal.Draw("P0")
53 Ntotal.Draw("same")
54 Utotal.SetLineColor(4)
55 Utotal.SetLineStyle(4)
56 Utotal.SetLineWidth(2)
57 Utotal.Draw("same hist")
58 Dtotal.SetLineColor(2)
59 Dtotal.SetLineStyle(3)
60 Dtotal.SetLineWidth(2)
61 Dtotal.Draw("same hist")
62 l.SetFillColor(0)
63 l.SetBorderSize(0)
64 l.Draw()
65
66
67 unten.cd()
68 ROOT.gPad.SetTicks(1,1)
69
70 ratioU, errorU, ksScoreU, chiScoreU = getRatio(Utotal,Ntotal,xMin,xMax,"Ratio",10,True)
71 ratioD, errorD, ksScoreD, chiScoreD = getRatio(Dtotal,Ntotal,xMin,xMax,"Ratio",10,True)
72
73 ratioU.SetStats(0)
74 ratioU.GetYaxis().SetRangeUser(0.5,1.5)
75 ratioU.GetYaxis().SetNdivisions(502,0)
76 ratioU.GetYaxis().SetLabelSize(0.2)
77 ratioU.GetYaxis().SetTitleSize(0.2)
78 ratioU.GetYaxis().SetTitleOffset(0.2)
79 ratioU.GetXaxis().SetLabelColor(10)
80 ratioU.SetLineColor(4)
81 ratioU.SetLineStyle(4)
82 ratioU.SetLineWidth(2)
83 ratioU.Draw("hist")
84 ratioU.SetTitle("")
85 ratioD.SetStats(0)
86 ratioD.GetYaxis().SetRangeUser(0.5,1.5)
87 ratioD.GetYaxis().SetNdivisions(502,0)
88 ratioD.GetYaxis().SetLabelSize(0.2)
89 ratioD.GetYaxis().SetTitleSize(0.2)
90 ratioD.GetYaxis().SetTitleOffset(0.2)
91 ratioD.GetXaxis().SetLabelColor(10)
92 ratioD.SetLineColor(2)
93 ratioD.SetLineStyle(3)
94 ratioD.SetLineWidth(2)
95 ratioD.Draw("hist same")
96 ratioD.SetTitle("")
97 m_one_line = ROOT.TLine(xMin,1,xMax,1)
98 m_one_line.SetLineStyle(7)
99 m_one_line.SetLineColor(4)
100 m_one_line.Draw("Same")
101
102
103
104 #name = outpath+Abin+'_M'+mass+'_'+channel+'_'+MC+syst+'.png'
105 #c.Print(name)
106 name = outpath+Abin+'_M'+mass+'_'+channel+'_'+MC+syst+'.pdf'
107 c.Print(name)
108
109
110 input.Close()