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.
propagatorpropagator = {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)
189 all_CTparameters = []
194 require_args = [
'name',
'nature,',
'type',
'value',
'texname']
196 def __init__(self, name, type, value, texname):
198 args = (name,
'internal', type, value, texname)
200 UFOBaseClass.__init__(self, *args)
202 args = (name,
'internal', type, value, texname)
204 self.
naturenature =
'interal'
206 global all_CTparameters
207 all_CTparameters.append(self)
217 return self.value[-x]
227 require_args = [
'name',
'particles',
'color',
'lorentz',
'couplings']
229 def __init__(self, name, particles, color, lorentz, couplings, **opt):
231 args = (name, particles, color, lorentz, couplings)
233 UFOBaseClass.__init__(self, *args, **opt)
235 args = (particles, color, lorentz, couplings)
238 all_vertices.append(self)
246 require_args = [
'name',
'particles',
'color',
'lorentz',
'couplings',
'type',
'loop_particles']
248 def __init__(self, name, particles, color, lorentz, couplings, type, loop_particles, **opt):
250 args = (name, particles, color, lorentz, couplings, type, loop_particles)
252 UFOBaseClass.__init__(self, *args, **opt)
254 args = (particles, color, lorentz, couplings, type, loop_particles)
256 global all_CTvertices
257 all_CTvertices.append(self)
265 require_args = [
'name',
'value',
'order']
267 require_args_all = [
'name',
'value',
'order',
'loop_particles',
'counterterm']
269 def __init__(self, name, value, order, **opt):
271 args = (name, value, order)
272 UFOBaseClass.__init__(self, *args, **opt)
274 all_couplings.append(self)
277 return self.
polepole(0)
280 """ the self.value attribute can be a dictionary directly specifying the Laurent serie using normal
281 parameter or just a string which can possibly contain CTparameter defining the Laurent serie."""
283 if isinstance(self.
valuevalue, dict):
284 if -x
in self.
valuevalue.keys():
285 return self.
valuevalue[-x]
290 for param
in all_CTparameters:
291 pattern = re.compile(
r"(?P<first>\A|\*|\+|\-|\()(?P<name>" + param.name +
r")(?P<second>\Z|\*|\+|\-|\))")
292 numberOfMatches = len(pattern.findall(self.
valuevalue))
293 if numberOfMatches == 1:
297 raise UFOError(
"UFO does not support yet more than one occurence of CTParameters in the couplings values.")
298 elif numberOfMatches > 1:
299 raise UFOError(
"UFO does not support yet more than one occurence of CTParameters in the couplings values.")
303 return self.
valuevalue
307 if CTparam.pole(x) ==
'ZERO':
310 def substitution(matchedObj):
311 return matchedObj.group(
'first') +
"(" + CTparam.pole(x) +
")" + matchedObj.group(
'second')
312 pattern = re.compile(
r"(?P<first>\A|\*|\+|\-|\()(?P<name>" + CTparam.name +
r")(?P<second>\Z|\*|\+|\-|\))")
313 return pattern.sub(substitution, self.
valuevalue)
321 require_args = [
'name',
'spins',
'structure']
323 def __init__(self, name, spins, structure='external', **opt):
324 args = (name, spins, structure)
325 UFOBaseClass.__init__(self, *args, **opt)
328 all_lorentz.append(self)
336 def __init__(self, name, arguments, expression):
339 all_functions.append(self)
343 self.
exprexpr = expression
345 def __call__(self, *opt):
347 for i, arg
in enumerate(self.
argumentsarguments):
348 exec(
'%s = %s' % (arg, opt[i]))
358 def __init__(self, name, expansion_order, hierarchy, perturbative_expansion=0):
361 all_orders.append(self)
373 require_args = [
'particle',
'partial_widths']
375 def __init__(self, particle, partial_widths, **opt):
376 args = (particle, partial_widths)
377 UFOBaseClass.__init__(self, *args, **opt)
380 all_decays.append(self)
383 particle.partial_widths = partial_widths
386 all_form_factors = []
390 require_args = [
'name',
'type',
'value']
392 def __init__(self, name, type, value, **opt):
393 args = (name, type, value)
394 UFOBaseClass.__init__(self, *args, **opt)
396 global all_form_factors
397 all_form_factors.append(self)
405 require_args = [
'name',
'numerator',
'denominator']
407 def __init__(self, name, numerator, denominator=None, **opt):
408 args = (name, numerator, denominator)
409 UFOBaseClass.__init__(self, *args, **opt)
411 global all_propagators
412 all_propagators.append(self)
double eval(const std::vector< double > &spl, const std::vector< double > &vals, double x)
Evaluate spline (zero order or first order) in point x.