diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt index c35a127d9bc9967755716d997f06198347c48f65..fceccea3c295f52d91888a0dc7475c769137ceda 100644 --- a/examples/ClientTests/CMakeLists.txt +++ b/examples/ClientTests/CMakeLists.txt @@ -492,7 +492,7 @@ if (DD4HEP_USE_GEANT4) foreach(script Assemblies LheD_tracker MiniTel MiniTel_hepmc NestedDetectors ) dd4hep_add_test_reg( ClientTests_sim_${script} COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" - EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/${script}.py batch + EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/${script}.py -batch REGEX_PASS NONE REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" ) endforeach(script) diff --git a/examples/ClientTests/scripts/Assemblies.py b/examples/ClientTests/scripts/Assemblies.py index 2db0af1dc1ccf5597b0aad6811214d0bde1f5433..ab6dac5abcfa6cc4f07ed73fa05819cda53d1200 100644 --- a/examples/ClientTests/scripts/Assemblies.py +++ b/examples/ClientTests/scripts/Assemblies.py @@ -25,6 +25,7 @@ from g4units import GeV, mm, cm def run(): + args = DDG4.CommandLine() kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] kernel.loadGeometry(str("file:" + install_dir + "/examples/ClientTests/compact/Assemblies.xml")) @@ -33,7 +34,7 @@ def run(): geant4.printDetectors() # Configure UI geant4.setupCshUI() - if len(sys.argv) >= 2 and sys.argv[1] == "batch": + if args.batch: kernel.UI = '' # Configure field diff --git a/examples/ClientTests/scripts/LheD_tracker.py b/examples/ClientTests/scripts/LheD_tracker.py index 814aa86fce7bae32fe279fbb0154c1658fd64207..512025c67451ddd58689273205d0b49fa957429b 100644 --- a/examples/ClientTests/scripts/LheD_tracker.py +++ b/examples/ClientTests/scripts/LheD_tracker.py @@ -35,6 +35,7 @@ logger = logging.getLogger(__name__) def run(): + args = DDG4.CommandLine() kernel = DDG4.Kernel() description = kernel.detectorDescription() @@ -49,7 +50,7 @@ def run(): geant4.setupCshUI() # geant4.setupCshUI('csh',True,True) # geant4.setupCshUI('csh',True,True,'vis.mac') - if len(sys.argv) >= 2 and sys.argv[1] == "batch": + if args.batch: kernel.UI = '' # Configure field diff --git a/examples/ClientTests/scripts/MiniTel.py b/examples/ClientTests/scripts/MiniTel.py index 899591761bc8050253a2678d212be97d55c18c96..853e341d45f1307e3a2bbb5d4070575d545bac5e 100644 --- a/examples/ClientTests/scripts/MiniTel.py +++ b/examples/ClientTests/scripts/MiniTel.py @@ -35,14 +35,14 @@ def run(): cmds.append('/ddg4/UI/terminate') m.kernel.UI = '' + # Configure G4 geometry setup + seq, act = m.geant4.addDetectorConstruction("Geant4DetectorGeometryConstruction/ConstructGeo") if args.debug: - # Configure G4 geometry setup - seq, act = m.geant4.addDetectorConstruction("Geant4DetectorGeometryConstruction/ConstructGeo") act.DebugVolumes = True act.DebugRegions = True act.DebugLimits = True - seq, act = m.geant4.addDetectorConstruction("Geant4DetectorSensitivesConstruction/ConstructSD") + seq, act = m.geant4.addDetectorConstruction("Geant4DetectorSensitivesConstruction/ConstructSD") m.ui.Commands = cmds m.configure() m.defineOutput() diff --git a/examples/ClientTests/scripts/MiniTel_hepmc.py b/examples/ClientTests/scripts/MiniTel_hepmc.py index 26787af63a789ef9a1d7f8afe906a4503284a345..ed08f33319247a74c0874be1c15101f09f954a75 100644 --- a/examples/ClientTests/scripts/MiniTel_hepmc.py +++ b/examples/ClientTests/scripts/MiniTel_hepmc.py @@ -26,8 +26,9 @@ import DDG4 def run(): from MiniTelSetup import Setup + args = DDG4.CommandLine() m = Setup() - if len(sys.argv) >= 2 and sys.argv[1] == "batch": + if args.batch: DDG4.setPrintLevel(DDG4.OutputLevel.WARNING) m.kernel.UI = '' m.configure() diff --git a/examples/ClientTests/scripts/NestedDetectors.py b/examples/ClientTests/scripts/NestedDetectors.py index c77bb540a6abfbda188ce9c7b944122210975c29..f5f2f099f6dfb23f79982df5607e4629fbe26e0e 100644 --- a/examples/ClientTests/scripts/NestedDetectors.py +++ b/examples/ClientTests/scripts/NestedDetectors.py @@ -28,6 +28,7 @@ from g4units import GeV, MeV def run(): + args = DDG4.CommandLine() kernel = DDG4.Kernel() install_dir = os.environ['DD4hepExamplesINSTALL'] kernel.setOutputLevel(str('Geant4Converter'), Output.DEBUG) @@ -37,7 +38,7 @@ def run(): geant4 = DDG4.Geant4(kernel) geant4.printDetectors() geant4.setupCshUI() - if len(sys.argv) >= 2 and sys.argv[1] == "batch": + if args.batch: kernel.UI = '' # Configure field