def me2(connection): print "me2" args = connection.recv() cartesian_four_momenta = args[0] madgraph_process_directory = args[1] madgraph_param_card = args[2] alpha_s = args[3] cwd = os.getcwd() os.chdir(madgraph_process_directory) print madgraph_process_directory print print cartesian_four_momenta print print zip(*cartesian_four_momenta) print sys.path.insert(0, madgraph_process_directory) print os.getcwd() if "matrix2py" not in sys.modules: import matrix2py print "no" elif "matrix2py" in sys.modules: print "yes" del sys.modules["matrix2py"] import matrix2py matrix2py.initialise(madgraph_param_card) result = matrix2py.get_me(zip(*cartesian_four_momenta), alpha_s, 0) sys.path.pop(0) os.chdir(cwd) connection.send([result]) print result return result
def me2(connection): args = connection.recv() cartesian_four_momenta = args[0] madgraph_process_directory = args[1] madgraph_param_card = args[2] alpha_s = args[3] cwd = os.getcwd() os.chdir(madgraph_process_directory) sys.path.insert(0, madgraph_process_directory) import matrix2py matrix2py.initialise(madgraph_param_card) result = matrix2py.get_me(zip(*cartesian_four_momenta), alpha_s, 0) sys.path.pop(0) os.chdir(cwd) connection.send([result]) return result
def me2(connection): #print "me2" args = connection.recv() cartesian_four_momenta = args[0] madgraph_process_directory = args[1] madgraph_param_card = args[2] alpha_s = args[3] #print alpha_s cwd = os.getcwd() os.chdir(madgraph_process_directory) """print madgraph_process_directory print print cartesian_four_momenta print print zip(*cartesian_four_momenta) print""" sys.path.insert(0, madgraph_process_directory) #print os.getcwd() if "matrix2py" not in sys.modules: import matrix2py #print "no" elif "matrix2py" in sys.modules: #print "yes" del sys.modules["matrix2py"] import matrix2py matrix2py.initialise(madgraph_param_card) result = matrix2py.get_me(zip(*cartesian_four_momenta), alpha_s, 0) sys.path.pop(0) os.chdir(cwd) connection.send([result]) #print result return result
p[i] = [float(line.split()[j]) for j in range(4)] except: print "ERROR: File PS.input is malformed. Error was:\n", sys.exc_info( )[0] sys.exit(0) P = invert_momenta(p) # Alpha_s value alphas = 0.118 # -1 means that the MadLoop averages/sum over helicity configuration. # If a positive integer is picked it corresponds to the position of the helicity configuration listed in the file # 'MadLoop5_resouces/ML5_<id>_HelConfigs.dat' nhel = -1 # means sum over all helicity # Choice of renormalization scale renormalization_scale = 91.188 finite_loop_me, return_code = matrix2py.get_me(P, alphas, renormalization_scale, nhel) print '=' * 112 print '* %-108s *' % ' MadLoop evaluation for the process ' print '* %-108s *' % ' u u~ > z x0 > z e+ e- z QED<=2 QNP<=2 WEIGHTED<=4 [ all = QCD ] / a' print '* %-108s *' % ' and the kinematic configuration:' print '* %-108s *' % ((' %-3s' + ' %-25s' * 4) % ('#', 'E', ' p_x', ' p_y', ' p_z')) for i, k in enumerate(p): # The complicated printout below is just so as to align the digits negative numbers with positive ones print '* %-108s *' % ((' %-3d%s') % (i, ''.join([ ' %-25.15e' % e if j == 0 or e < 0.0 else ' %-24.15e' % e for j, e in enumerate(k) ]))) print '* %-108s *' % ('-' * 108) print '* %-108s *' % (
os.chdir(args.process_directory) sys.path.insert(0, args.process_directory) import matrix2py matrix2py.initialise(args.param_card) cartesian_four_momenta = [[264.7953186035156, 0.0, 0.0, 264.7951354980469], [ 1960.022216796875, 0.0, 0.0, -1960.022216796875 ], [ 638.6737060546875, 6.08879280090332, -279.48333740234375, -560.4739990234375 ], [ 1263.6693115234375, -1.991899847984314, -16.118444442749023, -1263.56494140625 ], [ 322.4744873046875, -4.096892833709717, 295.6017761230469, 128.81185913085938 ]] alpha_s = 0.118 nhel = 0 # means sum over all helicity matrix_element_squared = matrix2py.get_me(zip(*cartesian_four_momenta), alpha_s, nhel) log.info("squared matrix element = " + str(matrix_element_squared))