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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
            )[0]
            sys.exit(0)
        else:
            print "ERROR: Could not find the 'matrix2py.so' f2py module. Please generate it by running:\n"+\
                  "  > make matrix2py.so\n"+\
                  "in the <PROC_OUTPUT>/SubProcesses/P<chosen_proc> directory."
            sys.exit(0)

# Now we can use this MadLoop python module.

# This is a handy way of looking at what is available in the imported f2py module
# print help(matrix2py)

# Read the model parameters
matrix2py.initialise(
    os.path.abspath(
        pjoin(root_path, os.pardir, os.pardir, 'Cards', 'param_card.dat')))


def invert_momenta(p):
    """ fortran/C-python do not order table in the same order"""
    new_p = []
    for i in range(len(p[0])):
        new_p.append([0] * len(p))
    for i, onep in enumerate(p):
        for j, x in enumerate(onep):
            new_p[j][i] = x
    return new_p


# Now chose MadLoop's inputs for this evaluation
Exemplo n.º 5
0
        default=
        "$CMSSW_BASE/src/CMSAachen3B/GeneratorTools/data/vbf/SubProcesses/P0_dux_x0dux_no_a",
        help="Path to param_card.dat. [Default: %(default)s]")

    args = parser.parse_args()
    logger.initLogger(args)

    args.param_card = os.path.abspath(os.path.expandvars(args.param_card))
    args.process_directory = os.path.abspath(
        os.path.expandvars(args.process_directory))

    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
                              ],
                              [