@@ -89,6 +89,8 @@ def __init__(self):
89
89
self .filter = Filter ()
90
90
self .physics = Physics ()
91
91
92
+ self ._argv = None
93
+
92
94
### use TCSH geant UI instead of QT
93
95
os .environ ['G4UI_USE_TCSH' ] = "1"
94
96
@@ -108,16 +110,20 @@ def readSteeringFile(self):
108
110
self .__dict__ = obj .__dict__
109
111
self .steeringFile = os .path .abspath (sFileTemp )
110
112
111
- def parseOptions (self ):
113
+ def parseOptions (self , argv = None ):
112
114
"""parse the command line options"""
115
+
116
+ if argv is None :
117
+ self ._argv = list (sys .argv )
118
+
113
119
parser = argparse .ArgumentParser ("Running DD4hep Simulations:" ,
114
120
formatter_class = argparse .RawTextHelpFormatter )
115
121
116
122
parser .add_argument ("--steeringFile" , "-S" , action = "store" , default = self .steeringFile ,
117
123
help = "Steering file to change default behaviour" )
118
124
119
125
#first we parse just the steering file, but only if we don't want to see the help message
120
- if not any ( opt in sys . argv for opt in ('-h' ,'--help' )):
126
+ if not any ( opt in self . _argv for opt in ('-h' ,'--help' )):
121
127
parsed , _unknown = parser .parse_known_args ()
122
128
self .steeringFile = parsed .steeringFile
123
129
self .readSteeringFile ()
@@ -603,8 +609,8 @@ def __addParametersToRunHeader( self ):
603
609
runHeader ["MacroFileContent" ] = mFile .read ()
604
610
605
611
### add command line
606
- if sys . argv :
607
- runHeader ["CommandLine" ] = " " .join (sys . argv )
612
+ if self . _argv :
613
+ runHeader ["CommandLine" ] = " " .join (self . _argv )
608
614
609
615
### add current working directory (where we call from)
610
616
runHeader ["WorkingDirectory" ] = os .getcwd ()
0 commit comments