From 1e432d5468cb568ae584eecf887e434a71a2aa83 Mon Sep 17 00:00:00 2001 From: Andre Sailer Date: Thu, 24 Oct 2024 15:31:44 +0200 Subject: [PATCH] DDSim: add signalhandler by default, add disableSignalHandler flag to turn it off --- DDG4/python/DDSim/DD4hepSimulation.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DDG4/python/DDSim/DD4hepSimulation.py b/DDG4/python/DDSim/DD4hepSimulation.py index c4b356dfd..e585e5b5d 100644 --- a/DDG4/python/DDSim/DD4hepSimulation.py +++ b/DDG4/python/DDSim/DD4hepSimulation.py @@ -76,6 +76,7 @@ def __init__(self): self.vertexSigma = [0.0, 0.0, 0.0, 0.0] self.vertexOffset = [0.0, 0.0, 0.0, 0.0] self.enableDetailedShowerMode = False + self.disableSignalHandler = False self._errorMessages = [] self._dumpParameter = False @@ -208,6 +209,10 @@ def parseOptions(self, argv=None): default=self.enableDetailedShowerMode, help="use detailed shower mode") + parser.add_argument("--disableSignalHandler", action="store_true", dest="disableSignalHandler", + default=self.disableSignalHandler, + help="disable the Signal Handler of DD4hep") + parser.add_argument("--dumpSteeringFile", action="store_true", dest="dumpSteeringFile", default=self._dumpSteeringFile, help="print an example steering file to stdout") @@ -317,6 +322,8 @@ def run(self): # simple = DDG4.Geant4( kernel, tracker='Geant4TrackerAction',calo='Geant4CalorimeterAction') # geant4 = DDG4.Geant4( kernel, tracker='Geant4TrackerCombineAction',calo='Geant4ScintillatorCalorimeterAction') geant4 = DDG4.Geant4(kernel, tracker=self.action.tracker, calo=self.action.calo) + if not self.disableSignalHandler: + geant4.registerInterruptHandler() geant4.printDetectors()