Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example args #1120

Merged
merged 2 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/ClientTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions examples/ClientTests/scripts/Assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# ==========================================================================
from __future__ import absolute_import, unicode_literals
import os
import sys
import time
import DDG4
from g4units import GeV, mm, cm
Expand All @@ -25,6 +24,7 @@


def run():
args = DDG4.CommandLine()
kernel = DDG4.Kernel()
install_dir = os.environ['DD4hepExamplesINSTALL']
kernel.loadGeometry(str("file:" + install_dir + "/examples/ClientTests/compact/Assemblies.xml"))
Expand All @@ -33,7 +33,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
Expand Down
4 changes: 2 additions & 2 deletions examples/ClientTests/scripts/LheD_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#
from __future__ import absolute_import, unicode_literals
import os
import sys
import time
import DDG4
from DDG4 import OutputLevel as Output
Expand All @@ -35,6 +34,7 @@


def run():
args = DDG4.CommandLine()
kernel = DDG4.Kernel()
description = kernel.detectorDescription()

Expand All @@ -49,7 +49,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
Expand Down
6 changes: 3 additions & 3 deletions examples/ClientTests/scripts/MiniTel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions examples/ClientTests/scripts/MiniTel_hepmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# ==========================================================================
from __future__ import absolute_import, unicode_literals
import os
import sys
import DDG4
#
"""
Expand All @@ -26,8 +25,9 @@

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()
Expand Down
4 changes: 2 additions & 2 deletions examples/ClientTests/scripts/NestedDetectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# ==========================================================================
from __future__ import absolute_import, unicode_literals
import os
import sys
import time
import DDG4
from DDG4 import OutputLevel as Output
Expand All @@ -28,6 +27,7 @@


def run():
args = DDG4.CommandLine()
kernel = DDG4.Kernel()
install_dir = os.environ['DD4hepExamplesINSTALL']
kernel.setOutputLevel(str('Geant4Converter'), Output.DEBUG)
Expand All @@ -37,7 +37,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
Expand Down