| 1 | =How can I remove some unwanted diagram? |
| 2 | |
| 3 | == Warning |
| 4 | |
| 5 | Be carefull about gauge invariance (a non gauge invariant subset will also break lorentz invariance) |
| 6 | |
| 7 | == Requirements: |
| 8 | |
| 9 | 1. This method is implemented since MG5aMC version 2.5.0 |
| 10 | 1. This method is only implemented for leading order processes |
| 11 | |
| 12 | == method: |
| 13 | |
| 14 | === user_filter.py |
| 15 | |
| 16 | You need to define the file user_filter.py who should define the function remove_diag(diag): |
| 17 | It should return True if you want to discard the diagram. |
| 18 | |
| 19 | example of file |
| 20 | {{{ |
| 21 | def remove_diag(diag): |
| 22 | """remove all diagram with quark in T-channel""" |
| 23 | for vertex in diag['vertices']: #last |
| 24 | if vertex['id'] == 0: #special final vertex |
| 25 | continue |
| 26 | if vertex['legs'][-1]['number'] < 3: #this means T-channel |
| 27 | if abs(vertex['legs'][-1]['id']) <6: |
| 28 | return True |
| 29 | return False |
| 30 | }}} |
| 31 | |
| 32 | === running with user_filter |
| 33 | |
| 34 | to activate the filtering, you have to add '--diagram_filter' |
| 35 | to the command |
| 36 | example |
| 37 | {{{ |
| 38 | generate p p > w+ w+ j j --diagram_filter |
| 39 | }}} |
| 40 | |
| 41 | If you remove any diagram you should see on the screen: |
| 42 | {{{ |
| 43 | INFO: Trying process: c c > w+ w+ s s WEIGHTED<=6 @1 |
| 44 | WARNING: Diagram filter is ON and removed 12 diagrams for this subprocess. |
| 45 | }}} |