~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to madgraph/core/base_objects.py

mwrge with 2.7.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
3386
3386
        final.sort()
3387
3387
        return (tuple(initial), tuple(final))
3388
3388
    
3389
 
    def get_final_ids_after_decay(self):
 
3389
    def get_initial_final_ids_after_decay(self, max_depth=-1):
 
3390
        """return a tuple of two tuple containing the id of the initial/final
 
3391
           state particles. Each list is ordered"""
 
3392
           
 
3393
        initial = [l.get('id') for l in self.get('legs')\
 
3394
              if not l.get('state')]
 
3395
        final = self.get_final_ids_after_decay(max_depth=max_depth)
 
3396
        initial.sort()
 
3397
        final.sort()
 
3398
        return (tuple(initial), tuple(final))
 
3399
        
 
3400
    
 
3401
    def get_final_ids_after_decay(self, max_depth=-1):
3390
3402
        """Give the pdg code of the process including decay"""
3391
3403
        
3392
3404
        finals = self.get_final_ids()
3393
 
        for proc in self.get('decay_chains'):
3394
 
            init = proc.get_initial_ids()[0]
3395
 
            #while 1:
3396
 
            try:
3397
 
                pos = finals.index(init)
3398
 
            except:
3399
 
                break
3400
 
            finals[pos] = proc.get_final_ids_after_decay()
 
3405
        if max_depth !=0 :
 
3406
            for proc in self.get('decay_chains'):
 
3407
                init = proc.get_initial_ids()[0]
 
3408
                #while 1:
 
3409
                try:
 
3410
                    pos = finals.index(init)
 
3411
                except:
 
3412
                    break
 
3413
                finals[pos] = proc.get_final_ids_after_decay(max_depth-1)
3401
3414
        output = []
3402
3415
        for d in finals:
3403
3416
            if isinstance(d, list):