#! /usr/bin/env python ################################################################################ # # Copyright (c) 2011 The MadGraph5_aMC@NLO Development team and Contributors # # This file is a part of the MadGraph5_aMC@NLO project, an application which # automatically generates Feynman diagrams and matrix elements for arbitrary # high-energy processes in the Standard Model and beyond. # # It is subject to the MadGraph5_aMC@NLO license which should accompany this # distribution. # # For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch # ################################################################################ """ This is the main script in order to generate events in MadEvent """ import logging import logging.config import os import re import shutil import subprocess import sys import time root_path = os.path.split(os.path.dirname(os.path.realpath( __file__ )))[0] pjoin = os.path.join sys.path.append(pjoin(root_path,'bin','internal')) import amcatnlo_run_interface as run if not sys.version_info[0] == 2 or sys.version_info[1] < 6: sys.exit('MadEvent works with python 2.6 or higher (but not python 3.X).\n\ Please upgrade your version of python.') def set_configuration(): import coloring_logging logging.config.fileConfig(os.path.join(root_path, 'bin', 'internal', 'me5_logging.conf')) logging.root.setLevel(logging.INFO) logging.getLogger('amcatnlo').setLevel(logging.INFO) logging.getLogger('madgraph').setLevel(logging.INFO) def treat_old_argument(argument): """Have the MG4 behavior for this script""" try: mode = int(argument[1]) except: mode = int(raw_input('Enter 2 for multi-core, 1 for parallel, 0 for serial run\n')) if mode == 0: try: name = argument[2] except: name = raw_input('Enter run name\n') else: try: opt = argument[2] except: if mode == 1: opt = raw_input('Enter name for jobs on pbs queue\n') else: opt = int(raw_input('Enter number of cores\n')) try: name = argument[3] except: name = raw_input('enter run name\n') # launch = ME.MadEventCmd(me_dir=root_path) if mode == 1: argument = ['fake','-f', str(name), '--cluster'] elif mode == 2: argument = ['fake','-f', '--multicore', str(name), '--nb_core=%s' % opt] else: argument = ['fake','-f', name] return argument ################################################################################ ## EXECUTABLE ################################################################################ if '__main__' == __name__: # Check that python version is valid set_configuration() argument = sys.argv try: if '-h' in argument or '--help' in argument: launch = run.aMCatNLOCmd(me_dir=root_path) launch.exec_cmd('help calculate_xsect') sys.exit() elif len(argument) > 1 and argument[1] in ['0', '1', '2']: argument = treat_old_argument(argument) launch = run.aMCatNLOCmd(me_dir=root_path) launch.run_cmd('calculate_xsect %s' % ' '.join(argument[1:])) launch.run_cmd('quit') except KeyboardInterrupt: try: launch.run_cmd('quit') except: pass if os.path.exists(pjoin(root_path, 'RunWeb')): os.remove(pjoin(root_path, 'RunWeb')) # reconfigure path for the web #if len(argument) == 5: # ME.pass_in_web_mode()