Add these lines to the sum_cd.m Mathematica file to directly get the width:
getWidth[m_]:= sum/(16 Pi m); (*for decays to massless particles*)
getWidth1Massive[m_,mDaughter_]:= sum (1-mDaughter^2/m^2) / (16 Pi m); (*for decays one massive and one massless particle*)
Preps a symbX.m file to be used with sum_cd.m (Intended for models created by FeynRules)
import re
import glob
import tempfile
filenames = glob.glob("symb*.m")
for fn in filenames:
print("\n\n\n Transforming FileName: %s \n" % fn)
f = open(fn)
iParamStart = 0
iParamEnd = 0
iLine = 0
paramFound = False
inLines = []
tempF = tempfile.TemporaryFile()
for line in f:
if re.match(r"parameters={",line):
iParamStart = iLine
elif re.search(r"};",line):
iParamStop = iLine
break
iLine += 1
assert(iParamStart != 0)
assert(iParamStop != 0)
#print("parameters found on lines: [%i,%i]" % (iParamStart,iParamStop))
f.seek(0)
iLine = 0
for line in f:
if iLine <= iParamStart:
iLine += 1
continue
if iLine >= iParamStop:
break
if re.search(r"^,x",line):
tmpLine = re.sub(r"^,","",line)
tmpLine = re.sub(r"->","=",tmpLine)
tmpLine = re.sub(r"pow","Power",tmpLine)
tmpLine = re.sub(r"\.","",tmpLine)
inLines.append(tmpLine)
iLine += 1
f.seek(0)
tempF.writelines(inLines)
tempF.writelines(f)
tempF.seek(0)
f.close()
f = open(fn,"w")
f.writelines(tempF)
f.close()
tempF.close()