Package madgraph :: Package interface :: Module master_interface
[hide private]
[frames] | no frames]

Source Code for Module madgraph.interface.master_interface

  1  ################################################################################ 
  2  # 
  3  # Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors 
  4  # 
  5  # This file is a part of the MadGraph5_aMC@NLO project, an application which  
  6  # automatically generates Feynman diagrams and matrix elements for arbitrary 
  7  # high-energy processes in the Standard Model and beyond. 
  8  # 
  9  # It is subject to the MadGraph5_aMC@NLO license which should accompany this  
 10  # distribution. 
 11  # 
 12  # For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch 
 13  # 
 14  ################################################################################ 
 15  """A user friendly command line interface to access all MadGraph5_aMC@NLO features. 
 16     Uses the cmd package for command interpretation and tab completion. 
 17  """ 
 18   
 19   
 20  from __future__ import absolute_import 
 21  import atexit 
 22  import logging 
 23  import optparse 
 24  import os 
 25  import pydoc 
 26  import re 
 27  import subprocess 
 28  import sys 
 29  import traceback 
 30  import time 
 31   
 32  root_path = os.path.split(os.path.dirname(os.path.realpath( __file__ )))[0] 
 33  root_path = os.path.split(root_path)[0] 
 34  sys.path.insert(0, root_path) 
 35   
 36  #usefull shortcut 
 37  pjoin = os.path.join 
 38   
 39  import madgraph 
 40  import madgraph.core.diagram_generation as diagram_generation 
 41  import madgraph.core.helas_objects as helas_objects 
 42  import madgraph.loop.loop_base_objects as loop_base_objects 
 43  import madgraph.interface.extended_cmd as cmd 
 44  import madgraph.interface.madgraph_interface as MGcmd 
 45  import madgraph.interface.loop_interface as LoopCmd 
 46  import madgraph.interface.amcatnlo_interface as amcatnloCmd 
 47  import madgraph.fks.fks_base as fks_base 
 48  import madgraph.iolibs.files as files 
 49  import madgraph.various.misc as misc 
 50   
 51  from madgraph import MG4DIR, MG5DIR, MadGraph5Error, InvalidCmd 
 52   
 53  logger = logging.getLogger('cmdprint') # -> stdout 
