| 42 | {{{ |
| 43 | import madgraph.various.misc as misc |
| 44 | |
| 45 | def remove_diag(diag): |
| 46 | """force to have two s-channel W decaying into a specific way. |
| 47 | Designed for interference studies where decay chain are not allowed |
| 48 | This is designed for keeping the following diagram generate p p > j j w- w-, w- > e- ve~ |
| 49 | from the following syntax: p p > j j e- ve~ e- ve~ |
| 50 | """ |
| 51 | |
| 52 | found_w = 0 |
| 53 | for vertex in diag['vertices']: |
| 54 | #misc.sprint(vertex.nice_string()) |
| 55 | if vertex.get('id') == 0: #special final vertex |
| 56 | continue |
| 57 | if len(vertex['legs'])!=3: |
| 58 | continue |
| 59 | |
| 60 | for i, leg in enumerate(list(vertex['legs'])): |
| 61 | #misc.sprint(i, leg) |
| 62 | if abs(leg['id']) != 24: |
| 63 | continue |
| 64 | else: |
| 65 | break |
| 66 | else: |
| 67 | continue |
| 68 | # we have a vertex with a W |
| 69 | if i == 2: #This means a vertex A B > W or W > A B |
| 70 | if leg['number'] > 2: # means that we have W > A B |
| 71 | #misc.sprint(vertex.nice_string()) |
| 72 | # check that A B are what we want |
| 73 | if not all(oleg['state'] for oleg in vertex['legs'][:2]) : # this means not final state |
| 74 | continue |
| 75 | #misc.sprint([oleg['id'] for oleg in vertex['legs'][:2] ]) |
| 76 | if set([oleg['id'] for oleg in vertex['legs'][:2] ]) == set([11,-12]): |
| 77 | found_w +=1 |
| 78 | else: # this means A W > B |
| 79 | if vertex['legs'][-1].get('number') < 3: |
| 80 | # T-channel -> continue |
| 81 | continue |
| 82 | else: |
| 83 | #check that they are both final state |
| 84 | if not vertex['legs'][-1]['state']: |
| 85 | continue |
| 86 | if not vertex['legs'][1 if i==0 else 0]['state']: |
| 87 | continue |
| 88 | |
| 89 | other_id = [vertex['legs'][-1].get('id'), vertex['legs'][1 if i==0 else 0]['id']] |
| 90 | if set(other_id) == set([11,-12]): |
| 91 | found_w += 1 |
| 92 | |
| 93 | misc.sprint(found_w) |
| 94 | if found_w == 2: |
| 95 | return True |
| 96 | else: |
| 97 | return False |
| 98 | |
| 99 | }}} |