17 |
|
help="figure of merit to be used to weight the plots. Possibilities: s/b, s/sqrt(b)") |
18 |
|
parser.add_option("-C", "--config", dest="config", default=[], action="append", |
19 |
|
help="configuration file") |
20 |
+ |
parser.add_option("-S", "--subtructed", dest="sub", default="False", |
21 |
+ |
help="subtruction plot") |
22 |
+ |
parser.add_option("-L", "--rescale", dest="rescale", default="False", |
23 |
+ |
help="rescale by 1/max_weight") |
24 |
+ |
|
25 |
|
(opts, args) = parser.parse_args(argv) |
26 |
|
if opts.config =="": |
27 |
|
opts.config = "config" |
40 |
|
histos = get_th1(fName) |
41 |
|
for histo in histos: |
42 |
|
if 'data' in histo.GetName(): continue |
43 |
< |
for i in range(9,11): |
43 |
> |
for i in range(7,9): |
44 |
|
if 'VH' in histo.GetName(): |
45 |
|
s+=histo.GetBinContent(i) |
46 |
|
else: |
54 |
|
histos = get_th1(fName) |
55 |
|
for histo in histos: |
56 |
|
if 'data' in histo.GetName(): continue |
57 |
< |
for i in range(9,11): |
57 |
> |
for i in range(7,9): |
58 |
|
if 'VH' in histo.GetName(): |
59 |
|
s+=histo.GetBinContent(i) |
60 |
|
else: |
77 |
|
|
78 |
|
stack = StackMaker(config,var,region,signalRegion) |
79 |
|
|
75 |
– |
# fileList = [ |
76 |
– |
# '/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wln_ch1_Wenu3_PreFit.root', |
77 |
– |
# '/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZeeHighPt_PreFit.root', |
78 |
– |
# '/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Znn_HighPt_ZnunuHighPt_8TeV_PreFit.root', |
79 |
– |
# '/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wln_ch2_Wmunu3_PreFit.root', |
80 |
– |
# '/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZmmHighPt_PreFit.root'] |
81 |
– |
|
82 |
– |
|
83 |
– |
fileList = [ |
84 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZmmMedPt_PostFit_s.root', |
85 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZeeMedPt_PostFit_s.root', |
86 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Znn_MedPt_ZnunuMedPt_8TeV_PostFit_s.root', |
87 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wln_ch2_Wmunu2_PostFit_s.root', |
88 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Znn_LowPt_ZnunuLowPt_8TeV_PostFit_s.root', |
89 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZmmLowPt_PostFit_s.root', |
90 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZeeLowPt_PostFit_s.root', |
91 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wln_ch1_Wenu_PostFit_s.root', |
92 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wln_ch2_Wmunu_PostFit_s.root', |
93 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wln_ch1_WenuHighPt_PostFit_s.root', |
94 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZeeHighPt_PostFit_s.root', |
95 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Znn_HighPt_ZnunuHighPt_8TeV_PostFit_s.root', |
96 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wln_ch2_WmunuHighPt_PostFit_s.root', |
97 |
– |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZmmHighPt_PostFit_s.root'] |
98 |
– |
|
99 |
– |
|
100 |
– |
# #tau |
101 |
– |
# /shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wtn_Wtn_PostFit_s.root |
102 |
– |
|
103 |
– |
|
104 |
– |
# #Med |
105 |
– |
# /shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZmmMedPt_PostFit_s.root |
106 |
– |
# /shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZeeMedPt_PostFit_s.root |
107 |
– |
# /shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Znn_MedPt_ZnunuMedPt_8TeV_PostFit_s.root |
108 |
– |
# /shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wln_ch2_Wmunu2_PostFit_s.root |
109 |
– |
|
110 |
– |
# #Low |
111 |
– |
|
112 |
– |
# /shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Znn_LowPt_ZnunuLowPt_8TeV_PostFit_s.root |
113 |
– |
# /shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZmmLowPt_PostFit_s.root |
114 |
– |
# /shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Zll_ZeeLowPt_PostFit_s.root |
115 |
– |
# /shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wln_ch1_Wenu_PostFit_s.root |
116 |
– |
# /shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit/MJJ_Wln_ch2_Wmunu_PostFit_s.root |
80 |
|
|
81 |
+ |
fileList = [] |
82 |
+ |
|
83 |
+ |
#MedPt |
84 |
+ |
fileList += [ '/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Zll_ZmmMedPt_PostFit_s.root', |
85 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Zll_ZeeMedPt_PostFit_s.root', |
86 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Znn_MedPt_ZnunuMedPt_8TeV_PostFit_s.root', |
87 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Wln_ch2_Wmunu2_PostFit_s.root'] |
88 |
+ |
#LowPt |
89 |
+ |
fileList += [ '/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Znn_LowPt_ZnunuLowPt_8TeV_PostFit_s.root', |
90 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Zll_ZmmLowPt_PostFit_s.root', |
91 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Zll_ZeeLowPt_PostFit_s.root', |
92 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Wln_ch1_Wenu_PostFit_s.root', |
93 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Wln_ch2_Wmunu_PostFit_s.root'] |
94 |
+ |
#highPt |
95 |
+ |
fileList += [ '/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Wln_ch1_WenuHighPt_PostFit_s.root', |
96 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Zll_ZeeHighPt_PostFit_s.root', |
97 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Znn_HighPt_ZnunuHighPt_8TeV_PostFit_s.root', |
98 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Wln_ch2_WmunuHighPt_PostFit_s.root', |
99 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Zll_ZmmHighPt_PostFit_s.root', |
100 |
+ |
'/shome/bortigno/VHbbAnalysis/postPreApp//LHCP_PostFit_v0.1/MJJ_Wtn_Wtn_PostFit_s.root'] |
101 |
+ |
|
102 |
+ |
# 7tev |
103 |
|
fileList += ['ZeeLowPt_7TeV.root','ZmmLowPt_7TeV.root','WmnLowPt_7TeV.root','ZnnLowPt_7TeV.root'] |
104 |
|
fileList += ['ZeeHighPt_7TeV.root','ZmmHighPt_7TeV.root','WmnHighPt_7TeV.root','ZnnHighPt_7TeV.root'] |
105 |
|
|
106 |
+ |
|
107 |
|
histosL = [] |
108 |
+ |
|
109 |
+ |
max_sb = 0 |
110 |
+ |
max_ssb = 0 |
111 |
+ |
for file in fileList: |
112 |
+ |
if max_sb < get_s_over_b(file): |
113 |
+ |
max_sb = get_s_over_b(file) |
114 |
+ |
if max_ssb < get_s_over_sb(file): |
115 |
+ |
max_ssb = get_s_over_sb(file) |
116 |
+ |
|
117 |
+ |
print max_ssb |
118 |
+ |
print max_sb |
119 |
+ |
|
120 |
|
for file in fileList: |
121 |
|
print file |
122 |
|
print get_s_over_b(file) |
123 |
+ |
if eval(opts.rescale) == False: |
124 |
+ |
max_sb = 1. |
125 |
+ |
max_ssb = 1. |
126 |
|
for th1 in get_th1(file): |
127 |
< |
if opts.fom == 's/b': |
128 |
< |
th1.Scale(10*get_s_over_b(file)) |
129 |
< |
if opts.fom == 's/s+b': |
130 |
< |
th1.Scale(10*get_s_over_sb(file)) |
131 |
< |
|
127 |
> |
th1.Sumw2() |
128 |
> |
if 's/b' in opts.fom: |
129 |
> |
th1.Scale(get_s_over_b(file)/max_sb) |
130 |
> |
elif 's/s+b' in opts.fom: |
131 |
> |
th1.Scale(get_s_over_sb(file)/max_ssb) |
132 |
> |
if 'VV' in th1.GetName(): |
133 |
> |
th1.SetName('VV') |
134 |
|
histosL.append(th1) |
135 |
|
|
136 |
|
print 'histoL' |
142 |
|
|
143 |
|
#append the name just once |
144 |
|
for histo in histosL: |
145 |
< |
typsL.append(histo.GetName()) |
146 |
< |
if 'data' in histo.GetName(): |
145 |
> |
typsL.append(histo.GetName()) |
146 |
> |
if 'data' in histo.GetName(): |
147 |
|
datasL.append(histo) |
148 |
|
|
149 |
|
#datasL.append(datas) |
158 |
|
#if signalRegion: |
159 |
|
# stack.overlay = ['VH','VVHF','VVLF'] |
160 |
|
# stack.options['pdfName'] = stack.options['pdfName'].replace('.pdf','_preFit.pdf') |
161 |
< |
stack.options['pdfName'] = stack.options['pdfName'].replace('.pdf','_combined78tev_postFit_s_over_sb.pdf') |
161 |
> |
|
162 |
> |
appendix = '' |
163 |
> |
if(eval(opts.rescale) == True): |
164 |
> |
appendix = '_rescaled_' |
165 |
> |
|
166 |
> |
if 's/s+b' in opts.fom: |
167 |
> |
stack.options['pdfName'] = stack.options['pdfName'].replace('.pdf','_combined78tev_postFit_s_over_sb'+appendix+'.pdf') |
168 |
> |
elif 's/b' in opts.fom: |
169 |
> |
stack.options['pdfName'] = stack.options['pdfName'].replace('.pdf','_combined78tev_postFit_s_over_b'+appendix+'.pdf') |
170 |
> |
else: |
171 |
> |
stack.options['pdfName'] = stack.options['pdfName'].replace('.pdf','_unweighted.pdf') |
172 |
> |
|
173 |
|
# stack.options['pdfName'] = stack.options['pdfName'].replace('.pdf','_highPt_7tev.pdf') |
174 |
|
# stack.options['pdfName'] = stack.options['pdfName'].replace('.pdf','_combined_postFit_s_over_b_Hpt_weight_1.pdf' |
175 |
|
stack.lumi = 19040 |
176 |
< |
stack.doPlot() |
177 |
< |
|
178 |
< |
# stack.options['pdfName'] = stack.options['pdfName'].replace('.pdf','_subtructed.pdf') |
179 |
< |
# stack.doSubPlot(['VH','VVHF','VVLF']) |
176 |
> |
|
177 |
> |
|
178 |
> |
mjj_sub = eval(opts.sub) |
179 |
> |
|
180 |
> |
if mjj_sub == False: |
181 |
> |
stack.doPlot() |
182 |
> |
elif mjj_sub == True: |
183 |
> |
stack.options['pdfName'] = stack.options['pdfName'].replace('.pdf','_subtracted.pdf') |
184 |
> |
stack.doSubPlot(['VH','VV']) |
185 |
|
print 'i am done!\n' |
186 |
|
|
187 |
|
|