| 95 | | === Full library of process in python for version 2.6.0 and 2.7.0 |
| 96 | | |
| 97 | | If you are interested to have a single python library for a set of matrix-element. |
| 98 | | This is also possible in fortran/python. |
| 99 | | This is possible both for loop output ([sqr=virt]) and for tree level. |
| 100 | | {{{ |
| 101 | | generate p p > t t~ |
| 102 | | output standalone PATH --prefix=int |
| 103 | | }}} |
| 104 | | |
| 105 | | then you can compile the library by going to the SubProcesses directory and |
| 106 | | {{{ |
| 107 | | make allmatrix2py.so |
| 108 | | }}} |
| 109 | | |
| 110 | | Here is one example in that case |
| 111 | | {{{ |
| 112 | | import allmatrix2py |
| 113 | | allmatrix2py.initialise('../Cards/param_card.dat') |
| 114 | | |
| 115 | | def invert_momenta(p): |
| 116 | | """ fortran/C-python do not order table in the same order""" |
| 117 | | new_p = [] |
| 118 | | for i in range(len(p[0])): new_p.append([0]*len(p)) |
| 119 | | for i, onep in enumerate(p): |
| 120 | | for j, x in enumerate(onep): |
| 121 | | new_p[j][i] = x |
| 122 | | return new_p |
| 123 | | p =[[ 0.5000000E+03, 0.0000000E+00, 0.0000000E+00, 0.5000000E+03], |
| 124 | | [0.5000000E+03, 0.0000000E+00, 0.0000000E+00, -0.5000000E+03], |
| 125 | | [ 0.5000000E+03, 0.1040730E+03, 0.4173556E+03, -0.1872274E+03], |
| 126 | | [ 0.5000000E+03, -0.1040730E+03, -0.4173556E+03, 0.1872274E+03] |
| 127 | | ] |
| 128 | | |
| 129 | | p =invert_momenta(p) |
| 130 | | nhel = -1 # means sum over all helicity |
| 131 | | pdgs = [21,21,6,-6] #which pdg is requested |
| 132 | | scale2 = 0. #only used for loop matrix element. should be set to 0 for tree-level |
| 133 | | alphas=0.13 |
| 134 | | |
| 135 | | ans = allmatrix2py.smatrixhel(pdgs,p,alphas,scale2,nhel) |
| 136 | | print ans |
| 137 | | }}} |
| 138 | | |
| 139 | | === Python for version MG5_aMC version 2.5.x |
| 140 | | |
| 141 | | For version of the code older than 2.6.0, the syntax was: |
| 142 | | |
| 143 | | {{{ |
| 144 | | import matrix2py |
| 145 | | |
| 146 | | def invert_momenta(p): |
| 147 | | """ fortran/C-python do not order table in the same order""" |
| 148 | | new_p = [] |
| 149 | | for i in range(len(p[0])): new_p.append([0]*len(p)) |
| 150 | | for i, onep in enumerate(p): |
| 151 | | for j, x in enumerate(onep): |
| 152 | | new_p[j][i] = x |
| 153 | | return new_p |
| 154 | | |
| 155 | | matrix2py.initialise('../../Cards/param_card.dat') |
| 156 | | p = [[ 0.5000000E+03, 0.0000000E+00, 0.0000000E+00, 0.5000000E+03], |
| 157 | | [ 0.5000000E+03, 0.0000000E+00, 0.0000000E+00, -0.5000000E+03], |
| 158 | | [ 0.5000000E+03, 0.1109243E+03, 0.4448308E+03, -0.1995529E+03], |
| 159 | | [ 0.5000000E+03, -0.1109243E+03, -0.4448308E+03, 0.1995529E+03]] |
| 160 | | |
| 161 | | P =invert_momenta(p) |
| 162 | | alphas = 0.13 |
| 163 | | nhel = 0 # means sum over all helicity |
| 164 | | me2 = matrix2py.get_me(P, alphas, nhel) |
| 165 | | print me2 |
| 166 | | }}} |