wiki:FAQ-General-15
Last modified 4 weeks ago Last modified on 10/24/17 23:32:44

=How can I remove some unwanted diagram?

Warning

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

Requirements:

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

method:

user_filter.py

You need to define the file user_filter.py 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
             continue
         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.