14 """Exception raised if when inconsistencies are detected in the UFO model."""
18 """The class from which all FeynRules classes are derived."""
22 def __init__(self, *args, **options):
23 assert(len(self.require_args) == len (args))
25 for i, name
in enumerate(self.require_args):
26 setattr(self, name, args[i])
28 for (option, value)
in options.items():
29 setattr(self, option, value)
32 return getattr(self, name)
34 def set(self, name, value):
35 setattr(self, name, value)
38 """Return a dictionary containing all the information of the object"""
45 """ return string with the full information """
46 return '\n'.join([
'%s \t: %s' %(name, value)
for name, value
in self.__dict__.items()])
59 for orig,sub
in replacements:
60 text = text.replace(orig,sub)
68 """A standard Particle"""
70 require_args=[
'pdg_code',
'name',
'antiname',
'spin',
'color',
'mass',
'width',
'texname',
'antitexname',
'charge']
72 require_args_all = [
'pdg_code',
'name',
'antiname',
'spin',
'color',
'mass',
'width',
'texname',
'antitexname',
'counterterm',
'charge',
'line',
'propagating',
'goldstoneboson',
'propagator']
74 def __init__(self, pdg_code, name, antiname, spin, color, mass, width, texname,
75 antitexname, charge , line=None, propagating=True, counterterm=None, goldstoneboson=False,
76 propagator=None, **options):
78 args= (pdg_code, name, antiname, spin, color, mass, width, texname,
79 antitexname, float(charge))
81 UFOBaseClass.__init__(self, *args, **options)
84 all_particles.append(self)
96 if isinstance(propagator, dict):
99 self.
propagatorpropagator = {0: propagator, 1: propagator}
102 """ find how we draw a line if not defined
103 valid output: dashed/straight/wavy/curly/double/swavy/scurly
134 raise Exception(
'%s has no anti particle.' % self.name)
136 for k,v
in self.__dict__.iteritems():
139 if self.color
in [1,8]:
140 newcolor = self.color
142 newcolor = -self.color
144 return Particle(-self.pdg_code, self.antiname, self.name, self.spin, newcolor, self.mass, self.width,
153 require_args=[
'name',
'nature',
'type',
'value',
'texname']
155 def __init__(self, name, nature, type, value, texname, lhablock=None, lhacode=None):
157 args = (name,nature,type,value,texname)
159 UFOBaseClass.__init__(self, *args)
161 args=(name,nature,type,value,texname)
163 global all_parameters
164 all_parameters.append(self)
166 if (lhablock
is None or lhacode
is None)
and nature ==
'external':
167 raise Exception(
'Need LHA information for external parameter "%s".' % name)
171 all_CTparameters = []
175 require_args=[
'name',
'nature,',
'type',
'value',
'texname']
177 def __init__(self, name, type, value, texname):
179 args = (name,
'internal',type,value,texname)
181 UFOBaseClass.__init__(self, *args)
183 args=(name,
'internal',type,value,texname)
185 self.
naturenature=
'interal'
187 global all_CTparameters
188 all_CTparameters.append(self)
198 return self.value[-x]
206 require_args=[
'name',
'particles',
'color',
'lorentz',
'couplings']
208 def __init__(self, name, particles, color, lorentz, couplings, **opt):
210 args = (name, particles, color, lorentz, couplings)
212 UFOBaseClass.__init__(self, *args, **opt)
214 args=(particles,color,lorentz,couplings)
217 all_vertices.append(self)
223 require_args=[
'name',
'particles',
'color',
'lorentz',
'couplings',
'type',
'loop_particles']
225 def __init__(self, name, particles, color, lorentz, couplings, type, loop_particles, **opt):
227 args = (name, particles, color, lorentz, couplings, type, loop_particles)
229 UFOBaseClass.__init__(self, *args, **opt)
231 args=(particles,color,lorentz,couplings, type, loop_particles)
233 global all_CTvertices
234 all_CTvertices.append(self)
240 require_args=[
'name',
'value',
'order']
242 require_args_all=[
'name',
'value',
'order',
'loop_particles',
'counterterm']
244 def __init__(self, name, value, order, **opt):
246 args =(name, value, order)
247 UFOBaseClass.__init__(self, *args, **opt)
249 all_couplings.append(self)
252 return self.
polepole(0)
255 """ the self.value attribute can be a dictionary directly specifying the Laurent serie using normal
256 parameter or just a string which can possibly contain CTparameter defining the Laurent serie."""
258 if isinstance(self.
valuevalue,dict):
259 if -x
in self.
valuevalue.keys():
260 return self.
valuevalue[-x]
265 for param
in all_CTparameters:
266 pattern=re.compile(
r"(?P<first>\A|\*|\+|\-|\()(?P<name>"+param.name+
r")(?P<second>\Z|\*|\+|\-|\))")
267 numberOfMatches=len(pattern.findall(self.
valuevalue))
268 if numberOfMatches==1:
272 raise UFOError,
"UFO does not support yet more than one occurence of CTParameters in the couplings values."
273 elif numberOfMatches>1:
274 raise UFOError,
"UFO does not support yet more than one occurence of CTParameters in the couplings values."
278 return self.
valuevalue
282 if CTparam.pole(x)==
'ZERO':
285 def substitution(matchedObj):
286 return matchedObj.group(
'first')+
"("+CTparam.pole(x)+
")"+matchedObj.group(
'second')
287 pattern=re.compile(
r"(?P<first>\A|\*|\+|\-|\()(?P<name>"+CTparam.name+
r")(?P<second>\Z|\*|\+|\-|\))")
288 return pattern.sub(substitution,self.
valuevalue)
294 require_args=[
'name',
'spins',
'structure']
296 def __init__(self, name, spins, structure='external', **opt):
297 args = (name, spins, structure)
298 UFOBaseClass.__init__(self, *args, **opt)
301 all_lorentz.append(self)
308 def __init__(self, name, arguments, expression):
311 all_functions.append(self)
315 self.
exprexpr = expression
317 def __call__(self, *opt):
319 for i, arg
in enumerate(self.
argumentsarguments):
320 exec(
'%s = %s' % (arg, opt[i] ))
328 def __init__(self, name, expansion_order, hierarchy, perturbative_expansion = 0):
331 all_orders.append(self)
341 require_args = [
'particle',
'partial_widths']
343 def __init__(self, particle, partial_widths, **opt):
344 args = (particle, partial_widths)
345 UFOBaseClass.__init__(self, *args, **opt)
348 all_decays.append(self)
351 particle.partial_widths = partial_widths
353 all_form_factors = []
356 require_args = [
'name',
'type',
'value']
358 def __init__(self, name, type, value, **opt):
359 args = (name, type, value)
360 UFOBaseClass.__init__(self, *args, **opt)
362 global all_form_factors
363 all_form_factors.append(self)
370 require_args = [
'name',
'numerator',
'denominator']
372 def __init__(self, name, numerator, denominator=None, **opt):
373 args = (name, numerator, denominator)
374 UFOBaseClass.__init__(self, *args, **opt)
376 global all_propagators
377 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.