From 3d44701aeecd4aac4e21bda9a132b89de87648be Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Wed, 8 Aug 2018 13:49:30 +0200
Subject: [PATCH] DDSim: ensure -1 only used with input files

---
 DDG4/python/DDSim/DD4hepSimulation.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/DDG4/python/DDSim/DD4hepSimulation.py b/DDG4/python/DDSim/DD4hepSimulation.py
index 5a8c7d752..133bde70a 100644
--- a/DDG4/python/DDSim/DD4hepSimulation.py
+++ b/DDG4/python/DDSim/DD4hepSimulation.py
@@ -646,6 +646,8 @@ SIM = DD4hepSimulation()
     if self.enableGun and ( self.enableG4Gun or self.enableG4GPS ):
       self._errorMessages.append("ERROR: Cannot use both DD4hepGun and Geant4 Gun or GeneralParticleSource")
 
+    if self.numberOfEvents < 0 and not self.inputFiles:
+      self._errorMessages.append("ERROR: Negative number of events only sensible for inputFiles")
 
   def _enablePrimaryHandler( self ):
     """ the geant4 Gun or GeneralParticleSource cannot be used together with the PrimaryHandler.
-- 
GitLab