Version 3 (modified by 6 years ago) ( diff ) | ,
---|
=How can I remove some unwanted diagram?
Warning
Be carefull about gauge invariance (a non gauge invariant subset will also break lorentz invariance)
Requirements:
- This method is implemented since MG5aMC version 2.5.0
- 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
import madgraph.various.misc as misc def remove_diag(diag): """force to have two s-channel W decaying into a specific way. Designed for interference studies where decay chain are not allowed This is designed for keeping the following diagram generate p p > j j w- w-, w- > e- ve~ from the following syntax: p p > j j e- ve~ e- ve~ """ found_w = 0 for vertex in diag['vertices']: #misc.sprint(vertex.nice_string()) if vertex.get('id') == 0: #special final vertex continue if len(vertex['legs'])!=3: continue for i, leg in enumerate(list(vertex['legs'])): #misc.sprint(i, leg) if abs(leg['id']) != 24: continue else: break else: continue # we have a vertex with a W if i == 2: #This means a vertex A B > W or W > A B if leg['number'] > 2: # means that we have W > A B #misc.sprint(vertex.nice_string()) # check that A B are what we want if not all(oleg['state'] for oleg in vertex['legs'][:2]) : # this means not final state continue #misc.sprint([oleg['id'] for oleg in vertex['legs'][:2] ]) if set([oleg['id'] for oleg in vertex['legs'][:2] ]) == set([11,-12]): found_w +=1 else: # this means A W > B if vertex['legs'][-1].get('number') < 3: # T-channel -> continue continue else: #check that they are both final state if not vertex['legs'][-1]['state']: continue if not vertex['legs'][1 if i==0 else 0]['state']: continue other_id = [vertex['legs'][-1].get('id'), vertex['legs'][1 if i==0 else 0]['id']] if set(other_id) == set([11,-12]): found_w += 1 misc.sprint(found_w) if found_w == 2: return True else: 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.
Note:
See TracWiki
for help on using the wiki.