54 55 56 -class Switcher(object):
57 """ Helping class containing all the switching routine """ 58
59 - def __init__(self, main='MadGraph', *args, **opt):
60 61 # define the interface 62 self.change_principal_cmd(main) 63 self.cmd.__init__(self, *args, **opt)
64 65 interface_names= {'MadGraph':('MG5_aMC',MGcmd.MadGraphCmd), 66 'MadLoop':('MG5_aMC',LoopCmd.LoopInterface), 67 'aMC@NLO':('MG5_aMC',amcatnloCmd.aMCatNLOInterface)} 68 69 _switch_opts = list(interface_names.keys()) 70 current_interface = None 71 72 # Helper functions 73
74 - def setup(self, *args, **opts):
75 """ Function to initialize the interface when switched to it. It is not 76 the same as __init__ as this latter functions would call its mother 77 from madgraph_interface and this is only desirable for the first 78 initialization when launching MG5 """ 79 return self.cmd.setup(self, *args, **opts)
80 158 159 160 161 @staticmethod
162 - def extract_process_type(line):
163 """Extract from a string what is the type of the computation. This 164 returns a tuple (mode, option, pert_orders) where mode can be either 'NLO' or 'tree' 165 and option 'all', 'real' or 'virt'.""" 166 167 # Perform sanity modifications on the lines: 168 # Add a space before and after any > , $ / | [ ] 169 space_before = re.compile(r"(?P<carac>\S)(?P<tag>[\\[\\]/\,\\$\\>|])(?P<carac2>\S)") 170 line2 = space_before.sub(r'\g<carac> \g<tag> \g<carac2>', line) 171 172 # Use regular expressions to extract the loop mode (if present) and its 173 # option, specified in the line with format [ option = loop_orders ] or 174 # [ loop_orders ] which implicitly select the 'all' option. 175 loopRE = re.compile(r"^(.*)(?P<loop>\[(\s*(?P<option>\w+)\s*=)?(?P<orders>.+)?\])(.*)$") 176 # Make sure that the content of options following '--' are not considered. 177 res=loopRE.search(re.split('%s\-\-', line,1)[0]) 178 if res: 179 orders=res.group('orders').split() if res.group('orders') else [] 180 if res.group('option') and len(res.group('option').split())==1: 181 if res.group('option').split()[0]=='tree': 182 return ('tree',res.group('option').split()[0],orders) 183 else: 184 return ('NLO',res.group('option').split()[0],orders) 185 else: 186 # If not option is set the convention is that the mode is 'all' 187 # unless no perturbation orders is defined. 188 # if order is set to LOonly assume LOonly=QCD 189 if orders == ['LOonly']: 190 return ('NLO', 'LOonly', ['QCD']) 191 elif len(orders)>0: 192 return ('NLO','all',orders) 193 else: 194 return ('tree',None,[]) 195 else: 196 return ('tree',None,[])
197 198 # Wrapping functions possibly switching to new interfaces 199
200 - def do_add(self, line, *args, **opts):
201 202 allow_switch = True 203 if self._curr_amps: 204 allow_switch = False 205 206 argss = cmd.Cmd.split_arg(line) 207 if len(argss)>=1 and argss[0] in ['process','timing','profile']: 208 proc_line = ' '.join(argss[1:]) 209 (type,nlo_mode,orders)=self.extract_process_type(proc_line) 210 if type=='NLO': 211 if not nlo_mode in self._valid_nlo_modes: raise self.InvalidCMD( \ 212 'The NLO mode %s is not valid. Please choose one among: %s' \ 213 % (nlo_mode, ' '.join(self._valid_nlo_modes))) 214 elif nlo_mode in ['all', 'real', 'LOonly']: 215 self.change_principal_cmd('aMC@NLO', allow_switch) 216 elif nlo_mode in ['virt', 'sqrvirt']: 217 self.change_principal_cmd('MadLoop', allow_switch) 218 elif nlo_mode == 'noborn': 219 if self.current_interface == "MadGraph": 220 allow_switch = True 221 self.change_principal_cmd('MadLoop', allow_switch) 222 self.cmd.validate_model(self, loop_type=nlo_mode, 223 coupling_type=orders) 224 self.change_principal_cmd('MadGraph', allow_switch) 225 return self.cmd.create_loop_induced(self, line, *args, **opts) 226 else: 227 self.change_principal_cmd('MadGraph', allow_switch) 228 try: 229 return self.cmd.do_add(self, line, *args, **opts) 230 except fks_base.NoBornException: 231 logger.info("------------------------------------------------------------------------", '$MG:BOLD') 232 logger.info(" No Born diagrams found. Now switching to the loop-induced mode. ", '$MG:BOLD') 233 logger.info(" Please cite ref. 'arXiv:1507.00020' when using results from this mode. ", '$MG:BOLD') 234 logger.info("------------------------------------------------------------------------", '$MG:BOLD') 235 self.change_principal_cmd('MadGraph',allow_switch) 236 return self.cmd.create_loop_induced(self, line, *args, **opts)
237 238
239 - def do_check(self, line, *args, **opts):
240 241 argss = self.split_arg(line) 242 proc_line = " ".join(argss[1:]) 243 (type,nlo_mode,orders)=self.extract_process_type(proc_line) 244 if type=='NLO': 245 if not nlo_mode in self._valid_nlo_modes: raise self.InvalidCMD(\ 246 'The NLO mode %s is not valid. Please chose one among: %s' \ 247 % (nlo_mode, ' '.join(self._valid_nlo_modes))) 248 elif nlo_mode == 'all': 249 self.change_principal_cmd('MadLoop') 250 elif nlo_mode == 'real': 251 raise self.InvalidCMD('Mode [real=...] not valid for checking processes.') 252 self.change_principal_cmd('aMC@NLO') 253 elif nlo_mode == 'virt' or nlo_mode == 'sqrvirt': 254 self.change_principal_cmd('MadLoop') 255 else: 256 self.change_principal_cmd('MadGraph') 257 258 return self.cmd.do_check(self, line, *args, **opts)
259
260 - def do_generate(self, line, *args, **opts):
261 262 argss = cmd.Cmd.split_arg(line) 263 # Make sure to switch to the right interface. 264 if len(argss)>=1: 265 proc_line = ' '.join(argss[1:]) 266 (type,nlo_mode,orders)=self.extract_process_type(proc_line) 267 if type=='NLO': 268 if not nlo_mode in self._valid_nlo_modes: raise self.InvalidCmd( \ 269 'The NLO mode %s is not valid. Please chose one among: %s' \ 270 % (nlo_mode, ' '.join(self._valid_nlo_modes))) 271 elif nlo_mode in ['all', 'real', 'LOonly']: 272 self._fks_multi_proc = fks_base.FKSMultiProcess() 273 self.change_principal_cmd('aMC@NLO') 274 elif nlo_mode == 'virt' or nlo_mode == 'virtsqr': 275 self.change_principal_cmd('MadLoop') 276 else: 277 self.change_principal_cmd('MadGraph') 278 return self.cmd.do_generate(self, line, *args, **opts)
279
280 - def do_import(self, *args, **opts):
281 self.cmd.do_import(self, *args, **opts) 282 if self._curr_model: 283 if isinstance(self._curr_model, loop_base_objects.LoopModel) and \ 284 self._curr_model['perturbation_couplings']!=[] and \ 285 self.current_interface not in ['aMC@NLO','MadLoop']: 286 self.change_principal_cmd('aMC@NLO') 287 if (not isinstance(self._curr_model, loop_base_objects.LoopModel) or \ 288 self._curr_model['perturbation_couplings']==[]) and \ 289 self.current_interface in ['MadLoop']: 290 self.change_principal_cmd('MadGraph') 291 import madgraph.various.misc as misc 292 return
293
294 - def do_output(self, line, *args, **opts):
295 """ treat output aloha in order to use always the one in MG5 """ 296 if line.strip().startswith('aloha'): 297 MGcmd.MadGraphCmd.do_output(self, line, *args, **opts) 298 else: 299 self.cmd.do_output(self, line, *args, **opts)
300
301 - def check_output(self, arg, *args, **opts):
302 if arg and arg[0] == 'aloha': 303 MGcmd.MadGraphCmd.check_output(self, arg, *args, **opts) 304 else: 305 self.cmd.check_output(self, arg, *args, **opts)
306 307 308 309 310 # Dummy functions, not triggering any switch of interfaces 311
312 - def export(self, *args, **opts):
313 return self.cmd.export(self, *args, **opts)
314
315 - def check_add(self, *args, **opts):
316 return self.cmd.check_add(self, *args, **opts)
317
318 - def check_answer_in_input_file(self, *args, **opts):
319 return self.cmd.check_answer_in_input_file(self, *args, **opts)
320
321 - def check_check(self, *args, **opts):
322 return self.cmd.check_check(self, *args, **opts)
323
324 - def check_define(self, *args, **opts):
325 return self.cmd.check_define(self, *args, **opts)
326
327 - def check_decay_diagram(self, *args, **opts):
328 return self.cmd.check_decay_diagram(self, *args, **opts)
329
330 - def complete_decay_diagram(self, *args, **opts):
331 return self.cmd.complete_decay_diagram(self, *args, **opts)
332
333 - def do_decay_diagram(self, *args, **opts):
334 return self.cmd.do_decay_diagram(self, *args, **opts)
335
336 - def help_decay_diagram(self, *args, **opts):
337 return self.cmd.help_decay_diagram(self, *args, **opts)
338
339 - def check_compute_widths(self, *args, **opts):
340 return self.cmd.check_compute_widths(self, *args, **opts)
341
342 - def complete_compute_widths(self, *args, **opts):
343 return self.cmd.complete_compute_widths(self, *args, **opts)
344
345 - def do_compute_widths(self, *args, **opts):
346 return self.cmd.do_compute_widths(self, *args, **opts)
347
348 - def help_compute_widths(self, *args, **opts):
349 return self.cmd.help_compute_widths(self, *args, **opts)
350
351 - def check_display(self, *args, **opts):
352 return self.cmd.check_display(self, *args, **opts)
353
354 - def check_draw(self, *args, **opts):
355 return self.cmd.check_draw(self, *args, **opts)
356
357 - def check_for_export_dir(self, *args, **opts):
358 return self.cmd.check_for_export_dir(self, *args, **opts)
359
360 - def check_generate(self, *args, **opts):
361 return self.cmd.check_generate(self, *args, **opts)
362
363 - def check_tutorial(self, *args, **opts):
364 return self.cmd.check_tutorial(self, *args, **opts)
365
366 - def check_history(self, *args, **opts):
367 return self.cmd.check_history(self, *args, **opts)
368
369 - def check_import(self, *args, **opts):
370 return self.cmd.check_import(self, *args, **opts)
371
372 - def check_install(self, *args, **opts):
373 return self.cmd.check_install(self, *args, **opts)
374
375 - def check_launch(self, *args, **opts):
376 return self.cmd.check_launch(self, *args, **opts)
377
378 - def check_load(self, *args, **opts):
379 return self.cmd.check_load(self, *args, **opts)
380
381 - def check_open(self, *args, **opts):
382 return self.cmd.check_open(self, *args, **opts)
383
384 - def check_process_format(self, *args, **opts):
385 return self.cmd.check_process_format(self, *args, **opts)
386
387 - def check_save(self, *args, **opts):
388 return self.cmd.check_save(self, *args, **opts)
389
390 - def check_set(self, *args, **opts):
391 return self.cmd.check_set(self, *args, **opts)
392
393 - def get_stored_line(self, *args, **opts):
394 return self.cmd.get_stored_line(self, *args, **opts)
395
396 - def complete_add(self, *args, **opts):
397 return self.cmd.complete_add(self, *args, **opts)
398
399 - def complete_switch(self, *args, **opts):
400 return self.cmd.complete_switch(self, *args, **opts)
401
402 - def complete_check(self, *args, **opts):
403 return self.cmd.complete_check(self, *args, **opts)
404
405 - def help_convert(self, *args, **opts):
406 return self.cmd.help_convert(self, *args, **opts)
407
408 - def complete_convert(self, *args, **opts):
409 return self.cmd.complete_convert(self, *args, **opts)
410
411 - def complete_define(self, *args, **opts):
412 return self.cmd.complete_define(self, *args, **opts)
413
414 - def complete_display(self, *args, **opts):
415 return self.cmd.complete_display(self, *args, **opts)
416
417 - def complete_draw(self, *args, **opts):
418 return self.cmd.complete_draw(self, *args, **opts)
419
420 - def complete_generate(self, *args, **opts):
421 return self.cmd.complete_generate(self, *args, **opts)
422
423 - def complete_help(self, *args, **opts):
424 return self.cmd.complete_help(self, *args, **opts)
425
426 - def complete_history(self, *args, **opts):
427 return self.cmd.complete_history(self, *args, **opts)
428
429 - def complete_import(self, *args, **opts):
430 return self.cmd.complete_import(self, *args, **opts)
431
432 - def complete_install(self, *args, **opts):
433 return self.cmd.complete_install(self, *args, **opts)
434
435 - def complete_launch(self, *args, **opts):
436 return self.cmd.complete_launch(self, *args, **opts)
437
438 - def complete_load(self, *args, **opts):
439 return self.cmd.complete_load(self, *args, **opts)
440
441 - def complete_open(self, *args, **opts):
442 return self.cmd.complete_open(self, *args, **opts)
443
444 - def complete_output(self, *args, **opts):
445 return self.cmd.complete_output(self, *args, **opts)
446
447 - def complete_save(self, *args, **opts):
448 return self.cmd.complete_save(self, *args, **opts)
449
450 - def complete_set(self, *args, **opts):
451 return self.cmd.complete_set(self, *args, **opts)
452
453 - def complete_tutorial(self, *args, **opts):
454 return self.cmd.complete_tutorial(self, *args, **opts)
455
456 - def do_switch(self, *args, **opts):
457 """Not in help """ 458 return self.cmd.do_switch(self, *args, **opts)
459
460 - def do_EOF(self, *args, **opts):
461 return self.cmd.do_EOF(self, *args, **opts)
462
463 - def do_define(self, *args, **opts):
464 return self.cmd.do_define(self, *args, **opts)
465
466 - def do_display(self, *args, **opts):
467 try: 468 return self.cmd.do_display(self, *args, **opts) 469 except AttributeError as error: 470 if "_fks_multi_proc" in str(error): 471 self.do_switch('MadGraph') 472 return self.cmd.do_display(self, *args, **opts)
473
474 - def do_exit(self, *args, **opts):
475 return self.cmd.do_exit(self, *args, **opts)
476
477 - def do_help(self, *args, **opts):
478 return self.cmd.do_help(self, *args, **opts)
479
480 - def do_convert(self, *args, **opts):
481 return self.cmd.do_convert(self, *args, **opts)
482
483 - def do_convert_model(self, *args, **opts):
484 return self.cmd.do_convert_model(self, *args, **opts)
485
486 - def do_history(self, *args, **opts):
487 return self.cmd.do_history(self, *args, **opts)
488
489 - def do_install(self, *args, **opts):
490 self.cmd.do_install(self, *args, **opts)
491
492 - def do_launch(self, line, *argss, **opts):
493 args = cmd.Cmd.split_arg(line) 494 # check if a path is given 495 if len(args) >=1: 496 if os.path.isdir(args[0]): 497 path = os.path.realpath(args[0]) 498 elif os.path.isdir(pjoin(MG5DIR,args[0])): 499 path = pjoin(MG5DIR,args[0]) 500 elif MG4DIR and os.path.isdir(pjoin(MG4DIR,args[0])): 501 path = pjoin(MG4DIR,args[0]) 502 else: 503 path=None 504 # if there is a path, find what output has been done 505 if path: 506 type = self.cmd.find_output_type(self, path) 507 if type in ['standalone', 'standalone_cpp', 'pythia8', 'madevent']: 508 self.change_principal_cmd('MadGraph') 509 elif type == 'aMC@NLO': 510 self.change_principal_cmd('aMC@NLO') 511 elif type == 'MadLoop': 512 self.change_principal_cmd('MadLoop') 513 514 return self.cmd.do_launch(self, line, *argss, **opts)
515
516 - def do_load(self, *args, **opts):
517 return self.cmd.do_load(self, *args, **opts)
518
519 - def do_open(self, *args, **opts):
520 return self.cmd.do_open(self, *args, **opts)
521
522 - def do_quit(self, *args, **opts):
523 return self.cmd.do_quit(self, *args, **opts)
524
525 - def do_save(self, *args, **opts):
526 return self.cmd.do_save(self, *args, **opts)
527
528 - def do_set(self, *args, **opts):
529 return self.cmd.do_set(self, *args, **opts)
530
531 - def do_tutorial(self, *args, **opts):
532 return self.cmd.do_tutorial(self, *args, **opts)
533
534 - def help_EOF(self, *args, **opts):
535 return self.cmd.help_EOF(self, *args, **opts)
536
537 - def help_add(self, *args, **opts):
538 return self.cmd.help_add(self, *args, **opts)
539
540 - def help_check(self, *args, **opts):
541 return self.cmd.help_check(self, *args, **opts)
542
543 - def help_define(self, *args, **opts):
544 return self.cmd.help_define(self, *args, **opts)
545
546 - def help_display(self, *args, **opts):
547 return self.cmd.help_display(self, *args, **opts)
548
549 - def help_generate(self, *args, **opts):
550 return self.cmd.help_generate(self, *args, **opts)
551
552 - def help_help(self, *args, **opts):
553 return self.cmd.help_help(self, *args, **opts)
554
555 - def help_history(self, *args, **opts):
556 return self.cmd.help_history(self, *args, **opts)
557
558 - def help_import(self, *args, **opts):
559 return self.cmd.help_import(self, *args, **opts)
560
561 - def help_install(self, *args, **opts):
562 return self.cmd.help_install(self, *args, **opts)
563
564 - def help_launch(self, *args, **opts):
565 return self.cmd.help_launch(self, *args, **opts)
566
567 - def help_load(self, *args, **opts):
568 return self.cmd.help_load(self, *args, **opts)
569
570 - def help_open(self, *args, **opts):
571 return self.cmd.help_open(self, *args, **opts)
572
573 - def help_output(self, *args, **opts):
574 return self.cmd.help_output(self, *args, **opts)
575
576 - def help_quit(self, *args, **opts):
577 return self.cmd.help_quit(self, *args, **opts)
578
579 - def help_save(self, *args, **opts):
580 return self.cmd.help_save(self, *args, **opts)
581
582 - def help_set(self, *args, **opts):
583 return self.cmd.help_set(self, *args, **opts)
584
585 - def help_tutorial(self, *args, **opts):
586 return self.cmd.help_tutorial(self, *args, **opts)
587
588 - def test_interface(self, *args, **opts):
589 return self.cmd.test_interface(self, *args, **opts)
590
591 - def set_configuration(self, *args, **opts):
592 return self.cmd.set_configuration(self, *args, **opts)
593
594 - def check_customize_model(self, *args, **opts):
595 return self.cmd.check_customize_model(self, *args, **opts)
596
597 - def complete_customize_model(self, *args, **opts):
598 return self.cmd.complete_customize_model(self, *args, **opts)
599
600 - def do_customize_model(self, *args, **opts):
601 return self.cmd.do_customize_model(self, *args, **opts)
602
603 - def help_customize_model(self, *args, **opts):
604 return self.cmd.help_customize_model(self, *args, **opts)
605
606 -class MasterCmd(Switcher, LoopCmd.LoopInterface, amcatnloCmd.aMCatNLOInterface, cmd.CmdShell):
607
608 - def __init__(self, main='MadGraph', *args, **opt):
609 610 # define the interface 611 if main in list(self.interface_names.keys()): 612 self.prompt= self.interface_names[main][0]+'>' 613 self.cmd= self.interface_names[main][1] 614 self.current_interface=main 615 else: 616 raise MadGraph5Error('Type of interface not valid: %s' % main) 617 self.cmd.__init__(self, *args, **opt) 618 self.current_interface = main
619
620 - def complete_switch(self, text, line, begidx, endidx):
621 """Complete the switch command""" 622 return self.list_completion(text,self._switch_opts)
623
624 - def do_switch(self, line):
625 """Not in help: Allow to switch to any given interface from command line """ 626 627 args = cmd.Cmd.split_arg(line) 628 if len(args)==1 and args[0] in list(self.interface_names.keys()): 629 self.change_principal_cmd(args[0]) 630 else: 631 raise self.InvalidCmd("Invalid switch command or non existing interface %s."\ 632 %args[0]+" Valid interfaces are %s"\ 633 %','.join(list(interface_quick_name.keys())))
634
635 - def change_principal_cmd(self, name, allow_switch=True):
636 637 638 old_cmd=self.current_interface 639 if old_cmd == name: 640 return 641 elif not allow_switch: 642 raise InvalidCmd("Command not compatible with previous command: Can not combine LO/NLO feature.") 643 644 if name in list(self.interface_names.keys()): 645 self.prompt= self.interface_names[name][0]+'>' 646 self.cmd= self.interface_names[name][1] 647 self.current_interface=name 648 else: 649 raise MadGraph5Error('Type of interface not valid: %s' % name) 650 651 if self.interface_names[old_cmd][0]!=self.interface_names[name][0]: 652 logger.info("Switching from interface %s to %s"\ 653 %(self.interface_names[old_cmd][0],\ 654 self.interface_names[name][0])) 655 # Setup the interface 656 self.cmd.setup(self) 657 658 if __debug__: 659 self.debug_link_to_command()
660
661 662 -class MasterCmdWeb(MGcmd.MadGraphCmdWeb, Switcher, LoopCmd.LoopInterfaceWeb):
663
664 - def __init__(self, *arg, **opt):
665 666 if '_CONDOR_SCRATCH_DIR' in os.environ: 667 self.writing_dir = pjoin(os.environ['_CONDOR_SCRATCH_DIR'], \ 668 os.path.pardir) 669 else: 670 self.writing_dir = pjoin(os.environ['MADGRAPH_DATA'], 671 os.environ['REMOTE_USER']) 672 673 674 #standard initialization 675 Switcher.__init__(self, mgme_dir = '', *arg, **opt) 676 677 self.options['timeout'] = 1 # time authorize to answer question [0 is no time limit]
678
679 - def change_principal_cmd(self, name):
680 if name == 'MadGraph': 681 self.cmd = MGcmd.MadGraphCmdWeb 682 elif name == 'Loop': 683 self.cmd = LoopCmd.LoopInterfaceWeb 684 else: 685 raise MadGraph5Error('Type of interface not valid') 686 687 if __debug__: 688 self.debug_link_to_command()
689
690 - def do_shell(self, *args):
691 raise Exception
692
693 - def finalize(self, nojpeg, flaglist=[]):
694 """Finalize web generation""" 695 696 if flaglist != []: 697 raise Exception 698 self.cmd.finalize(self, nojpeg, online = True)
699
700 - def finalize(self, nojpeg, **opts):
701 """Finalize web generation""" 702 703 opts['online'] = True 704 self.cmd.finalize(self, nojpeg, opts)
705 706 # Generate a new amplitude
707 - def do_generate(self, line):
708 """Generate an amplitude for a given process""" 709 710 try: 711 Switcher.do_generate(self, line) 712 except: 713 # put the stop logo on the web 714 files.cp(self._export_dir+'/HTML/stop.jpg',self._export_dir+'/HTML/card.jpg') 715 raise
716 717 # Add a process to the existing multiprocess definition
718 - def do_add(self, line):
719 """Generate an amplitude for a given process and add to 720 existing amplitudes 721 syntax: 722 """ 723 try: 724 Switcher.do_add(self, line) 725 except: 726 # put the stop logo on the web 727 files.cp(self._export_dir+'/HTML/stop.jpg',self._export_dir+'/HTML/card.jpg') 728 raise
729 730 # Use the cluster file for the configuration
731 - def set_configuration(self, config_path=None, final=False):
732 733 """Force to use the web configuration file only""" 734 config_path = pjoin(os.environ['MADGRAPH_BASE'], 'mg5_configuration.txt') 735 return Switcher.set_configuration(self, config_path=config_path, final=final)
736
737 - def do_save(self, line, check=True, **opt):
738 """Save information to file""" 739 740 if check: 741 self.check_save([]) 742 raise #useless but full security 743 744 args = self.split_arg(line) 745 if args[0] != 'options': 746 Switcher.do_save(self, line,check, opt) 747 else: 748 # put default options since 749 # in the web the local file is not used 750 # in download the default file is more usefull 751 files.cp(pjoin(MG5DIR,'input','mg5_configuration.txt'), args[1])
752
753 - def do_install(self, line):
754 """block all install""" 755 return
756