diff --git a/DDG4/python/DDSim/Helper/Physics.py b/DDG4/python/DDSim/Helper/Physics.py index 9ca3801dc6180e59b0fd1b3cc34469c62c80d2c9..db1e82e335f65b7df7292795e1f678489e078fb7 100644 --- a/DDG4/python/DDSim/Helper/Physics.py +++ b/DDG4/python/DDSim/Helper/Physics.py @@ -5,8 +5,11 @@ import os from DDSim.Helper.ConfigHelper import ConfigHelper from g4units import mm +import logging import ddsix as six +logger = logging.getLogger(__name__) + class Physics(ConfigHelper): """Configuration for the PhysicsList""" @@ -139,7 +142,11 @@ class Physics(ConfigHelper): rg.RangeCut = self.rangecut for func in self._userFunctions: - func(kernel) + try: + func(kernel) + except Exception as e: + logger.error("Exception in UserFunction: %r", e) + raise RuntimeError("Exception in UserFunction: %r" % e) return seq