| Version 6 (modified by , 8 years ago) ( diff ) |
|---|
Can I just calculate the amplitudes for a (sub)process and check them point-by-point in phase space points using MadGraph ?
The easiest way to do this is to create a Standalone package:
generate p p > e+ e- output standalone PATH
You can then easily choose which diagrams to include in the matrix.f files of the SubProcesses/P_xx_xxxx directories. There is also an example program (check_sa.f) in the SubProcesses directory which shows how to calculate the amplitude at specific phase space points or by using PS configurations from RAMBO.
You can also returns a valid c++ standalon code by running
generate p p > e+ e- output standalone_cpp PATH
Pythton
If you want to have acces to the matrix-element via python. The easiest is to have the fortran code wrapped into python (evaluating a matrix element in python is just too slow to be usable). Each of the SubProcesses/P_xx_xxxx of the standalone directory can be compiled to be python linkable (note this require f2py part of numpy and to have python-devel package installed):
make matrix2py.so
Then you can link this from your python code. Here is an example:
import matrix2py
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
matrix2py.initialisemodel('../../Cards/param_card.dat')
p = [[ 0.5000000E+03, 0.0000000E+00, 0.0000000E+00, 0.5000000E+03],
[ 0.5000000E+03, 0.0000000E+00, 0.0000000E+00, -0.5000000E+03],
[ 0.5000000E+03, 0.1109243E+03, 0.4448308E+03, -0.1995529E+03],
[ 0.5000000E+03, -0.1109243E+03, -0.4448308E+03, 0.1995529E+03]]
P =invert_momenta(p)
alphas = 0.13
nhel = -1 # means sum over all helicity
me2 = matrix2py.get_value(P, alphas, nhel)
print me2
Full library of process in python
If you are interested to have a single python library for a set of matrix-element. This is also possible in fortran/python. This is possible both for loop output ([sqr=virt]) and for tree level.
generate p p > t t~ output standalone PATH --prefix=int
then you can compile the library by going to the SubProcesses directory and
make allmatrix2py.so
Here is one example in that case
import allmatrix2py
allmatrix2py.initialise('../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
p =[[ 0.5000000E+03, 0.0000000E+00, 0.0000000E+00, 0.5000000E+03],
[0.5000000E+03, 0.0000000E+00, 0.0000000E+00, -0.5000000E+03],
[ 0.5000000E+03, 0.1040730E+03, 0.4173556E+03, -0.1872274E+03],
[ 0.5000000E+03, -0.1040730E+03, -0.4173556E+03, 0.1872274E+03]
]
p =invert_momenta(p)
nhel = -1 # means sum over all helicity
pdgs = [21,21,6,-6] #which pdg is requested
scale2 = 0. #only used for loop matrix element. should be set to 0 for tree-level
alphas=0.13
ans = allmatrix2py.smatrixhel(pdgs,p,alphas,scale2,nhel)
print ans
Python for version MG5_aMC version 2.5.x
For version of the code older than 2.6.0, the syntax was:
import matrix2py
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
matrix2py.initialise('../../Cards/param_card.dat')
p = [[ 0.5000000E+03, 0.0000000E+00, 0.0000000E+00, 0.5000000E+03],
[ 0.5000000E+03, 0.0000000E+00, 0.0000000E+00, -0.5000000E+03],
[ 0.5000000E+03, 0.1109243E+03, 0.4448308E+03, -0.1995529E+03],
[ 0.5000000E+03, -0.1109243E+03, -0.4448308E+03, 0.1995529E+03]]
P =invert_momenta(p)
alphas = 0.13
nhel = 0 # means sum over all helicity
me2 = matrix2py.get_me(P, alphas, nhel)
print me2
