15 """Exception raised if when inconsistencies are detected in the UFO model."""
20 """The class from which all FeynRules classes are derived."""
24 def __init__(self, *args, **options):
25 assert(len(self.require_args) == len(args))
27 for i, name
in enumerate(self.require_args):
28 setattr(self, name, args[i])
30 for (option, value)
in options.items():
31 setattr(self, option, value)
34 return getattr(self, name)
36 def set(self, name, value):
37 setattr(self, name, value)
40 """Return a dictionary containing all the information of the object"""
47 """ return string with the full information """
48 return '\n'.join([
'%s \t: %s' % (name, value)
for name, value
in self.__dict__.items()])
61 for orig, sub
in replacements:
62 text = text.replace(orig, sub)
70 """A standard Particle"""
72 require_args = [
'pdg_code',
'name',
'antiname',
'spin',
'color',
'mass',
'width',
'texname',
'antitexname',
'charge']
91 def __init__(self, pdg_code, name, antiname, spin, color, mass, width, texname,
92 antitexname, charge, line=None, propagating=True, counterterm=None, goldstoneboson=False,
93 propagator=None, **options):
95 args = (pdg_code, name, antiname, spin, color, mass, width, texname,
96 antitexname, float(charge))
98 UFOBaseClass.__init__(self, *args, **options)
101 all_particles.append(self)
113 if isinstance(propagator, dict):
116 self.
propagator = {0: propagator, 1: propagator}
119 """ find how we draw a line if not defined
120 valid output: dashed/straight/wavy/curly/double/swavy/scurly
151 raise Exception(
'%s has no anti particle.' % self.name)
153 for k, v
in self.__dict__.iteritems():
156 if self.color
in [1, 8]:
157 newcolor = self.color
159 newcolor = -self.color
161 return Particle(-self.pdg_code, self.antiname, self.name, self.spin, newcolor, self.mass, self.width,
170 require_args = [
'name',
'nature',
'type',
'value',
'texname']
172 def __init__(self, name, nature, type, value, texname, lhablock=None, lhacode=None):
174 args = (name, nature, type, value, texname)
176 UFOBaseClass.__init__(self, *args)
178 args = (name, nature, type, value, texname)
180 global all_parameters
181 all_parameters.append(self)
183 if (lhablock
is None or lhacode
is None)
and nature ==
'external':
184 raise Exception(
'Need LHA information for external parameter "%s".' % name)
188 all_CTparameters = []
193 require_args = [
'name',
'nature,',
'type',
'value',
'texname']
195 def __init__(self, name, type, value, texname):
197 args = (name,
'internal', type, value, texname)
199 UFOBaseClass.__init__(self, *args)
201 args = (name,
'internal', type, value, texname)
205 global all_CTparameters
206 all_CTparameters.append(self)
216 return self.value[-x]
225 require_args = [
'name',
'particles',
'color',
'lorentz',
'couplings']
227 def __init__(self, name, particles, color, lorentz, couplings, **opt):
229 args = (name, particles, color, lorentz, couplings)
231 UFOBaseClass.__init__(self, *args, **opt)
233 args = (particles, color, lorentz, couplings)
236 all_vertices.append(self)
243 require_args = [
'name',
'particles',
'color',
'lorentz',
'couplings',
'type',
'loop_particles']
245 def __init__(self, name, particles, color, lorentz, couplings, type, loop_particles, **opt):
247 args = (name, particles, color, lorentz, couplings, type, loop_particles)
249 UFOBaseClass.__init__(self, *args, **opt)
251 args = (particles, color, lorentz, couplings, type, loop_particles)
253 global all_CTvertices
254 all_CTvertices.append(self)
261 require_args = [
'name',
'value',
'order']
263 require_args_all = [
'name',
'value',
'order',
'loop_particles',
'counterterm']
265 def __init__(self, name, value, order, **opt):
267 args = (name, value, order)
268 UFOBaseClass.__init__(self, *args, **opt)
270 all_couplings.append(self)
276 """ the self.value attribute can be a dictionary directly specifying the Laurent serie using normal
277 parameter or just a string which can possibly contain CTparameter defining the Laurent serie."""
279 if isinstance(self.
value, dict):
280 if -x
in self.
value.keys():
281 return self.
value[-x]
286 for param
in all_CTparameters:
287 pattern = re.compile(
r"(?P<first>\A|\*|\+|\-|\()(?P<name>" + param.name +
r")(?P<second>\Z|\*|\+|\-|\))")
288 numberOfMatches = len(pattern.findall(self.
value))
289 if numberOfMatches == 1:
293 raise UFOError(
"UFO does not support yet more than one occurence of CTParameters in the couplings values.")
294 elif numberOfMatches > 1:
295 raise UFOError(
"UFO does not support yet more than one occurence of CTParameters in the couplings values.")
303 if CTparam.pole(x) ==
'ZERO':
306 def substitution(matchedObj):
307 return matchedObj.group(
'first') +
"(" + CTparam.pole(x) +
")" + matchedObj.group(
'second')
308 pattern = re.compile(
r"(?P<first>\A|\*|\+|\-|\()(?P<name>" + CTparam.name +
r")(?P<second>\Z|\*|\+|\-|\))")
309 return pattern.sub(substitution, self.
value)
316 require_args = [
'name',
'spins',
'structure']
318 def __init__(self, name, spins, structure='external', **opt):
319 args = (name, spins, structure)
320 UFOBaseClass.__init__(self, *args, **opt)
323 all_lorentz.append(self)
331 def __init__(self, name, arguments, expression):
334 all_functions.append(self)
338 self.
expr = expression
340 def __call__(self, *opt):
343 exec(
'%s = %s' % (arg, opt[i]))
352 def __init__(self, name, expansion_order, hierarchy, perturbative_expansion=0):
355 all_orders.append(self)
366 require_args = [
'particle',
'partial_widths']
368 def __init__(self, particle, partial_widths, **opt):
369 args = (particle, partial_widths)
370 UFOBaseClass.__init__(self, *args, **opt)
373 all_decays.append(self)
376 particle.partial_widths = partial_widths
378 all_form_factors = []
382 require_args = [
'name',
'type',
'value']
384 def __init__(self, name, type, value, **opt):
385 args = (name, type, value)
386 UFOBaseClass.__init__(self, *args, **opt)
388 global all_form_factors
389 all_form_factors.append(self)
397 require_args = [
'name',
'numerator',
'denominator']
399 def __init__(self, name, numerator, denominator=None, **opt):
400 args = (name, numerator, denominator)
401 UFOBaseClass.__init__(self, *args, **opt)
403 global all_propagators
404 all_propagators.append(self)