4 test python and some MEs
7 if __name__ ==
"__main__":
9 parser = argparse.ArgumentParser()
10 parser.add_argument(
"seed", type=int)
11 parser.add_argument(
'unittest_args', nargs=
'*')
12 args = parser.parse_args()
21 from mela
import Mela, TVar
25 9 0 1.0000000E+00 6.2499553E+01 7.8125000E-03 1.3828638E-01
26 21 -1 0 0 501 502 0.00000000000E+00 0.00000000000E+00 5.37086667033E+02 5.37086667033E+02 0.00000000000E+00 0.00000000000E+00 1.
27 21 -1 0 0 502 501 0.00000000000E+00 0.00000000000E+00 -7.27293062837E+00 7.27293062837E+00 0.00000000000E+00 0.00000000000E+00 1.
28 25 2 1 2 0 0 2.66453525910E-15 0.00000000000E+00 5.29813736405E+02 5.44359597662E+02 1.24999105129E+02 0.00000000000E+00 1.
29 23 2 3 3 0 0 -1.07287063341E+00 2.03413884495E+01 2.12763358296E+02 2.18095469074E+02 4.33873698414E+01 0.00000000000E+00 1.
30 23 2 3 3 0 0 1.07287063341E+00 -2.03413884495E+01 3.17050378109E+02 3.26264128588E+02 7.42456477420E+01 0.00000000000E+00 1.
31 11 1 4 4 0 0 -4.96385765951E+00 1.62933935971E+01 2.11696003997E+02 2.12380113632E+02 5.10998597706E-04 0.00000000000E+00 1.
32 -11 1 4 4 0 0 3.89098702611E+00 4.04799485238E+00 1.06735429842E+00 5.71535544142E+00 5.10999912595E-04 0.00000000000E+00 1.
33 12 1 5 5 0 0 8.04215953543E+00 -2.29213235677E+01 2.77968427622E+01 3.69151442044E+01 4.63538696652E-06 0.00000000000E+00 1.
34 -12 1 5 5 0 0 -6.96928890202E+00 2.57993511828E+00 2.89253535347E+02 2.89348984384E+02 5.39479660939E-06 0.00000000000E+00 1.
40 11 60 1.0000000E+00 1.2500000E+02 7.8125000E-03 1.2380607E-01
41 -4 -1 0 0 501 0 0.00000000000E+00 0.00000000000E+00 3.03951895455E+01 3.03951895455E+01 0.00000000000E+00 0.00000000000E+00 1.
42 1 -1 0 0 502 0 0.00000000000E+00 0.00000000000E+00 -7.16454865818E+02 7.16454865818E+02 0.00000000000E+00 0.00000000000E+00 1.
43 -4 1 1 2 501 0 -6.29623305954E+01 -4.67693451618E+01 -5.85204921720E+01 9.78584422772E+01 0.00000000000E+00 0.00000000000E+00 1.
44 1 1 1 2 502 0 9.29867095677E+00 2.61406963578E+01 -9.53450713739E+01 9.92999694004E+01 0.00000000000E+00 0.00000000000E+00 1.
45 25 2 1 2 0 0 5.36636596386E+01 2.06286488040E+01 -5.32194112726E+02 5.49691643686E+02 1.25000000000E+02 0.00000000000E+00 1.
46 23 2 5 5 0 0 -4.38443764422E-01 -1.86323403603E+01 -9.56577645198E+01 9.86840261342E+01 1.55168540914E+01 0.00000000000E+00 1.
47 23 2 5 5 0 0 5.41021034030E+01 3.92609891643E+01 -4.36536348206E+02 4.51007617552E+02 9.15173476546E+01 0.00000000000E+00 1.
48 -11 1 6 6 0 0 3.31752759767E+00 1.23639112123E+00 -8.43121325514E+00 9.14439771558E+00 5.10999986247E-04 0.00000000000E+00 1.
49 11 1 6 6 0 0 -3.75597136210E+00 -1.98687314816E+01 -8.72265512647E+01 8.95396284186E+01 5.11001208360E-04 0.00000000000E+00 1.
50 -13 1 7 7 0 0 6.93884009242E+01 3.00845351746E+01 -2.00352143436E+02 2.14151399675E+02 1.05660000076E-01 0.00000000000E+00 1.
51 13 1 7 7 0 0 -1.52862975212E+01 9.17645398978E+00 -2.36184204771E+02 2.36856217877E+02 1.05659999949E-01 0.00000000000E+00 1.
57 12 50 1.0000000E+00 1.2500000E+02 7.8125000E-03 1.2380607E-01
58 1 -1 0 0 503 0 0.00000000000E+00 0.00000000000E+00 5.98124082110E+01 5.98124082110E+01 0.00000000000E+00 0.00000000000E+00 1.
59 -1 -1 0 0 0 503 0.00000000000E+00 0.00000000000E+00 -3.44771438947E+02 3.44771438947E+02 0.00000000000E+00 0.00000000000E+00 1.
60 23 2 1 2 0 0 -1.33768582227E+01 8.88541882213E+01 -1.21353594052E+02 1.79939405232E+02 9.78646395061E+01 0.00000000000E+00 1.
61 25 2 1 2 0 0 1.33768582227E+01 -8.88541882213E+01 -1.63605436683E+02 2.24644441925E+02 1.24997517076E+02 0.00000000000E+00 1.
62 13 1 3 3 0 0 3.17738029751E+01 -1.54337455361E+00 -2.87056115717E+01 4.28483355599E+01 1.05660000003E-01 0.00000000000E+00 1.
63 -13 1 3 3 0 0 -4.51506611978E+01 9.03975627749E+01 -9.26479824805E+01 1.37091069673E+02 1.05660000012E-01 0.00000000000E+00 1.
64 23 2 4 4 0 0 4.40015216426E+01 -3.16198925284E+01 -5.72188020543E+01 7.95131988002E+01 1.06021679173E+01 0.00000000000E+00 1.
65 23 2 4 4 0 0 -3.06246634199E+01 -5.72342956929E+01 -1.06386634629E+02 1.45131243125E+02 7.43728921737E+01 0.00000000000E+00 1.
66 -11 1 8 8 0 0 1.78742924427E+01 -1.12102312034E+01 -2.03424438331E+00 2.11966451221E+01 5.10999863718E-04 0.00000000000E+00 1.
67 11 1 7 7 0 0 3.86248305415E+01 -3.12040320381E+01 -4.96421050079E+01 7.02133017289E+01 5.11000665199E-04 0.00000000000E+00 1.
68 -11 1 7 7 0 0 5.37669110106E+00 -4.15860490296E-01 -7.57669704638E+00 9.29989707133E+00 5.11000011708E-04 0.00000000000E+00 1.
69 11 1 8 8 0 0 -4.84989558626E+01 -4.60240644895E+01 -1.04352390245E+02 1.23934598003E+02 5.10996863057E-04 0.00000000000E+00 1.
80 self.
m.resetInputEvent()
82 self.
runcontact(event1_ggH,
False, TVar.SelfDefine_spin0, TVar.JHUGen, TVar.ZZINDEPENDENT)
84 self.
runcontact(event2_VBF,
True, TVar.SelfDefine_spin0, TVar.JHUGen, TVar.JJVBF)
86 self.
runcontact(event3_ZH,
True, TVar.SelfDefine_spin0, TVar.JHUGen, TVar.Lep_ZH)
89 correspondence between a1 L1 L1Zg and contact terms
100 aL_up = (-2 * sitW2 * 2./3 + 1)
101 aR_up = -2 * sitW2 * 2./3
102 aL_dn = (-2 * sitW2 * -1./3 - 1)
103 aR_dn = -2 * sitW2 * -1./3
105 e = 0.8431872482432357
111 computeP = m.computeProdP
if isprod
else m.computeP
113 ghz1, ghz1_prime2, ghzgs1_prime2 = random.uniform(-1, 1), random.uniform(-10000, 10000), random.uniform(-10000, 10000)
114 m.setInputEvent_fromLHE_Hwithdecay(event,
True)
116 m.setProcess(*setprocessargs)
118 m.ghz1_prime2 = ghz1_prime2
119 m.ghzgs1_prime2 = ghzgs1_prime2
122 m.setProcess(*setprocessargs)
123 m.ghz1 = ghz1 + 2 * ghz1_prime2 * (M_Z**2 - 1j*M_Z*Ga_Z)/L1**2
124 m.ghzzp1 = M_Z**2/L1**2
125 m.ezp_El_left = m.ezp_Mu_left = m.ezp_Ta_left = aL_lep * ghz1_prime2 + e * ghzgs1_prime2
126 m.ezp_El_right = m.ezp_Mu_right = m.ezp_Ta_right = aR_lep * ghz1_prime2 + e * ghzgs1_prime2
127 m.ezp_Up_left = m.ezp_Chm_left = m.ezp_Top_left = aL_up * ghz1_prime2 + c_up * ghzgs1_prime2
128 m.ezp_Up_right = m.ezp_Chm_right = m.ezp_Top_right = aR_up * ghz1_prime2 + c_up * ghzgs1_prime2
129 m.ezp_Dn_left = m.ezp_Str_left = m.ezp_Bot_left = aL_dn * ghz1_prime2 + c_dn * ghzgs1_prime2
130 m.ezp_Dn_right = m.ezp_Str_right = m.ezp_Bot_right = aR_dn * ghz1_prime2 + c_dn * ghzgs1_prime2
131 m.ezp_NuE_left = aL_nu * ghz1_prime2
132 m.ezp_NuE_right = aR_nu * ghz1_prime2
135 self.assertEquals(me1, me2)
136 self.assertNotEquals(me1, 0)
140 if process
in (0, 50, 60):
141 for i
in range(1, 5):
143 if j
in (3, 6)
and not usevpvp:
continue
144 coupling =
"ghz{}".format(i)
145 if j: coupling +=
"_prime"
146 if j>1: coupling += str(j)
148 if process == 0
and not usevpvp:
149 yield "ghzgs1_prime2";
yield "ghzgs2";
yield "ghzgs3";
yield "ghzgs4"
151 for i
in range(1, 11):
yield "b{}".format(i)
153 for i
in range(1, 5)+[8]:
yield "bzgs".format(i)
155 assert False, process
158 (random.uniform(0, 1) + random.uniform(0, 1) * 1j)
159 * (10000
if "prime" in coupling
else 1)
163 self.
runVprime(event1_ggH,
False,
False, TVar.SelfDefine_spin0, TVar.JHUGen, TVar.ZZINDEPENDENT, **self.
Vprimekwargs(0,
False))
165 self.
runVprime(event1_ggH,
False,
False, TVar.SelfDefine_spin2, TVar.JHUGen, TVar.ZZINDEPENDENT, **self.
Vprimekwargs(2,
False))
167 self.
runVprime(event2_VBF,
True,
False, TVar.SelfDefine_spin0, TVar.JHUGen, TVar.JJVBF, **self.
Vprimekwargs(60,
False))
169 self.
runVprime(event3_ZH,
True,
False, TVar.SelfDefine_spin0, TVar.JHUGen, TVar.Lep_ZH, **self.
Vprimekwargs(50,
False))
171 self.
runVprime(event1_ggH,
False,
True, TVar.SelfDefine_spin0, TVar.JHUGen, TVar.ZZINDEPENDENT, **self.
Vprimekwargs(0,
True))
173 self.
runVprime(event1_ggH,
False,
True, TVar.SelfDefine_spin2, TVar.JHUGen, TVar.ZZINDEPENDENT, **self.
Vprimekwargs(2,
True))
175 self.
runVprime(event2_VBF,
True,
True, TVar.SelfDefine_spin0, TVar.JHUGen, TVar.JJVBF, **self.
Vprimekwargs(60,
True))
177 self.
runVprime(event3_ZH,
True,
True, TVar.SelfDefine_spin0, TVar.JHUGen, TVar.Lep_ZH, **self.
Vprimekwargs(50,
True))
178 def runVprime(self, event, isprod, usevpvp, *setprocessargs, **couplings):
180 test that with mZ' == mZ, we get the same behavor with Z and Z'
195 aL_up = (-2 * sitW2 * 2./3 + 1)
196 aR_up = -2 * sitW2 * 2./3
197 aL_dn = (-2 * sitW2 * -1./3 - 1)
198 aR_dn = -2 * sitW2 * -1./3
200 bL = (2*(1-sitW2))**.5
203 computeP = m.computeProdP
if isprod
else m.computeP
204 m.setInputEvent_fromLHE_Hwithdecay(event,
True)
206 m.setProcess(*setprocessargs)
207 for coupling, value
in couplings.iteritems():
208 if re.match(
"(ghz[1-4](_prime[2-7]?)?|b([1-9]|10))", coupling):
210 elif re.match(
"(ghzgs([2-4]|1_prime2)|bzgs[12348])", coupling):
212 raise ValueError(
"Can't use gs coupling {} for vpvp test".format(coupling))
214 raise ValueError(
"Invalid coupling {}".format(coupling))
215 setattr(m, coupling, value)
219 m.setProcess(*setprocessargs)
222 for coupling, value
in couplings.iteritems():
224 newcoupling = coupling.replace(
"ghz",
"ghzpzp").replace(
"b",
"bzpzp")
226 newcoupling = coupling.replace(
"ghz",
"ghzzp").replace(
"b",
"bzzp").replace(
"zzpgs",
"zpgs").replace(
"zzpzgs",
"zpgs")
227 if "gs" not in coupling:
229 assert newcoupling != coupling
230 setattr(m, newcoupling, value)
236 m.ezp_El_left = m.ezp_Mu_left = m.ezp_Ta_left = aL_lep
237 m.ezp_El_right = m.ezp_Mu_right = m.ezp_Ta_right = aR_lep
238 m.ezp_Up_left = m.ezp_Chm_left = m.ezp_Top_left = aL_up
239 m.ezp_Up_right = m.ezp_Chm_right = m.ezp_Top_right = aR_up
240 m.ezp_Dn_left = m.ezp_Str_left = m.ezp_Bot_left = aL_dn
241 m.ezp_Dn_right = m.ezp_Str_right = m.ezp_Bot_right = aR_dn
242 m.ezp_NuE_left = aL_nu
243 m.ezp_NuE_right = aR_nu
245 m.ewp_El_left = m.ewp_Mu_left = m.ewp_Ta_left = m.ewp_Up_left = m.ewp_Chm_left = m.ewp_Top_left = bL
249 self.assertEquals(me1, me2)
250 self.assertNotEquals(me1, 0)
259 m.setInputEvent_fromLHE_Hwithdecay(event,
False)
264 for lst
in firstrun, secondrun:
265 m.setProcess(TVar.SelfDefine_spin0, TVar.JHUGen, TVar.JJVBF)
267 lst.append(m.computeProdP(
True))
268 lst.append(m.getConstant())
270 m.setProcess(TVar.SelfDefine_spin0, TVar.JHUGen, TVar.JJQCD)
272 lst.append(m.computeProdP(
True))
273 lst.append(m.getConstant())
275 m.setProcess(TVar.SelfDefine_spin0, TVar.JHUGen, TVar.Had_ZH)
277 lst.append(m.computeProdP(
True))
278 lst.append(m.getConstant())
280 m.setProcess(TVar.SelfDefine_spin0, TVar.JHUGen, TVar.Had_WH)
282 lst.append(m.computeProdP(
True))
283 lst.append(m.getConstant())
285 m.setProcess(TVar.SelfDefine_spin0, TVar.JHUGen, TVar.ZZINDEPENDENT)
286 m.ghzzp1 = ezp_El_left = 1
287 lst.append(m.computeP(
True))
288 lst.append(m.getConstant())
290 self.assertEquals(firstrun, secondrun)
292 if __name__ ==
"__main__":
293 unittest.main(argv=[sys.argv[0]]+args.unittest_args)