From ffe4627218c171a734bfc234496732dfea38a574 Mon Sep 17 00:00:00 2001 From: Frank Gaede <frank.gaede@desy.de> Date: Wed, 13 Jan 2016 10:04:27 +0000 Subject: [PATCH] - allow the default sensitive action to be a tuple with parameter dictionary, e.g.: SIM.action.tracker = ("Geant4TrackerWeightedAction", {"HitPositionCombination" : 1 , "CollectSingleDeposits" : False } ) --- DDG4/python/DDG4.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/DDG4/python/DDG4.py b/DDG4/python/DDG4.py index 3e80c91f6..c30c95191 100644 --- a/DDG4/python/DDG4.py +++ b/DDG4/python/DDG4.py @@ -477,12 +477,23 @@ class Geant4: sdtyp = self.sensitive_types[typ] print '+++ %-32s type:%-12s --> Sensitive type: %s'%(o.name(), typ, sdtyp,) - def setupDetector(self,name,sensitive_type): + def setupDetector(self,name,action): + #fg: allow the action to be a tuple with parameter dictionary + sensitive_type = "" + parameterDict = {} + if isinstance( action, tuple ): + sensitive_type = action[0] + parameterDict = action[1] + else: + sensitive_type = action + seq = SensitiveSequence(self.kernel(),'Geant4SensDetActionSequence/'+name) act = SensitiveAction(self.kernel(),sensitive_type+'/'+name+'Handler',name) seq.enableUI() act.enableUI() seq.add(act) + for parameter, value in parameterDict.iteritems(): + setattr( act, parameter, value) return (seq,act) def setupCalorimeter(self,name,type=None): -- GitLab