From 4a0299138cf09efa54b706eb25b4f1c052977c81 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Thu, 9 Aug 2018 09:11:31 +0200
Subject: [PATCH] DDSim: have to return when successfully instantiated user
 particle handler

---
 DDG4/python/DDSim/Helper/ParticleHandler.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/DDG4/python/DDSim/Helper/ParticleHandler.py b/DDG4/python/DDSim/Helper/ParticleHandler.py
index 5b0ee9a7c..ad7711cee 100644
--- a/DDG4/python/DDSim/Helper/ParticleHandler.py
+++ b/DDG4/python/DDSim/Helper/ParticleHandler.py
@@ -110,6 +110,10 @@ class ParticleHandler( ConfigHelper ):
     if not self.userParticleHandler:
       return
 
+    if self.userParticleHandler not in ["Geant4TCUserParticleHandler"]:
+      print "ERROR: unknown UserParticleHandler: %r" % self.userParticleHandler
+      exit(1)
+
     if self.userParticleHandler == "Geant4TCUserParticleHandler":
       user = DDG4.Action(kernel,"%s/UserParticleHandler" % self.userParticleHandler)
       try:
@@ -127,5 +131,4 @@ class ParticleHandler( ConfigHelper ):
         exit(1)
       part.adopt(user)
 
-    print "ERROR: unknown UserParticleHandler: %r" % self.userParticleHandler
-    exit(1)
+    return
-- 
GitLab