~madteam/mg5amcnlo/series2.0

« back to all changes in this revision

Viewing changes to madgraph/core/helas_objects.py

mwrge with 2.7.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1334
1334
            if flip_sign:
1335
1335
                # Flip state and particle identity
1336
1336
                # (to keep particle identity * flow state)
1337
 
                new_wf.set('state', list(filter(lambda state: \
1338
 
                                           state != new_wf.get('state'),
1339
 
                                           ['incoming', 'outgoing']))[0])
 
1337
                new_wf.set('state', list([state for state in ['incoming', 'outgoing'] if state != new_wf.get('state')])[0])
1340
1338
                new_wf.set('is_part', not new_wf.get('is_part'))
1341
1339
            try:
1342
1340
                # Use the copy in wavefunctions instead.
1461
1459
        if name == 'is_part':
1462
1460
            return not self.get('is_part')
1463
1461
        if name == 'state':
1464
 
            return list(filter(lambda state: state != self.get('state'),
1465
 
                          ['incoming', 'outgoing']))[0]
 
1462
            return list([state for state in ['incoming', 'outgoing'] if state != self.get('state')])[0]
1466
1463
        return self.get(name)
1467
1464
    
1468
1465
    def get_external_helas_call_dict(self):
3979
3976
        """
3980
3977
 
3981
3978
        #check that decay does not specify polarization
3982
 
        wfs = filter(lambda w: w.get('state') == 'initial' , decay.get('diagrams')[0].get('wavefunctions'))
 
3979
        wfs = [w for w in decay.get('diagrams')[0].get('wavefunctions') if w.get('state') == 'initial']
3983
3980
        if any(wf.get('polarization') for wf in wfs):
3984
3981
            raise InvalidCmd( 'In decay-chain polarization can only be specified in production not in decay. Please Retry')
3985
3982
 
4446
4443
                      [leg for leg in self.get('processes')[0].get('legs') if leg.get('state') == True]]
4447
4444
 
4448
4445
        final_pols = [leg.get('polarization') for leg in \
4449
 
                      filter(lambda leg: leg.get('state') == True, \
4450
 
                              self.get('processes')[0].get('legs'))]
 
4446
                      [leg for leg in self.get('processes')[0].get('legs') if leg.get('state') == True]]
4451
4447
        
4452
4448
        pols_by_id = {}
4453
4449
        for id, pol in zip(final_legs, final_pols):
4713
4709
        state spin only """
4714
4710
        
4715
4711
        model = self.get('processes')[0].get('model')
4716
 
        initial_legs = filter(lambda leg: leg.get('state') == False, \
4717
 
                              self.get('processes')[0].get('legs'))
 
4712
        initial_legs = [leg for leg in self.get('processes')[0].get('legs') if leg.get('state') == False]
4718
4713
        hel_per_part = [ len(leg.get('polarization')) if leg.get('polarization') 
4719
4714
                        else len(model.get('particle_dict')[\
4720
4715
                                  leg.get('id')].get_helicity_states())
4726
4721
        """Gives (number of state for each initial particle)"""
4727
4722
 
4728
4723
        model = self.get('processes')[0].get('model')
4729
 
        initial_legs = filter(lambda leg: leg.get('state') == False, \
4730
 
                              self.get('processes')[0].get('legs'))
 
4724
        initial_legs = [leg for leg in self.get('processes')[0].get('legs') if leg.get('state') == False]
4731
4725
        hel_per_part = [ len(leg.get('polarization')) if leg.get('polarization') 
4732
4726
                        else len(model.get('particle_dict')[\
4733
4727
                                  leg.get('id')].get_helicity_states())
5783
5777
                    # Identical matrix element found
5784
5778
                    other_processes = identified_matrix_elements[me_index].\
5785
5779
                                      get('processes')
 
5780
                    
5786
5781
                    other_processes.append(cls.reorder_process(\
5787
5782
                        amplitude.get('process'),
5788
5783
                        permutations[me_index],
5822
5817
        """Reorder the legs in the process according to the difference
5823
5818
        between org_perm and proc_perm"""
5824
5819
 
 
5820
        
 
5821
        
5825
5822
        leglist = base_objects.LegList(\
5826
5823
                  [copy.copy(process.get('legs_with_decays')[i]) for i in \
5827
5824
                   diagram_generation.DiagramTag.reorder_permutation(\
5828
5825
                       proc_perm, org_perm)])
5829
5826
        new_proc = copy.copy(process)
 
5827
        if org_perm == proc_perm:
 
5828
            return new_proc
 
5829
 
 
5830
        if  len(org_perm) != len(process.get('legs_with_decays')):
 
5831
            raise Exception("issue on symmetry between process")
 
5832
 
5830
5833
        new_proc.set('legs_with_decays', leglist)
5831
 
 
 
5834
        
5832
5835
        if not new_proc.get('decay_chains'):
5833
5836
            new_proc.set('legs', leglist)
 
5837
            assert len(process.get('legs')) == len(leglist)
5834
5838
 
 
5839
            
5835
5840
        return new_proc