CMS 3D CMS Logo

Averages_36Invpb.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
33 
34 from __future__ import division
35 from __future__ import print_function
36 from math import *
37 
38 OPTION = "StatisticalPlusSystematicAverage"
39 #OPTION= "StatisticalAverage"
40 
41 print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
42 print(">>>>> METHOD TO AVERAGE MUONS AND ELECTRONS is: '%s'" % (OPTION))
43 print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n")
44 
45 
48 
49 # Relative luminosity error
50 relSysLumi = 11e-2
51 
52 # Electron inputs
53 Wenu = 10.221
54 absStatWenu = 0.034
55 absCorrWenu = 0.144 # theory uncertainty
56 absUncWenu = 0.309
57 print("\nWenu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wenu, absStatWenu, absUncWenu, absCorrWenu, Wenu*relSysLumi))
58 print(" Systematics >>>>>>>")
59 print("\tUncorrelated with muons: %.2f %%" % (100./Wenu*absUncWenu))
60 print("\tTheory: %.2f %%" % (100./Wenu*absCorrWenu))
61 print("\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wenu*sqrt(absUncWenu**2+absCorrWenu**2)))
62 
63 Wplusenu = 6.045
64 absStatWplusenu = 0.026
65 absCorrWplusenu = 0.097
66 absUncWplusenu = 0.187
67 print("\nWplusenu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wplusenu, absStatWplusenu, absUncWplusenu, absCorrWplusenu, Wplusenu*relSysLumi))
68 print(" Systematics >>>>>>>")
69 print("\tUncorrelated with muons: %.2f %%" % (100./Wplusenu*absUncWplusenu))
70 print("\tTheory: %.2f %%" % (100./Wplusenu*absCorrWplusenu))
71 print("\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wplusenu*sqrt(absUncWplusenu**2+absCorrWplusenu**2)))
72 
73 Wminusenu = 4.196
74 absStatWminusenu = 0.022
75 absCorrWminusenu = 0.073 # theory uncertainty
76 absUncWminusenu = 0.130
77 print("\nWminusenu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wminusenu, absStatWminusenu, absUncWminusenu, absCorrWminusenu, Wminusenu*relSysLumi))
78 print(" Systematics >>>>>>>")
79 print("\tUncorrelated with muons: %.2f %%" % (100./Wminusenu*absUncWminusenu))
80 print("\tTheory: %.2f %%" % (100./Wminusenu*absCorrWminusenu))
81 print("\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wminusenu*sqrt(absUncWminusenu**2+absCorrWminusenu**2)))
82 
83 Zee = 0.9892
84 absStatZee = 0.0109
85 absCorrZee = 0.01715 # theory uncertainty
86 absUncZee = 0.0446
87 print("\nZee cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Zee, absStatZee, absUncZee, absCorrZee, Zee*relSysLumi))
88 print(" Systematics >>>>>>>")
89 print("\tUncorrelated with muons: %.2f %%" % (100./Zee*absUncZee))
90 print("\tTheory: %.2f %%" % (100./Zee*absCorrZee))
91 print("\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Zee*sqrt(absUncZee**2+absCorrZee**2)))
92 
93 Ratioenu = Wplusenu/Wminusenu
94 absStatRatioenu = 0.0097
95 absCorrRatioenu = 0.0306 # theory uncertainty
96 absUncRatioenu = 0.0453
97 print("\nRatioenu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.)" % (Ratioenu, absStatRatioenu, absUncRatioenu, absCorrRatioenu))
98 print(" Systematics >>>>>>>")
99 print("\tUncorrelated with muons: %.2f %%" % (100./Ratioenu*absUncRatioenu))
100 print("\tTheory: %.2f %%" % (100./Ratioenu*absCorrRatioenu))
101 print("\tTOTAL: %.2f %%\n" % (100./Ratioenu*sqrt(absUncRatioenu**2+absCorrRatioenu**2)))
102 
103 WZe = Wenu/Zee
104 absStatWZe = 0.1190
105 absCorrWZe = 0.1413 # theory uncertainty
106 absUncWZe = 0.2329
107 print("\nWZe cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.)" % (WZe, absStatWZe, absUncWZe, absCorrWZe))
108 print(" Systematics >>>>>>>")
109 print("\tUncorrelated with muons: %.2f %%" % (100./WZe*absUncWZe))
110 print("\tTheory: %.2f %%" % (100./WZe*absCorrWZe))
111 print("\tTOTAL: %.2f %%\n" % (100./WZe*sqrt(absUncWZe**2+absCorrWZe**2)))
112 
113 # Muon inputs
114 Wmunu = 10.03115
115 absStatWmunu = 0.02690
116 absCorrWmunu = Wmunu*sqrt(0.018**2+0.015**2) # theory uncertainty
117 relUncFit = 0.4e-2
118 relUncPreTrig = 0.5e-2
119 relUncSysEff = 0.4e-2
120 relUncEff = sqrt(relUncFit**2+relUncPreTrig**2+relUncSysEff**2)
121 relUncMomRes = 0.1e-2
122 relUncRecoil = 0.4e-2
123 relUncMCStat = 1.4e-3/sqrt(2) # ??
124 relUncBkg = 1.5e-2 #sqrt(2.0e-2**2+0.2e-2**2)
125 absUncWmunu=Wmunu*sqrt(relUncEff**2+relUncMomRes**2+relUncRecoil**2+relUncMCStat**2+relUncBkg**2)
126 absUncWmunu=Wmunu*sqrt(relUncEff**2+relUncMomRes**2+relUncRecoil**2+relUncBkg**2)
127 print("\nWmunu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wmunu, absStatWmunu, absUncWmunu, absCorrWmunu, Wmunu*relSysLumi))
128 print(" Systematics >>>>>>>")
129 print("\tEfficiency(Zfit,Pretrig,Z->W): %.2f %%" % (100*relUncEff))
130 print("\tMomentum scale/resolution: %.2f %%" % (100*relUncMomRes))
131 print("\tBackground subtraction: %.2f %%" % (100*relUncBkg))
132 print("\tSignal Recoil modeling: %.2f %%" % (100*relUncRecoil))
133 print("\tMC statistics (acceptance): %.2f %%" % (100*relUncMCStat))
134 print("\tTheory: %.2f %%" % (100./Wmunu*absCorrWmunu))
135 print("\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wmunu*sqrt(absUncWmunu**2+absCorrWmunu**2)))
136 
137 Wplusmunu = 5.93821
138 absStatWplusmunu = 0.02033
139 absCorrWplusmunu = Wplusmunu*sqrt(0.013**2+0.014**2) # theory uncertainty
140 relUncFit = 1.3e-2
141 relUncPreTrig = 0.5e-2
142 relUncSysEff = 0.4e-2
143 relUncEff = sqrt(relUncFit**2+relUncPreTrig**2+relUncSysEff**2)
144 relUncMomRes = 0.1e-2
145 relUncRecoil = 0.4e-2
146 relUncMCStat = 1.4e-3
147 relUncBkg = 1.7e-2 #sqrt(1.7e-2**2+0.2e-2**2)
148 absUncWplusmunu=Wplusmunu*sqrt(relUncEff**2+relUncMomRes**2+relUncRecoil**2+relUncMCStat**2+relUncBkg**2)
149 print("\nWplusmunu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wplusmunu, absStatWplusmunu, absUncWplusmunu, absCorrWplusmunu, Wplusmunu*relSysLumi))
150 print(" Systematics >>>>>>>")
151 print("\tEfficiency(Zfit,Pretrig,Z->W): %.2f %%" % (100*relUncEff))
152 print("\tMomentum scale/resolution: %.2f %%" % (100*relUncMomRes))
153 print("\tBackground subtraction: %.2f %%" % (100*relUncBkg))
154 print("\tSignal Recoil modeling: %.2f %%" % (100*relUncRecoil))
155 print("\tMC statistics (acceptance): %.2f %%" % (100*relUncMCStat))
156 print("\tTheory: %.2f %%" % (100./Wplusmunu*absCorrWplusmunu))
157 print("\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wplusmunu*sqrt(absUncWplusmunu**2+absCorrWplusmunu**2)))
158 
159 Wminusmunu = 4.09297
160 absStatWminusmunu = 0.01662
161 absCorrWminusmunu = Wminusmunu*sqrt(0.019**2+0.013**2) # theory uncertainty
162 relUncFit = 1.3e-2
163 relUncPreTrig = 0.5e-2
164 relUncSysEff = 0.4e-2
165 relUncEff = sqrt(relUncFit**2+relUncPreTrig**2+relUncSysEff**2)
166 relUncMomRes = 0.1e-2
167 relUncRecoil = 0.4e-2
168 relUncMCStat = 1.4e-3
169 relUncBkg = 2.3e-2 #sqrt(2.3e-2**2+0.2e-2**2)
170 absUncWminusmunu=Wminusmunu*sqrt(relUncEff**2+relUncMomRes**2+relUncRecoil**2+relUncMCStat**2+relUncBkg**2)
171 print("\nWminusmunu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Wminusmunu, absStatWminusmunu, absUncWminusmunu, absCorrWminusmunu, Wminusmunu*relSysLumi))
172 print(" Systematics >>>>>>>")
173 print("\tEfficiency(Zfit,Pretrig,Z->W): %.2f %%" % (100*relUncEff))
174 print("\tMomentum scale/resolution: %.2f %%" % (100*relUncMomRes))
175 print("\tBackground subtraction: %.2f %%" % (100*relUncBkg))
176 print("\tSignal Recoil modeling: %.2f %%" % (100*relUncRecoil))
177 print("\tMC statistics (acceptance): %.2f %%" % (100*relUncMCStat))
178 print("\tTheory: %.2f %%" % (100./Wminusmunu*absCorrWminusmunu))
179 print("\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Wminusmunu*sqrt(absUncWminusmunu**2+absCorrWminusmunu**2)))
180 
181 Zmumu = 0.961 # 0.893*1.025*1.01
182 absStatZmumu = 0.008 # 0.030*1.025*1.01
183 absCorrZmumu = Zmumu*sqrt(0.012**2+0.016**2) # theory uncertainty
184 relUncEff = 0.5e-2 # pre-triggering
185 #relUncFit= 0.28e-2
186 relUncMomRes = 0.35e-2
187 relUncTrigChanges = 0.1e-2
188 relUncBkg = 0.28e-2 #sqrt(relUncFit**2+0.2e-2**2)
189 absUncZmumu=Zmumu*sqrt(relUncEff**2+relUncMomRes**2+relUncBkg**2+relUncTrigChanges**2)
190 print("\nZmumu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.) +- %.4f (lumi.) [nb]" % (Zmumu, absStatZmumu, absUncZmumu, absCorrZmumu, Zmumu*relSysLumi))
191 print(" Systematics >>>>>>>")
192 print("\tEfficiency(Pretriggering): %.2f %%" % (100*relUncEff))
193 print("\tMomentum scale/resolution: %.2f %%" % (100*relUncMomRes))
194 print("\tBackground subtraction/fit: %.2f %%" % (100*relUncBkg))
195 print("\tMC statistics (acceptance): %.2f %%" % (100*relUncMCStat))
196 print("\tTheory: %.2f %%" % (100./Zmumu*absCorrZmumu))
197 print("\tTOTAL (LUMI excluded): %.2f %%\n" % (100./Zmumu*sqrt(absUncZmumu**2+absCorrZmumu**2)))
198 
199 Ratiomunu = Wplusmunu/Wminusmunu
200 absStatRatiomunu = 0.0078
201 absCorrRatiomunu = Ratiomunu*sqrt(0.021**2+0.0129**2) # theory uncertainty
202 relUncEff = 2.8e-2
203 relUncMomRes = 0.3e-2
204 relUncMCStat = sqrt(2)*1.4e-3
205 relUncBkg = 0.7e-2
206 absUncRatiomunu = Ratiomunu*sqrt(relUncEff**2+relUncMomRes**2+relUncMCStat**2+relUncBkg**2)
207 print("\nRatiomunu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.)" % (Ratiomunu, absStatRatiomunu, absUncRatiomunu, absCorrRatiomunu))
208 print(" Systematics >>>>>>>")
209 print("\tEfficiency(W+ versus W- tests): %.2f %%" % (100*relUncEff))
210 print("\tMomentum scale/resolution: %.2f %%" % (100*relUncMomRes))
211 print("\tBackground subtraction: %.2f %%" % (100*relUncBkg))
212 print("\tMC statistics (acceptance): %.2f %%" % (100*relUncMCStat))
213 print("\tTheory: %.2f %%" % (100./Ratiomunu*absCorrRatiomunu))
214 print("\tTOTAL: %.2f %%\n" % (100./Ratiomunu*sqrt(absUncRatiomunu**2+absCorrRatiomunu**2)))
215 
216 WZmu = Wmunu/Zmumu
217 absStatWZmu = WZmu*sqrt((absStatWmunu/Wmunu)**2+(absStatZmumu/Zmumu)**2)
218 absCorrWZmu = WZmu*sqrt(0.011**2+0.0135**2) # theory uncertainty
219 relUncEffW = 1.3e-2
220 relUncMomResW = 0.3e-2
221 relUncMomResZ = 0.2e-2
222 relSysSubtract = sqrt(relUncEffW**2+relUncMomResW**2+relUncMomResZ**2)
223 relSysAdd = abs(relUncMomResW-relUncMomResZ)
224 absUncWZmu = WZmu*sqrt((absUncWmunu/Wmunu)**2 + (absUncZmumu/Zmumu)**2 - relSysSubtract**2 + relSysAdd**2)
225 print("\nWZmu cross section = %.4f +- %.4f (stat.) +- %.4f (syst.) +- %.4f (theo.)" % (WZmu, absStatWZmu, absUncWZmu, absCorrWZmu))
226 print(" STATISTICAL UNCERTAINTY INCLUDES EFFICIENCY (via Zmumu fit)")
227 print(" Systematics >>>>>>>")
228 print("\tUncorrelated with electrons: %.2f %%" % (100./WZmu*absUncWZmu))
229 print("\tTheory: %.2f %%" % (100./WZmu*absCorrWZmu))
230 print("\tTOTAL: %.2f %%\n" % (100./WZmu*sqrt(absUncWZmu**2+absCorrWZmu**2)))
231 
232 
235 
236 
237 def vbtfXSectionCheck(title, xsection, exsection, sysUnc, sysCor, relSysLumi):
238  absSysLumi = xsection*relSysLumi
239  print("VBTF inputs: %s = %.4f +- %.4f (stat.) +- %.4f (exp.) +- %.4f (the.) +- %.4f (lumi) [nb]" % (title, xsection, exsection, sysUnc, sysCor, absSysLumi))
240 
241 
242 def vbtfXSectionAverage(title, xsection1, xsection2, exsection1, exsection2, sysUnc1, sysUnc2, sysCor1, sysCor2, relSysLumi):
243  if OPTION== "StatisticalAverage":
244  V11 = exsection1**2
245  V22 = exsection2**2
246  V12 = 0
247  else:
248  V11 = exsection1**2+sysUnc1**2+sysCor1**2
249  V22 = exsection2**2+sysUnc2**2+sysCor2**2
250  V12 = sysCor1*sysCor2
251 
252  a1 = (V22-V12)/(V11+V22-2*V12)
253  a2 = (V11-V12)/(V11+V22-2*V12)
254  average = a1*xsection1 + a2*xsection2
255  errstat = sqrt(a1**2*exsection1**2+a2**2*exsection2**2)
256  errunco = sqrt(a1**2*sysUnc1**2 + a2**2*sysUnc2**2)
257  errtheo = sqrt(a1**2*sysCor1**2 + a2**2*sysCor2**2 + 2*a1*a2*sysCor1*sysCor2)
258  errsyst = sqrt(errunco**2+errtheo**2)
259 
260  print("VBTF average: %s = %.4f +- %.4f (stat.) [nb]" % (title, average, errstat))
261 
262  absSysLumi = average*relSysLumi
263  print("\tVBTF systematics (1): +- %.4f (exp) +- %.4f (the) +- %.4f (lumi) [nb]" % (errunco, errtheo, absSysLumi))
264  print("\tVBTF systematics (2): +- %.4f (exp+the) +- %.4f (lumi) [nb]" % (errsyst, absSysLumi))
265 
266 
267 def vbtfRatioCheck(title, ratio, absStat, sysUnc, sysCor):
268  print("VBTF inputs: %s = %.4f +- %.4f (stat.) +- %.4f (exp.) +- %.4f (the.)" % (title, ratio, absStat, sysUnc, sysCor))
269 
270 
271 def vbtfRatioAverage(title, ratio1, ratio2, eratio1, eratio2, sysUnc1, sysUnc2, sysCor1, sysCor2):
272  if OPTION== "StatisticalAverage":
273  V11 = eratio1**2
274  V22 = eratio2**2
275  V12 = 0
276  else:
277  V11 = eratio1**2+(sysUnc1**2+sysCor1**2)
278  V22 = eratio2**2+(sysUnc2**2+sysCor2**2)
279  V12 = sysCor1*sysCor2
280 
281  a1 = (V22-V12)/(V11+V22-2*V12)
282  a2 = (V11-V12)/(V11+V22-2*V12)
283  average = a1*ratio1 + a2*ratio2
284  errstat = sqrt(a1**2*eratio1**2+a2**2*eratio2**2)
285  errunco = sqrt(a1**2*sysUnc1**2 + a2**2*sysUnc2**2)
286  errtheo = sqrt(a1**2*sysCor1**2 + a2**2*sysCor2**2 + 2*a1*a2*sysCor1*sysCor2)
287  errsyst = sqrt(errunco**2+errtheo**2)
288 
289  print("VBTF average: %s = %.4f +- %.4f (stat.)" % (title, average, errstat))
290 
291  print("\tVBTF systematics (1): +- %.4f (exp) +- %.4f (the)" % (errunco, errtheo))
292  print("\tVBTF systematics (2): +- %.4f (exp+the)" % (errsyst))
293 
294 
297 
298 
301 print("\n>>>>>>>>>>>>>>>")
302 vbtfXSectionCheck("W -> munu cross section",Wmunu,absStatWmunu,absUncWmunu,absCorrWmunu,relSysLumi)
303 vbtfXSectionCheck("W -> enu cross section",Wenu,absStatWenu,absUncWenu,absCorrWenu,relSysLumi)
304 vbtfXSectionAverage("W -> lnu cross section",Wmunu,Wenu,absStatWmunu,absStatWenu,absUncWmunu,absUncWenu,absCorrWmunu,absCorrWenu,relSysLumi)
305 
306 
309 print("\n>>>>>>>>>>>>>>>")
310 vbtfXSectionCheck("W+ -> munu cross section",Wplusmunu,absStatWplusmunu,absUncWplusmunu,absCorrWplusmunu,relSysLumi)
311 vbtfXSectionCheck("W+ -> enu cross section",Wplusenu,absStatWplusenu,absUncWplusenu,absCorrWplusenu,relSysLumi)
312 vbtfXSectionAverage("W+ -> lnu cross section",Wplusmunu,Wplusenu,absStatWplusmunu,absStatWplusenu,absUncWplusmunu,absUncWplusenu,absCorrWplusmunu,absCorrWplusenu,relSysLumi)
313 
314 
317 print("\n>>>>>>>>>>>>>>>")
318 vbtfXSectionCheck("W- -> munu cross section",Wminusmunu,absStatWminusmunu,absUncWminusmunu,absCorrWminusmunu,relSysLumi)
319 vbtfXSectionCheck("W- -> enu cross section",Wminusenu,absStatWminusenu,absUncWminusenu,absCorrWminusenu,relSysLumi)
320 vbtfXSectionAverage("W- -> lnu cross section",Wminusmunu,Wminusenu,absStatWminusmunu,absStatWminusenu,absUncWminusmunu,absUncWminusenu,absCorrWminusmunu,absCorrWminusenu,relSysLumi)
321 
322 
326 print("\n>>>>>>>>>>>>>>>")
327 vbtfRatioCheck("W+ / W- cross section ratio, muon channel",Ratiomunu,absStatRatiomunu,absUncRatiomunu,absCorrRatiomunu)
328 vbtfRatioCheck("W+ / W- cross section ratio, electron channel",Ratioenu,absStatRatioenu,absUncRatioenu,absCorrRatioenu)
329 vbtfRatioAverage("W+ / W- cross section ratio",Ratiomunu,Ratioenu,absStatRatiomunu,absStatRatioenu,absUncRatiomunu,absUncRatioenu,absCorrRatiomunu,absCorrRatioenu)
330 
331 
335 print("\n>>>>>>>>>>>>>>>")
336 vbtfXSectionCheck("Z -> mumu cross section",Zmumu,absStatZmumu,absUncZmumu,absCorrZmumu,relSysLumi)
337 vbtfXSectionCheck("Z -> ee cross section",Zee,absStatZee,absUncZee,absCorrZee,relSysLumi)
338 vbtfXSectionAverage("Z -> ll cross section",Zmumu,Zee,absStatZmumu,absStatZee,absUncZmumu,absUncZee,absCorrZmumu,absCorrZee,relSysLumi)
339 
340 
344 print("\n>>>>>>>>>>>>>>>")
345 vbtfRatioCheck("W/Z ratio muons",WZmu,absStatWZmu,absUncWZmu,absCorrWZmu)
346 vbtfRatioCheck("W/Z ratio electrons",WZe,absStatWZe,absUncWZe,absCorrWZe)
347 vbtfRatioAverage("W/Z ratio",WZmu,WZe,absStatWZmu,absStatWZe,absUncWZmu,absUncWZe,absCorrWZmu,absCorrWZe)
Averages_36Invpb.vbtfRatioAverage
def vbtfRatioAverage(title, ratio1, ratio2, eratio1, eratio2, sysUnc1, sysUnc2, sysCor1, sysCor2)
Definition: Averages_36Invpb.py:271
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Averages_36Invpb.vbtfRatioCheck
def vbtfRatioCheck(title, ratio, absStat, sysUnc, sysCor)
Definition: Averages_36Invpb.py:267
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
Averages_36Invpb.vbtfXSectionCheck
def vbtfXSectionCheck(title, xsection, exsection, sysUnc, sysCor, relSysLumi)
Utility functions.
Definition: Averages_36Invpb.py:237
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Averages_36Invpb.vbtfXSectionAverage
def vbtfXSectionAverage(title, xsection1, xsection2, exsection1, exsection2, sysUnc1, sysUnc2, sysCor1, sysCor2, relSysLumi)
Definition: Averages_36Invpb.py:242