34 from __future__
import division
37 OPTION =
"StatisticalPlusSystematicAverage"
40 print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
41 print ">>>>> METHOD TO AVERAGE MUONS AND ELECTRONS is: '%s'" % (OPTION)
42 print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
54 absCorrWenu = Wenu*
sqrt(0.008**2+0.0116**2)
56 print "\nWenu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wenu, absStatWenu, absUncWenu, absCorrWenu, Wenu*relSysLumi)
57 print " Systematics >>>>>>>"
58 print "\tUncorrelated with muons: %.2f %%" % (100./Wenu*absUncWenu)
59 print "\tTheory: %.2f %%" % (100./Wenu*absCorrWenu)
60 print "\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wenu*
sqrt(absUncWenu**2+absCorrWenu**2))
63 absStatWplusenu = 0.0793
64 absCorrWplusenu = Wplusenu*
sqrt(0.009**2+0.0133**2)
65 absUncWplusenu = 0.3446
66 print "\nWplusenu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wplusenu, absStatWplusenu, absUncWplusenu, absCorrWplusenu, Wplusenu*relSysLumi)
67 print " Systematics >>>>>>>"
68 print "\tUncorrelated with muons: %.2f %%" % (100./Wplusenu*absUncWplusenu)
69 print "\tTheory: %.2f %%" % (100./Wplusenu*absCorrWplusenu)
70 print "\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wplusenu*
sqrt(absUncWplusenu**2+absCorrWplusenu**2))
73 absStatWminusenu = 0.0690
74 absCorrWminusenu = Wminusenu*
sqrt(0.015**2+0.0090**2)
75 absUncWminusenu = 0.2432
76 print "\nWminusenu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wminusenu, absStatWminusenu, absUncWminusenu, absCorrWminusenu, Wminusenu*relSysLumi)
77 print " Systematics >>>>>>>"
78 print "\tUncorrelated with muons: %.2f %%" % (100./Wminusenu*absUncWminusenu)
79 print "\tTheory: %.2f %%" % (100./Wminusenu*absCorrWminusenu)
80 print "\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wminusenu*
sqrt(absUncWminusenu**2+absCorrWminusenu**2))
84 absCorrZee = Zee*
sqrt(0.011**2+0.0134**2)
86 print "\nZee cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Zee, absStatZee, absUncZee, absCorrZee, Zee*relSysLumi)
87 print " Systematics >>>>>>>"
88 print "\tUncorrelated with muons: %.2f %%" % (100./Zee*absUncZee)
89 print "\tTheory: %.2f %%" % (100./Zee*absCorrZee)
90 print "\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Zee*
sqrt(absUncZee**2+absCorrZee**2))
92 Ratioenu = Wplusenu/Wminusenu
93 absStatRatioenu = 0.02883
94 absCorrRatioenu = Ratioenu*
sqrt(0.017**2+0.0127**2)
95 absUncRatioenu = 0.076
96 print "\nRatioenu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.)" % (Ratioenu, absStatRatioenu, absUncRatioenu, absCorrRatioenu)
97 print " Systematics >>>>>>>"
98 print "\tUncorrelated with muons: %.2f %%" % (100./Ratioenu*absUncRatioenu)
99 print "\tTheory: %.2f %%" % (100./Ratioenu*absCorrRatioenu)
100 print "\tTOTAL: %.2f %%\n" % (100./Ratioenu*
sqrt(absUncRatioenu**2+absCorrRatioenu**2))
104 absCorrWZe = WZe*
sqrt(0.009**2+0.0103**2)
106 print "\nWZe cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.)" % (WZe, absStatWZe, absUncWZe, absCorrWZe)
107 print " Systematics >>>>>>>"
108 print "\tUncorrelated with muons: %.2f %%" % (100./WZe*absUncWZe)
109 print "\tTheory: %.2f %%" % (100./WZe*absCorrWZe)
110 print "\tTOTAL: %.2f %%\n" % (100./WZe*
sqrt(absUncWZe**2+absCorrWZe**2))
115 absCorrWmunu = Wmunu*
sqrt(0.011**2+0.0136**2)
117 relUncPreTrig = 0.5e-2
118 relUncSysEff = 0.5e-2
119 relUncEff =
sqrt(relUncFit**2+relUncPreTrig**2+relUncSysEff**2)
120 relUncMomRes = 0.3e-2
121 relUncRecoil = 0.4e-2
123 relUncBkg =
sqrt(2.0e-2**2+0.2e-2**2)
124 absUncWmunu=Wmunu*
sqrt(relUncEff**2+relUncMomRes**2+relUncRecoil**2+relUncMCStat**2+relUncBkg**2)
125 print "\nWmunu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wmunu, absStatWmunu, absUncWmunu, absCorrWmunu, Wmunu*relSysLumi)
126 print " Systematics >>>>>>>"
127 print "\tEfficiency(Zfit,Pretrig,Z->W): %.2f %%" % (100*relUncEff)
128 print "\tMomentum scale/resolution: %.2f %%" % (100*relUncMomRes)
129 print "\tBackground subtraction: %.2f %%" % (100*relUncBkg)
130 print "\tSignal Recoil modeling: %.2f %%" % (100*relUncRecoil)
131 print "\tMC statistics (acceptance): %.2f %%" % (100*relUncMCStat)
132 print "\tTheory: %.2f %%" % (100./Wmunu*absCorrWmunu)
133 print "\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wmunu*
sqrt(absUncWmunu**2+absCorrWmunu**2))
136 absStatWplusmunu = 0.069
137 absCorrWplusmunu = Wplusmunu*
sqrt(0.013**2+0.0142**2)
139 relUncPreTrig = 0.5e-2
140 relUncSysEff = 0.5e-2
141 relUncEff =
sqrt(relUncFit**2+relUncPreTrig**2+relUncSysEff**2)
142 relUncMomRes = 0.3e-2
143 relUncRecoil = 0.4e-2
144 relUncMCStat = 1.4e-3
145 relUncBkg =
sqrt(1.7e-2**2+0.2e-2**2)
146 absUncWplusmunu=Wplusmunu*
sqrt(relUncEff**2+relUncMomRes**2+relUncRecoil**2+relUncMCStat**2+relUncBkg**2)
147 print "\nWplusmunu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wplusmunu, absStatWplusmunu, absUncWplusmunu, absCorrWplusmunu, Wplusmunu*relSysLumi)
148 print " Systematics >>>>>>>"
149 print "\tEfficiency(Zfit,Pretrig,Z->W): %.2f %%" % (100*relUncEff)
150 print "\tMomentum scale/resolution: %.2f %%" % (100*relUncMomRes)
151 print "\tBackground subtraction: %.2f %%" % (100*relUncBkg)
152 print "\tSignal Recoil modeling: %.2f %%" % (100*relUncRecoil)
153 print "\tMC statistics (acceptance): %.2f %%" % (100*relUncMCStat)
154 print "\tTheory: %.2f %%" % (100./Wplusmunu*absCorrWplusmunu)
155 print "\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wplusmunu*
sqrt(absUncWplusmunu**2+absCorrWplusmunu**2))
158 absStatWminusmunu = 0.057
159 absCorrWminusmunu = Wminusmunu*
sqrt(0.019**2+0.0126**2)
161 relUncPreTrig = 0.5e-2
162 relUncSysEff = 0.5e-2
163 relUncEff =
sqrt(relUncFit**2+relUncPreTrig**2+relUncSysEff**2)
164 relUncMomRes = 0.3e-2
165 relUncRecoil = 0.4e-2
166 relUncMCStat = 1.4e-3
167 relUncBkg =
sqrt(2.3e-2**2+0.2e-2**2)
168 absUncWminusmunu=Wminusmunu*
sqrt(relUncEff**2+relUncMomRes**2+relUncRecoil**2+relUncMCStat**2+relUncBkg**2)
169 print "\nWminusmunu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wminusmunu, absStatWminusmunu, absUncWminusmunu, absCorrWminusmunu, Wminusmunu*relSysLumi)
170 print " Systematics >>>>>>>"
171 print "\tEfficiency(Zfit,Pretrig,Z->W): %.2f %%" % (100*relUncEff)
172 print "\tMomentum scale/resolution: %.2f %%" % (100*relUncMomRes)
173 print "\tBackground subtraction: %.2f %%" % (100*relUncBkg)
174 print "\tSignal Recoil modeling: %.2f %%" % (100*relUncRecoil)
175 print "\tMC statistics (acceptance): %.2f %%" % (100*relUncMCStat)
176 print "\tTheory: %.2f %%" % (100./Wminusmunu*absCorrWminusmunu)
177 print "\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wminusmunu*
sqrt(absUncWminusmunu**2+absCorrWminusmunu**2))
181 absCorrZmumu = Zmumu*
sqrt(0.012**2+0.0158**2)
184 relUncMomRes = 0.2e-2
185 relUncMCStat = 0.4e-2
186 relUncBkg =
sqrt(relUncFit**2+0.2e-2**2)
187 absUncZmumu=Zmumu*
sqrt(relUncEff**2+relUncMomRes**2+relUncBkg**2+relUncMCStat**2)
188 print "\nZmumu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Zmumu, absStatZmumu, absUncZmumu, absCorrZmumu, Zmumu*relSysLumi)
189 print " Systematics >>>>>>>"
190 print "\tEfficiency(Pretriggering): %.2f %%" % (100*relUncEff)
191 print "\tMomentum scale/resolution: %.2f %%" % (100*relUncMomRes)
192 print "\tBackground subtraction/fit: %.2f %%" % (100*relUncBkg)
193 print "\tMC statistics (acceptance): %.2f %%" % (100*relUncMCStat)
194 print "\tTheory: %.2f %%" % (100./Zmumu*absCorrZmumu)
195 print "\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Zmumu*
sqrt(absUncZmumu**2+absCorrZmumu**2))
197 Ratiomunu = Wplusmunu/Wminusmunu
198 absStatRatiomunu = 0.026
199 absCorrRatiomunu = Ratiomunu*
sqrt(0.021**2+0.0119**2)
201 relUncMomRes = 0.3e-2
202 relUncMCStat =
sqrt(2)*1.4e-3
204 absUncRatiomunu = Ratiomunu*
sqrt(relUncEff**2+relUncMomRes**2+relUncMCStat**2+relUncBkg**2)
205 print "\nRatiomunu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.)" % (Ratiomunu, absStatRatiomunu, absUncRatiomunu, absCorrRatiomunu)
206 print " Systematics >>>>>>>"
207 print "\tEfficiency(W+ versus W- tests): %.2f %%" % (100*relUncEff)
208 print "\tMomentum scale/resolution: %.2f %%" % (100*relUncMomRes)
209 print "\tBackground subtraction: %.2f %%" % (100*relUncBkg)
210 print "\tMC statistics (acceptance): %.2f %%" % (100*relUncMCStat)
211 print "\tTheory: %.2f %%" % (100./Ratiomunu*absCorrRatiomunu)
212 print "\tTOTAL: %.2f %%\n" % (100./Ratiomunu*
sqrt(absUncRatiomunu**2+absCorrRatiomunu**2))
216 absCorrWZmu = WZmu*
sqrt(0.011**2+0.0135**2)
218 relUncMomResW = 0.3e-2
219 relUncMomResZ = 0.2e-2
220 relSysSubtract =
sqrt(relUncEffW**2+relUncMomResW**2+relUncMomResZ**2)
221 relSysAdd =
abs(relUncMomResW-relUncMomResZ)
222 absUncWZmu = WZmu*
sqrt((absUncWmunu/Wmunu)**2 + (absUncZmumu/Zmumu)**2 - relSysSubtract**2 + relSysAdd**2)
223 print "\nWZmu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.)" % (WZmu, absStatWZmu, absUncWZmu, absCorrWZmu)
224 print " STATISTICAL UNCERTAINTY INCLUDES EFFICIENCY (via Zmumu fit)"
225 print " Systematics >>>>>>>"
226 print "\tUncorrelated with electrons: %.2f %%" % (100./WZmu*absUncWZmu)
227 print "\tTheory: %.2f %%" % (100./WZmu*absCorrWZmu)
228 print "\tTOTAL: %.2f %%\n" % (100./WZmu*
sqrt(absUncWZmu**2+absCorrWZmu**2))
236 absSysLumi = xsection*relSysLumi
237 print "VBTF inputs: %s = %.4f +- %.4f (stat.) +- %.4f (exp.) +- %.4f (the.) +- %.4f (lumi) [nb]" % (title, xsection, exsection, sysUnc, sysCor, absSysLumi)
240 def vbtfXSectionAverage(title, xsection1, xsection2, exsection1, exsection2, sysUnc1, sysUnc2, sysCor1, sysCor2, relSysLumi):
241 if OPTION==
"StatisticalAverage":
246 V11 = exsection1**2+sysUnc1**2+sysCor1**2
247 V22 = exsection2**2+sysUnc2**2+sysCor2**2
248 V12 = sysCor1*sysCor2
250 a1 = (V22-V12)/(V11+V22-2*V12)
251 a2 = (V11-V12)/(V11+V22-2*V12)
252 average = a1*xsection1 + a2*xsection2
253 errstat =
sqrt(a1**2*exsection1**2+a2**2*exsection2**2)
254 errunco =
sqrt(a1**2*sysUnc1**2 + a2**2*sysUnc2**2)
255 errtheo =
sqrt(a1**2*sysCor1**2 + a2**2*sysCor2**2 + 2*a1*a2*sysCor1*sysCor2)
256 errsyst =
sqrt(errunco**2+errtheo**2)
258 print "VBTF average: %s = %.4f +- %.4f (stat.) [nb]" % (title, average, errstat)
260 absSysLumi = average*relSysLumi
261 print "\tVBTF systematics (1): +- %.4f (exp) +- %.4f (the) +- %.4f (lumi) [nb]" % (errunco, errtheo, absSysLumi)
262 print "\tVBTF systematics (2): +- %.4f (exp+the) +- %.4f (lumi) [nb]" % (errsyst, absSysLumi)
266 print "VBTF inputs: %s = %.4f +- %.4f (stat.) +- %.4f (exp.) +- %.4f (the.)" % (title, ratio, absStat, sysUnc, sysCor)
269 def vbtfRatioAverage(title, ratio1, ratio2, eratio1, eratio2, sysUnc1, sysUnc2, sysCor1, sysCor2):
270 if OPTION==
"StatisticalAverage":
275 V11 = eratio1**2+(sysUnc1**2+sysCor1**2)
276 V22 = eratio2**2+(sysUnc2**2+sysCor2**2)
277 V12 = sysCor1*sysCor2
279 a1 = (V22-V12)/(V11+V22-2*V12)
280 a2 = (V11-V12)/(V11+V22-2*V12)
281 average = a1*ratio1 + a2*ratio2
282 errstat =
sqrt(a1**2*eratio1**2+a2**2*eratio2**2)
283 errunco =
sqrt(a1**2*sysUnc1**2 + a2**2*sysUnc2**2)
284 errtheo =
sqrt(a1**2*sysCor1**2 + a2**2*sysCor2**2 + 2*a1*a2*sysCor1*sysCor2)
285 errsyst =
sqrt(errunco**2+errtheo**2)
287 print "VBTF average: %s = %.4f +- %.4f (stat.)" % (title, average, errstat)
289 print "\tVBTF systematics (1): +- %.4f (exp) +- %.4f (the)" % (errunco, errtheo)
290 print "\tVBTF systematics (2): +- %.4f (exp+the)" % (errsyst)
299 print "\n>>>>>>>>>>>>>>>"
300 vbtfXSectionCheck(
"W -> munu cross section",Wmunu,absStatWmunu,absUncWmunu,absCorrWmunu,relSysLumi)
301 vbtfXSectionCheck(
"W -> enu cross section",Wenu,absStatWenu,absUncWenu,absCorrWenu,relSysLumi)
302 vbtfXSectionAverage(
"W -> lnu cross section",Wmunu,Wenu,absStatWmunu,absStatWenu,absUncWmunu,absUncWenu,absCorrWmunu,absCorrWenu,relSysLumi)
307 print "\n>>>>>>>>>>>>>>>"
308 vbtfXSectionCheck(
"W+ -> munu cross section",Wplusmunu,absStatWplusmunu,absUncWplusmunu,absCorrWplusmunu,relSysLumi)
309 vbtfXSectionCheck(
"W+ -> enu cross section",Wplusenu,absStatWplusenu,absUncWplusenu,absCorrWplusenu,relSysLumi)
310 vbtfXSectionAverage(
"W+ -> lnu cross section",Wplusmunu,Wplusenu,absStatWplusmunu,absStatWplusenu,absUncWplusmunu,absUncWplusenu,absCorrWplusmunu,absCorrWplusenu,relSysLumi)
315 print "\n>>>>>>>>>>>>>>>"
316 vbtfXSectionCheck(
"W- -> munu cross section",Wminusmunu,absStatWminusmunu,absUncWminusmunu,absCorrWminusmunu,relSysLumi)
317 vbtfXSectionCheck(
"W- -> enu cross section",Wminusenu,absStatWminusenu,absUncWminusenu,absCorrWminusenu,relSysLumi)
318 vbtfXSectionAverage(
"W- -> lnu cross section",Wminusmunu,Wminusenu,absStatWminusmunu,absStatWminusenu,absUncWminusmunu,absUncWminusenu,absCorrWminusmunu,absCorrWminusenu,relSysLumi)
324 print "\n>>>>>>>>>>>>>>>"
325 vbtfRatioCheck(
"W+ / W- cross section ratio, muon channel",Ratiomunu,absStatRatiomunu,absUncRatiomunu,absCorrRatiomunu)
326 vbtfRatioCheck(
"W+ / W- cross section ratio, electron channel",Ratioenu,absStatRatioenu,absUncRatioenu,absCorrRatioenu)
327 vbtfRatioAverage(
"W+ / W- cross section ratio",Ratiomunu,Ratioenu,absStatRatiomunu,absStatRatioenu,absUncRatiomunu,absUncRatioenu,absCorrRatiomunu,absCorrRatioenu)
333 print "\n>>>>>>>>>>>>>>>"
334 vbtfXSectionCheck(
"Z -> mumu cross section",Zmumu,absStatZmumu,absUncZmumu,absCorrZmumu,relSysLumi)
335 vbtfXSectionCheck(
"Z -> ee cross section",Zee,absStatZee,absUncZee,absCorrZee,relSysLumi)
336 vbtfXSectionAverage(
"Z -> ll cross section",Zmumu,Zee,absStatZmumu,absStatZee,absUncZmumu,absUncZee,absCorrZmumu,absCorrZee,relSysLumi)
342 print "\n>>>>>>>>>>>>>>>"
343 vbtfRatioCheck(
"W/Z ratio muons",WZmu,absStatWZmu,absUncWZmu,absCorrWZmu)
344 vbtfRatioCheck(
"W/Z ratio electrons",WZe,absStatWZe,absUncWZe,absCorrWZe)
345 vbtfRatioAverage(
"W/Z ratio",WZmu,WZe,absStatWZmu,absStatWZe,absUncWZmu,absUncWZe,absCorrWZmu,absCorrWZe)
Abs< T >::type abs(const T &t)
def vbtfXSectionCheck
Utility functions.