~mg5core1/mg5amcnlo/2.6.4

« back to all changes in this revision

Viewing changes to madgraph/interface/master_interface.py

1. Fixed many of the first series of points from Olivier's review

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
   
73
73
    # Helper functions
74
74
   
 
75
    def setup(self, *args, **opts):
 
76
        """ Function to initialize the interface when switched to it. It is not
 
77
        the same as __init__ as this latter functions would call its mother
 
78
        from madgraph_interface and this is only desirable for the first
 
79
        initialization when launching MG5 """
 
80
        return self.cmd.setup(self, *args, **opts)
 
81
   
75
82
    def debug_link_to_command(self):
76
83
        """redefine all the command to call directly the appropriate child"""
77
84
        
148
155
        if not correct:
149
156
            raise Exception, 'The Cmd interface has dangerous features. Please see previous warnings and correct those.' 
150
157
 
 
158
    
 
159
 
151
160
    @staticmethod
152
161
    def extract_process_type(line):
153
162
        """Extract from a string what is the type of the computation. This 
517
526
            logger.info("Switching from interface %s to %s"\
518
527
                        %(self.interface_names[old_cmd][0],\
519
528
                          self.interface_names[name][0]))
520
 
            self.cleanup()
 
529
            # Setup the interface
 
530
            self.cmd.setup(self)
521
531
        
522
532
        if __debug__:
523
 
            self.debug_link_to_command()
524
 
 
525
 
        
526
 
    def cleanup(self):
527
 
        """ Refresh all the interface stored value as things like generated
528
 
        processes and amplitudes are not to be reused in between different
529
 
        interfaces """
530
 
 
531
 
        # Clear history, amplitudes and matrix elements when a model is imported
532
 
        # Remove previous imports, generations and outputs from history
533
 
        self.clean_history(remove_bef_lb1='import')
534
 
        # Reset amplitudes and matrix elements
535
 
        self._done_export=False
536
 
        self._curr_amps = diagram_generation.AmplitudeList()
537
 
        self._curr_matrix_elements = helas_objects.HelasMultiProcess()     
 
533
            self.debug_link_to_command() 
538
534
     
539
535
class MasterCmdWeb(Switcher, LoopCmd.LoopInterfaceWeb):
540
536