7 import os, shutil, subprocess
11 UFOModel (string) :: name of UFO model that is imported for the event generation
15 MGModelsLatest =
'/cvmfs/atlas.cern.ch/repo/sw/Generators/madgraph/models/latest/'
16 MGModelDirCVMFS = os.path.join(MGModelsLatest, UFOModel)
17 if not MGModelDirCVMFS:
18 athMsgLog.error(f
'could not find UFO model {UFOModel} on cvmfs.' \
19 f
' Are you sure it is available on {MGModelsLatest} ?')
23 shutil.copytree(MGModelDirCVMFS, UFOModel)
24 except FileExistsError:
25 if not overWriteLocalDir:
26 athMsgLog.error(f
'{UFOModel} already exists in your local directory.' \
27 ' Please (re)move this directory yourself to avoid it' \
28 ' being overwritten, or set `overWriteLocalDir` to True.' \
29 ' Exiting gracefully...')
32 shutil.rmtree(UFOModel)
33 shutil.copytree(MGModelDirCVMFS, UFOModel)
37 HERWIG7_PATH = os.environ[
'HERWIG7_PATH']
39 raise RuntimeError(
"HERWIG7_PATH environment variable not set")
40 ufo2herwig = os.path.join(HERWIG7_PATH,
'bin/ufo2herwig')
42 athMsgLog.error(f
'could not find Herwig7 ufo2herwig command: {ufo2herwig}')
47 subprocess.run([ufo2herwig, UFOModel], check =
True)
50 except subprocess.CalledProcessError:
54 shutil.rmtree(UFOModel)
55 shutil.copytree(MGModelDirCVMFS, UFOModel)
56 subprocess.run([ufo2herwig,
'--convert', UFOModel], check =
True)
58 subprocess.run([
'make'], shell =
True, check =
True)
61 Herwig7Config.add_commands(
"""