def test_setget_helas_model_error(self): """Test error raising in HelasModel object get and set""" mymodel = helas_call_writers.HelasCallWriter() not_a_string = 1. # General self.assertRaises(AssertionError, mymodel.get, not_a_string) self.assertRaises(helas_call_writers.HelasCallWriter.PhysicsObjectError, mymodel.get, 'wrong_key') self.assertRaises(AssertionError, mymodel.set, not_a_string, None) self.assertRaises(helas_call_writers.HelasCallWriter.PhysicsObjectError, mymodel.set, 'wrong_subclass', None) # add_wavefunction and add_amplitude self.assertRaises(AssertionError, mymodel.add_wavefunction, 'wrong_subclass', None) self.assertRaises(AssertionError, mymodel.add_wavefunction, (1, 2), "not_a_function") self.assertRaises(AssertionError, mymodel.add_amplitude, 'wrong_subclass', None) self.assertRaises(AssertionError, mymodel.add_amplitude, (1, 2), "not_a_function")
class HelasModelTestSetup(unittest.TestCase): """Test class for the HelasModel object""" mymodel = helas_call_writers.HelasCallWriter() mybasemodel = base_objects.Model() def setUp(self): # Set up model mypartlist = base_objects.ParticleList() myinterlist = base_objects.InteractionList() # A gluon mypartlist.append( base_objects.Particle({ 'name': 'g', 'antiname': 'g', 'spin': 3, 'color': 8, 'mass': 'zero', 'width': 'zero', 'texname': 'g', 'antitexname': 'g', 'line': 'curly', 'charge': 0., 'pdg_code': 21, 'propagating': True, 'is_part': True, 'self_antipart': True })) g = mypartlist[len(mypartlist) - 1] # A quark U and its antiparticle mypartlist.append( base_objects.Particle({ 'name': 'u', 'antiname': 'u~', 'spin': 2, 'color': 3, 'mass': 'mu', 'width': 'zero', 'texname': 'u', 'antitexname': '\bar u', 'line': 'straight', 'charge': 2. / 3., 'pdg_code': 2, 'propagating': True, 'is_part': True, 'self_antipart': False })) u = mypartlist[len(mypartlist) - 1] antiu = copy.copy(u) antiu.set('is_part', False) # A quark D and its antiparticle mypartlist.append( base_objects.Particle({ 'name': 'd', 'antiname': 'd~', 'spin': 2, 'color': 3, 'mass': 'mu', 'width': 'zero', 'texname': 'd', 'antitexname': '\bar d', 'line': 'straight', 'charge': -1. / 3., 'pdg_code': 1, 'propagating': True, 'is_part': True, 'self_antipart': False })) d = mypartlist[len(mypartlist) - 1] antid = copy.copy(d) antid.set('is_part', False) # A electron and positron mypartlist.append( base_objects.Particle({ 'name': 'e+', 'antiname': 'e-', 'spin': 2, 'color': 1, 'mass': 'me', 'width': 'zero', 'texname': 'e^+', 'antitexname': 'e^-', 'line': 'straight', 'charge': -1., 'pdg_code': 11, 'propagating': True, 'is_part': True, 'self_antipart': False })) eminus = mypartlist[len(mypartlist) - 1] eplus = copy.copy(eminus) eplus.set('is_part', False) # A photon mypartlist.append( base_objects.Particle({ 'name': 'a', 'antiname': 'a', 'spin': 3, 'color': 1, 'mass': 'zero', 'width': 'zero', 'texname': '\gamma', 'antitexname': '\gamma', 'line': 'wavy', 'charge': 0., 'pdg_code': 22, 'propagating': True, 'is_part': True, 'self_antipart': True })) a = mypartlist[len(mypartlist) - 1] # A T particle mypartlist.append( base_objects.Particle({ 'name': 'T1', 'antiname': 'T1', 'spin': 5, 'color': 1, 'mass': 'zero', 'width': 'zero', 'texname': 'T', 'antitexname': 'T', 'line': 'double', 'charge': 0., 'pdg_code': 8000002, 'propagating': False, 'is_part': True, 'self_antipart': True })) T1 = mypartlist[len(mypartlist) - 1] # A U squark and its antiparticle mypartlist.append( base_objects.Particle({ 'name': 'su', 'antiname': 'su~', 'spin': 1, 'color': 3, 'mass': 'Musq2', 'width': 'Wusq2', 'texname': '\tilde u', 'antitexname': '\bar {\tilde u}', 'line': 'dashed', 'charge': 2. / 3., 'pdg_code': 1000002, 'propagating': True, 'is_part': True, 'self_antipart': False })) su = mypartlist[len(mypartlist) - 1] antisu = copy.copy(su) antisu.set('is_part', False) # A E slepton and its antiparticle mypartlist.append( base_objects.Particle({ 'name': 'sl2-', 'antiname': 'sl2+', 'spin': 1, 'color': 1, 'mass': 'Msl2', 'width': 'Wsl2', 'texname': '\tilde e^-', 'antitexname': '\tilde e^+', 'line': 'dashed', 'charge': 1., 'pdg_code': 1000011, 'propagating': True, 'is_part': True, 'self_antipart': False })) seminus = mypartlist[len(mypartlist) - 1] seplus = copy.copy(seminus) seplus.set('is_part', False) # A neutralino mypartlist.append( base_objects.Particle({ 'name': 'n1', 'antiname': 'n1', 'spin': 2, 'color': 1, 'mass': 'Mneu1', 'width': 'Wneu1', 'texname': '\chi_0^1', 'antitexname': '\chi_0^1', 'line': 'straight', 'charge': 0., 'pdg_code': 1000022, 'propagating': True, 'is_part': True, 'self_antipart': True })) n1 = mypartlist[len(mypartlist) - 1] # W+ and W- mypartlist.append( base_objects.Particle({ 'name': 'W+', 'antiname': 'W-', 'spin': 3, 'color': 1, 'mass': 'wmas', 'width': 'wwid', 'texname': 'W^+', 'antitexname': 'W^-', 'line': 'wavy', 'charge': 1., 'pdg_code': 24, 'propagating': True, 'is_part': True, 'self_antipart': False })) wplus = mypartlist[len(mypartlist) - 1] wminus = copy.copy(u) wminus.set('is_part', False) # Z mypartlist.append( base_objects.Particle({ 'name': 'Z', 'antiname': 'Z', 'spin': 3, 'color': 1, 'mass': 'zmas', 'width': 'zwid', 'texname': 'Z', 'antitexname': 'Z', 'line': 'wavy', 'charge': 1., 'pdg_code': 23, 'propagating': True, 'is_part': True, 'self_antipart': True })) z = mypartlist[len(mypartlist) - 1] # Gluon and photon couplings to quarks myinterlist.append(base_objects.Interaction({ 'id': 3, 'particles': base_objects.ParticleList(\ [u, \ antiu, \ g]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'GG'}, 'orders':{'QCD':1}})) myinterlist.append(base_objects.Interaction({ 'id': 4, 'particles': base_objects.ParticleList(\ [d, \ antid, \ a]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX15'}, 'orders':{'QED':1}})) myinterlist.append(base_objects.Interaction({ 'id': 10, 'particles': base_objects.ParticleList(\ [d, \ antid, \ g]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'GG'}, 'orders':{'QCD':1}})) myinterlist.append(base_objects.Interaction({ 'id': 11, 'particles': base_objects.ParticleList(\ [u, \ antiu, \ a]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX15'}, 'orders':{'QED':1}})) # Tgg coupling myinterlist.append(base_objects.Interaction({ 'id': 5, 'particles': base_objects.ParticleList(\ [g, \ g, \ T1]), 'color': [], 'lorentz':['A'], 'couplings':{(0, 0):'MGVX2'}, 'orders':{'QCD':1}})) # ggg coupling myinterlist.append(base_objects.Interaction({ 'id': 15, 'particles': base_objects.ParticleList(\ [g, \ g, \ g]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX1'}, 'orders':{'QCD':1}})) # Coupling of e to gamma myinterlist.append(base_objects.Interaction({ 'id': 7, 'particles': base_objects.ParticleList(\ [eminus, \ eplus, \ a]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX12'}, 'orders':{'QED':1}})) # Gluon coupling to su myinterlist.append(base_objects.Interaction({ 'id': 105, 'particles': base_objects.ParticleList(\ [g, \ su, \ antisu]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX74'}, 'orders':{'QCD':1}})) # Coupling of n1 to u and su myinterlist.append(base_objects.Interaction({ 'id': 101, 'particles': base_objects.ParticleList(\ [n1, \ u, \ antisu]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX570'}, 'orders':{'QED':1}})) myinterlist.append(base_objects.Interaction({ 'id': 102, 'particles': base_objects.ParticleList(\ [antiu, \ n1, \ su]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX575'}, 'orders':{'QED':1}})) # Coupling of n1 to e and se myinterlist.append(base_objects.Interaction({ 'id': 103, 'particles': base_objects.ParticleList(\ [n1, \ eminus, \ seplus]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX350'}, 'orders':{'QED':1}})) myinterlist.append(base_objects.Interaction({ 'id': 104, 'particles': base_objects.ParticleList(\ [eplus, \ n1, \ seminus]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX494'}, 'orders':{'QED':1}})) # Coupling of n1 to z myinterlist.append(base_objects.Interaction({ 'id': 106, 'particles': base_objects.ParticleList(\ [n1, \ n1, z]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'GZN11'}, 'orders':{'QED':1}})) # g-gamma-su-subar coupling myinterlist.append(base_objects.Interaction({ 'id': 100, 'particles': base_objects.ParticleList(\ [a, g, su, antisu]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX89'}, 'orders':{'QED':1, 'QCD':1}})) # w+w-w+w- coupling myinterlist.append(base_objects.Interaction({ 'id': 8, 'particles': base_objects.ParticleList(\ [wplus, wminus, wplus, wminus]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX6'}, 'orders':{'QED':2}})) # w+w-zz coupling myinterlist.append(base_objects.Interaction({ 'id': 9, 'particles': base_objects.ParticleList(\ [wplus, wminus, z, z]), 'color': [], 'lorentz':[''], 'couplings':{(0, 0):'MGVX8'}, 'orders':{'QED':2}})) self.mybasemodel.set('particles', mypartlist) self.mybasemodel.set('interactions', myinterlist) self.mybasemodel.set('name', 'sm') self.mymodel.set('model', self.mybasemodel)