Skip to content
Snippets Groups Projects
ddsim.in.py 771 B
Newer Older
#!/usr/bin/env @PYTHON_INTERPRETER_BINARY@
"""

DD4hep simulation with some argument parsing
Based on M. Frank and F. Gaede runSim.py
   @author  A.Sailer
   @version 0.1

"""
Marko Petric's avatar
Marko Petric committed
from __future__ import absolute_import, unicode_literals
import logging
from DDSim.DD4hepSimulation import DD4hepSimulation

  logging.basicConfig(format='%(name)-16s %(levelname)s %(message)s', level=logging.INFO, stream=sys.stdout)
Marko Petric's avatar
Marko Petric committed
  logger = logging.getLogger('DDSim')

  RUNNER = DD4hepSimulation()
  RUNNER.parseOptions()

  try:
    RUNNER.run()
  except NameError as e:
    if "global name" in str(e):
      globalToSet = str(e).split("'")[1]
Marko Petric's avatar
Marko Petric committed
      logger.fatal("Unknown global variable, please add\nglobal %s\nto your steeringFile" % globalToSet)