434
433
return {'m2': finite_m2, output:[]}
435
def fix_PSPoint_in_check(self,dir_name):
436
"""Set check_sa.f to be reading PS.input assuming a working dir dir_name"""
438
file = open(os.path.join(dir_name, 'SubProcesses', 'check_sa.f'), 'r')
439
check_sa = file.read()
442
file = open(os.path.join(dir_name, 'SubProcesses', 'check_sa.f'), 'w')
443
file.write(re.sub("READPS = .FALSE.", "READPS = .TRUE.", check_sa))
446
def get_me_value(self, proc, proc_id, working_dir, PSpoint=[], verbose=True):
447
"""Compile and run ./check, then parse the output and return the result
448
for process with id = proc_id and PSpoint if specified."""
450
sys.stdout.write('.')
454
directories = glob.glob(os.path.join(working_dir, 'SubProcesses',
456
if directories and os.path.isdir(directories[0]):
457
shell_name = os.path.basename(directories[0])
459
# If directory doesn't exist, skip and return 0
461
logging.info("Directory hasn't been created for process %s" %proc)
462
return ((0.0, 0.0, 0.0, 0.0, 0), [])
464
if verbose: logging.info("Working on process %s in dir %s" % (proc, shell_name))
466
dir_name = os.path.join(working_dir, 'SubProcesses', shell_name)
468
devnull = open(os.devnull, 'w')
469
retcode = subprocess.call('make',
471
stdout=devnull, stderr=devnull)
474
logging.info("Error while executing make in %s" % shell_name)
475
return ((0.0, 0.0, 0.0, 0.0, 0), [])
477
# If a PS point is specified, write out the corresponding PS.input
479
PSfile = open(os.path.join(dir_name, 'PS.input'), 'w')
480
PSfile.write('\n'.join([' '.join(['%.16E'%pi for pi in p]) \
486
output = subprocess.Popen('./check',
488
stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout
491
if os.path.exists(os.path.join(dir_name,'result.dat')):
492
return self.parse_check_output(file(dir_name+'/result.dat'))
494
logging.warning("Error while looking for file %s"%str(os.path\
495
.join(dir_name,'result.dat')))
496
return ((0.0, 0.0, 0.0, 0.0, 0), [])
498
logging.warning("Error while executing ./check in %s" % shell_name)
499
return ((0.0, 0.0, 0.0, 0.0, 0), [])
501
def parse_check_output(self,output):
502
"""Parse the output string and return a pair where first four values are
503
the finite, born, single and double pole of the ME and the fourth is the
504
GeV exponent and the second value is a list of 4 momenta for all particles
508
value = [0.0,0.0,0.0,0.0]
512
splitline=line.split()
513
if splitline[0]=='PS':
514
res_p.append([float(s) for s in splitline[1:]])
515
elif splitline[0]=='BORN':
516
value[1]=float(splitline[1])
517
elif splitline[0]=='FIN':
518
value[0]=float(splitline[1])
519
elif splitline[0]=='1EPS':
520
value[2]=float(splitline[1])
521
elif splitline[0]=='2EPS':
522
value[3]=float(splitline[1])
523
elif splitline[0]=='EXP':
524
gev_pow=int(splitline[1])
526
return ((value[0],value[1],value[2],value[3],gev_pow), res_p)
437
528
def setup_ward_check(self, working_dir):
438
529
""" Modify loop_matrix.f so to have one external massless gauge boson