Version 5 (modified by omatt, 4 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
```

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)):  new_p.append(*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
```