| | 1 | === Can I just calculate the amplitudes for a (sub)process and check them point-by-point in phase space points using MadGraph ? === |
| | 2 | |
| | 3 | The easiest way to do this is to create a Standalone package: |
| | 4 | {{{ |
| | 5 | generate p p > e+ e- |
| | 6 | output standalone PATH |
| | 7 | }}} |
| | 8 | 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. |
| | 9 | |
| | 10 | You can also returns a valid c++ standalon code by running |
| | 11 | {{{ |
| | 12 | generate p p > e+ e- |
| | 13 | output standalone_cpp PATH |
| | 14 | }}} |
| | 15 | |
| | 16 | 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): |
| | 17 | {{{ |
| | 18 | make matrix2py.so |
| | 19 | }}} |
| | 20 | |
| | 21 | Then you can link this from your python code. Here is an example: |
| | 22 | {{{ |
| | 23 | import matrix2py |
| | 24 | |
| | 25 | def invert_momenta(p): |
| | 26 | """ fortran/C-python do not order table in the same order""" |
| | 27 | new_p = [] |
| | 28 | for i in range(len(p[0])): new_p.append([0]*len(p)) |
| | 29 | for i, onep in enumerate(p): |
| | 30 | for j, x in enumerate(onep): |
| | 31 | new_p[j][i] = x |
| | 32 | return new_p |
| | 33 | |
| | 34 | matrix2py.initialise('../../Cards/param_card.dat') |
| | 35 | p = [[ 0.5000000E+03, 0.0000000E+00, 0.0000000E+00, 0.5000000E+03], |
| | 36 | [ 0.5000000E+03, 0.0000000E+00, 0.0000000E+00, -0.5000000E+03], |
| | 37 | [ 0.5000000E+03, 0.1109243E+03, 0.4448308E+03, -0.1995529E+03], |
| | 38 | [ 0.5000000E+03, -0.1109243E+03, -0.4448308E+03, 0.1995529E+03]] |
| | 39 | |
| | 40 | P =invert_momenta(p) |
| | 41 | alphas = 0.13 |
| | 42 | nhel = 0 # means sum over all helicity |
| | 43 | me2 = matrix2py.get_me(P, alphas, nhel) |
| | 44 | print me2 |
| | 45 | }}} |