19 """Exception raised if when inconsistencies are detected in the UFO model."""
26 """The class from which all FeynRules classes are derived."""
30 def __init__(self, *args, **options):
31 assert len(self.require_args) == len(args)
33 for (i, name)
in enumerate(self.require_args):
34 setattr(self, name, args[i])
36 for (option, value)
in options.items():
37 setattr(self, option, value)
40 return getattr(self, name)
42 def set(self, name, value):
43 setattr(self, name, value)
46 """Return a dictionary containing all the information of the object"""
54 """ return string with the full information """
56 return '\n'.join([
'%s \t: %s' % (name, value)
for (name, value)
in
57 self.__dict__.items()])
70 for (orig, sub)
in replacements:
71 text = text.replace(orig, sub)
80 """A standard Particle"""
128 goldstoneboson=False,
146 UFOBaseClass.__init__(self, *args, **options)
149 all_particles.append(self)
161 if isinstance(propagator, dict):
164 self.
propagator = {0: propagator, 1: propagator}
167 """ find how we draw a line if not defined
168 valid output: dashed/straight/wavy/curly/double/swavy/scurly
199 raise Exception(
'%s has no anti particle.' % self.name)
201 for (k, v)
in self.__dict__.iteritems():
204 if self.color
in [1, 8]:
205 newcolor = self.color
207 newcolor = -self.color
232 require_args = [
'name',
'nature',
'type',
'value',
'texname']
245 args = (name, nature, type, value, texname)
247 UFOBaseClass.__init__(self, *args)
249 args = (name, nature, type, value, texname)
251 global all_parameters
252 all_parameters.append(self)
254 if (lhablock
is None or lhacode
is None)
and nature ==
'external':
255 raise Exception(
'Need LHA information for external parameter "%s".'
261 all_CTparameters = []
266 require_args = [
'name',
'nature,',
'type',
'value',
'texname']
276 args = (name,
'internal', type, value, texname)
278 UFOBaseClass.__init__(self, *args)
280 args = (name,
'internal', type, value, texname)
284 global all_CTparameters
285 all_CTparameters.append(self)
295 return self.value[-x]
305 require_args = [
'name',
'particles',
'color',
'lorentz',
'couplings']
317 args = (name, particles, color, lorentz, couplings)
319 UFOBaseClass.__init__(self, *args, **opt)
321 args = (particles, color, lorentz, couplings)
324 all_vertices.append(self)
364 UFOBaseClass.__init__(self, *args, **opt)
375 global all_CTvertices
376 all_CTvertices.append(self)
384 require_args = [
'name',
'value',
'order']
386 require_args_all = [
'name',
'value',
'order',
'loop_particles',
397 args = (name, value, order)
398 UFOBaseClass.__init__(self, *args, **opt)
400 all_couplings.append(self)
406 """ the self.value attribute can be a dictionary directly specifying the Laurent serie using normal
407 parameter or just a string which can possibly contain CTparameter defining the Laurent serie."""
409 if isinstance(self.
value, dict):
410 if -x
in self.
value.keys():
411 return self.
value[-x]
416 for param
in all_CTparameters:
417 pattern = re.compile(
r"(?P<first>\A|\*|\+|\-|\()(?P<name>"
418 + param.name +
r")(?P<second>\Z|\*|\+|\-|\))")
419 numberOfMatches = len(pattern.findall(self.
value))
420 if numberOfMatches == 1:
425 'UFO does not support yet more than one occurence of CTParameters in the couplings values.'
426 elif numberOfMatches > 1:
428 'UFO does not support yet more than one occurence of CTParameters in the couplings values.'
436 if CTparam.pole(x) ==
'ZERO':
440 def substitution(matchedObj):
441 return matchedObj.group(
'first') +
'(' + CTparam.pole(x) \
442 +
')' + matchedObj.group(
'second')
444 pattern = re.compile(
r"(?P<first>\A|\*|\+|\-|\()(?P<name>"
446 +
r")(?P<second>\Z|\*|\+|\-|\))")
447 return pattern.sub(substitution, self.
value)
455 require_args = [
'name',
'spins',
'structure']
461 structure='external',
465 args = (name, spins, structure)
466 UFOBaseClass.__init__(self, *args, **opt)
469 all_lorentz.append(self)
485 all_functions.append(self)
489 self.
expr = expression
491 def __call__(self, *opt):
493 for (i, arg)
in enumerate(self.
arguments):
494 exec
'%s = %s' % (arg, opt[i])
509 perturbative_expansion=0,
513 all_orders.append(self)
526 require_args = [
'particle',
'partial_widths']
535 args = (particle, partial_widths)
536 UFOBaseClass.__init__(self, *args, **opt)
539 all_decays.append(self)
542 particle.partial_widths = partial_widths
545 all_form_factors = []
550 require_args = [
'name',
'type',
'value']
560 args = (name, type, value)
561 UFOBaseClass.__init__(self, *args, **opt)
563 global all_form_factors
564 all_form_factors.append(self)
572 require_args = [
'name',
'numerator',
'denominator']
582 args = (name, numerator, denominator)
583 UFOBaseClass.__init__(self, *args, **opt)
585 global all_propagators
586 all_propagators.append(self)