=How can I remove some unwanted diagram?


Be carefull about gauge invariance (a non gauge invariant subset will also break lorentz invariance)


  1. This method is implemented since MG5aMC version 2.5.0
  2. This method is only implemented for leading order processes


You need to define the file who should define the function remove_diag(diag): It should return True if you want to discard the diagram.

example of file

def remove_diag(diag):
    """remove all diagram with quark in T-channel"""
    for vertex in diag['vertices']: #last
         if vertex['id'] == 0: #special final vertex
         if vertex['legs'][-1]['number'] < 3: #this means T-channel
             if abs(vertex['legs'][-1]['id']) <6:
                  return True
    return False
def remove_diag(diag):
    """remove all diagram which are not pure QCD or pure QED: Fake example"""

    if diag.get('orders')['QCD'] >0 and diag.get('orders')['QED']>0:
        return True

    return False

running with user_filter

to activate the filtering, you have to add '--diagram_filter' to the command example

generate p p > w+ w+ j j --diagram_filter

If you remove any diagram you should see on the screen:

INFO: Trying process: c c > w+ w+ s s WEIGHTED<=6 @1
WARNING: Diagram filter is ON and removed 12 diagrams for this subprocess.
Last modified 5 months ago Last modified on Oct 24, 2017 11:32:44 PM