~maddevelopers/mg5amcnlo/3.0.2-alpha0

« back to all changes in this revision

Viewing changes to madgraph/interface/FKS_interface.py

  • Committer: Valentin Hirschi
  • Date: 2012-03-23 14:27:14 UTC
  • Revision ID: spooner@tsf-wpa-3-5183.epfl.ch-20120323142714-bgagyyzgvil27k83
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:
32
32
import madgraph.iolibs.export_fks_born as export_fks_born
33
33
import madgraph.loop.loop_base_objects as loop_base_objects
34
34
import madgraph.core.diagram_generation as diagram_generation
 
35
import madgraph.core.helas_objects as helas_objects
35
36
 
36
37
#usefull shortcut
37
38
pjoin = os.path.join
134
135
class FKSInterface(CheckFKS, CompleteFKS, HelpFKS, mg_interface.MadGraphCmd):
135
136
    _fks_display_opts = ['real_diagrams', 'born_diagrams', 'virt_diagrams', 
136
137
                         'real_processes', 'born_processes', 'virt_processes']
 
138
 
 
139
    def __init__(self, mgme_dir = '', *completekey, **stdin):
 
140
        """ Special init tasks for the Loop Interface """
 
141
 
 
142
        mg_interface.MadGraphCmd.__init__(self, mgme_dir = '', *completekey, **stdin)
 
143
        self.setup()
 
144
    
 
145
    def setup(self):
 
146
        """ Special tasks when switching to this interface """
 
147
 
 
148
        # Refresh all the interface stored value as things like generated
 
149
        # processes and amplitudes are not to be reused in between different
 
150
        # interfaces
 
151
        # Clear history, amplitudes and matrix elements when a model is imported
 
152
        # Remove previous imports, generations and outputs from history
 
153
        self.clean_history(remove_bef_lb1='import')
 
154
        # Reset amplitudes and matrix elements
 
155
        self._done_export=False
 
156
        self._curr_amps = diagram_generation.AmplitudeList()
 
157
        self._curr_matrix_elements = helas_objects.HelasMultiProcess()
 
158
        
 
159
        # Set where to look for CutTools installation.
 
160
        # In further versions, it will be set in the same manner as _mgme_dir so that
 
161
        # the user can chose its own CutTools distribution.
 
162
        self._cuttools_dir=str(os.path.join(self._mgme_dir,'vendor','CutTools'))
 
163
        if not os.path.isdir(os.path.join(self._cuttools_dir, 'src','cts')):
 
164
            logger.warning(('Warning: Directory %s is not a valid CutTools directory.'+\
 
165
                           'Using default CutTools instead.') % \
 
166
                             self._cuttools_dir)
 
167
            self._cuttools_dir=str(os.path.join(self._mgme_dir,'vendor','CutTools'))
137
168
    
138
169
    def do_display(self, line, output=sys.stdout):
139
170
        # if we arrive here it means that a _fks_display_opts has been chosen
185
216
        args = self.split_arg(line)
186
217
        # Check the validity of the arguments
187
218
        self.check_add(args)
188
 
        proc_type=self.extract_process_type(line)
189
 
        self.validate_model(proc_type[1])
190
 
        
 
219
 
191
220
        if args[0] != 'process': 
192
221
            raise self.InvalidCmd("The add command can only be used with a process")
193
222
        else:
194
223
            line = ' '.join(args[1:])
 
224
            
 
225
        proc_type=self.extract_process_type(line)
 
226
        self.validate_model(proc_type[1])
195
227
 
196
 
        if proc_type[2]!=['QCD']:
197
 
                raise MadGraph5Error, 'FKS for reals only available in QCD for now, you asked %s' \
198
 
                        % ', '.join(orders)
199
 
                        
200
228
        #now generate the amplitudes as usual
201
229
        self.options['group_subprocesses'] = 'False'
202
230
        collect_mirror_procs = False
209
237
        else:
210
238
            myprocdef = mg_interface.MadGraphCmd.extract_process(self,line)
211
239
 
212
 
        myprocdef['perturbation_couplings'] = ['QCD']
 
240
        if myprocdef['perturbation_couplings']!=['QCD']:
 
241
                raise self.InvalidCmd("FKS for reals only available in QCD for now, you asked %s" \
 
242
                        % ', '.join(myprocdef['perturbation_couplings']))
213
243
 
214
244
        if self.options['fks_mode'] == 'born':
215
245
            self._fks_multi_proc = fks_born.FKSMultiProcessFromBorn(myprocdef,