From 730a92d25888a7c1864bf51b4147f94495a2dce7 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Thu, 16 Feb 2023 20:49:57 +0100
Subject: [PATCH] DDSim: make it possible to use batchmode with
 userInputPlugins only

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

diff --git a/DDG4/python/DDSim/DD4hepSimulation.py b/DDG4/python/DDSim/DD4hepSimulation.py
index b6e2acbe4..da83bd6a8 100644
--- a/DDG4/python/DDSim/DD4hepSimulation.py
+++ b/DDG4/python/DDSim/DD4hepSimulation.py
@@ -665,8 +665,8 @@ SIM = DD4hepSimulation()
     if self.runType == "batch":
       if not self.numberOfEvents:
         self._errorMessages.append("ERROR: Batch mode requested, but did not set number of events")
-      if not self.inputFiles and not self.enableGun:
-        self._errorMessages.append("ERROR: Batch mode requested, but did not set inputFile(s) or gun")
+      if not (self.inputFiles or self.enableGun or self.inputConfig.userInputPlugin):
+        self._errorMessages.append("ERROR: Batch mode requested, but did not set inputFile(s), gun, or userInputPlugin")
 
     if self.inputFiles and (self.enableG4Gun or self.enableG4GPS):
       self._errorMessages.append("ERROR: Cannot use both inputFiles and Geant4Gun or GeneralParticleSource")
@@ -674,6 +674,9 @@ 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.inputConfig.userInputPlugin and (self.enableG4Gun or self.enableG4GPS):
+      self._errorMessages.append("ERROR: Cannot use both userInputPlugin 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")
 
-- 
GitLab