Skip to content
Snippets Groups Projects
Commit eea3d3a7 authored by Andre Sailer's avatar Andre Sailer
Browse files

DDSim: Add logic to add help for non-property helper variables, add logic to...

DDSim: Add logic to add help for non-property helper variables, add logic to add choices for all helper options
parent 5c5c7891
No related branches found
No related tags found
No related merge requests found
......@@ -490,7 +490,8 @@ class DD4hepSimulation(object):
action="store",
dest="%s.%s" % (name, var),
default = valAndDoc[0],
help = valAndDoc[1]
help = valAndDoc[1],
choices = valAndDoc[2],
# type = type(val),
)
......
......@@ -19,12 +19,18 @@ class ConfigHelper( object ):
allVars = vars(self)
for var,val in allVars.iteritems():
if not var.startswith('_'):
finalVars[var] = (val,'')
helpName = "_%s_HELP" % var
optName = "_%s_OPTIONS" % var
doc = getattr(self, helpName) if hasattr(self, helpName) else ''
choices = getattr(self, optName) if hasattr(self, optName) else None
finalVars[var] = (val, doc, choices)
# now get things defined with @property
props = [(p, getattr(type(self),p)) for p in dir(type(self)) if isinstance(getattr(type(self),p),property)]
for propName, prop in props:
finalVars[propName] = (getattr(self, propName), prop.__doc__)
optName = "_%s_OPTIONS" % propName
choices = getattr(self, optName) if hasattr(self, optName) else None
finalVars[propName] = (getattr(self, propName), prop.__doc__, choices)
return finalVars
......
......@@ -13,10 +13,14 @@ class Gun( ConfigHelper ):
self._position = (0.0,0.0,0.0)
self._isotrop = False
self._direction = (0,0,1)
self._phiMin_HELP = "Minimal azimuthal angle for random distribution"
self.phiMin = None
self.phiMax = None
self.thetaMin = None
self.thetaMax = None
self._distribution_OPTIONS = ['uniform', 'cos(theta)', 'eta', 'pseudorapidity', 'ffbar'] ## (1+cos^2 theta)
self._distribution = None
......
......@@ -7,9 +7,16 @@ class Output( ConfigHelper ):
"""Configuration for the output levels of DDG4 components"""
def __init__( self ):
super(Output, self).__init__()
self._kernel_OPTIONS = (1,2,3,4,5,6,7,'VERBOSE','DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL', 'ALWAYS')
self._kernel = outputLevel('INFO')
self._part_OPTIONS = (1,2,3,4,5,6,7,'VERBOSE','DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL', 'ALWAYS')
self._part = outputLevel('INFO')
self._inputStage_OPTIONS = (1,2,3,4,5,6,7,'VERBOSE','DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL', 'ALWAYS')
self._inputStage = outputLevel('INFO')
self._random_OPTIONS = (1,2,3,4,5,6,7,'VERBOSE','DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL', 'ALWAYS')
self._random = outputLevel('FATAL')
@property
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment