Newer
Older
"""Dummy helper object for particle gun properties"""
from __future__ import absolute_import, unicode_literals
from DDSim.Helper.ConfigHelper import ConfigHelper
OUTPUT_CHOICES = (1, 2, 3, 4, 5, 6, 7, 'VERBOSE', 'DEBUG',
'INFO', 'WARNING', 'ERROR', 'FATAL', 'ALWAYS')
def outputLevelType(level):
"""Return verbosity level as integer if possible.
Still benefit from argparsers list of possible choices
"""
try:
return int(level)
except ValueError:
return str(level)
def outputLevel(level):
"""return INT for outputlevel"""
if isinstance(level, int):
if level < 1 or 7 < level:
raise KeyError
return level
outputlevels = {"VERBOSE": 1,
"DEBUG": 2,
"INFO": 3,
"WARNING": 4,
"ERROR": 5,
"FATAL": 6,
"ALWAYS": 7}
return outputlevels[level.upper()]
"""Configuration for the output levels of DDG4 components"""
self._kernel_EXTRA = {'choices': OUTPUT_CHOICES, 'type': outputLevelType}
self._kernel = outputLevel('INFO')
Andre Sailer
committed
self._part_EXTRA = {'choices': OUTPUT_CHOICES, 'type': outputLevelType}
Andre Sailer
committed
self._inputStage_EXTRA = {'choices': OUTPUT_CHOICES, 'type': outputLevelType}
self._inputStage = outputLevel('INFO')
Andre Sailer
committed
self._random_EXTRA = {'choices': OUTPUT_CHOICES, 'type': outputLevelType}
self._random = outputLevel('FATAL')
"""Output level for input sources"""
return self._inputStage
@inputStage.setter
def inputStage(self, level):
self._inputStage = outputLevel(level)
@property
"""Output level for Geant4 kernel"""
return self._kernel
@kernel.setter
def kernel(self, level):
self._kernel = outputLevel(level)
@property
"""Output level for ParticleHandler"""
return self._part
@part.setter
def part(self, level):
self._part = outputLevel(level)
"""Output level for Random Number Generator setup"""
return self._random
@random.setter
def random(self, level):
self._random = outputLevel(level)