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 a crash when an action has dictionaries and is not hashable #1293

Closed
wants to merge 2 commits into from
Closed
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
35 changes: 17 additions & 18 deletions DDG4/python/DDG4.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,35 +670,34 @@ def setupDetector(self, name, action, collections=None):
return (seq, acts)
return (seq, acts[0])

def setupCalorimeter(self, name, type=None, collections=None): # noqa: A002
def setupCaloOrTracker(self, name, detType=None, collections=None, isCalo=True): # noqa: A002
"""
Setup subdetector of type 'calorimeter' and assign the proper sensitive action
"""
self.description.sensitiveDetector(str(name))
retType = detType
if detType is None:
retType = self.sensitive_types['calorimeter' if isCalo else 'tracker']
# detType is a tuple when an action with parameters in a dictionary is passed
elif not isinstance(detType, tuple) and detType in self.sensitive_types:
retType = self.sensitive_types[detType]
return self.setupDetector(name, retType, collections)

def setupCalorimeter(self, name, caloType=None, collections=None): # noqa: A002
"""
Setup subdetector of type 'calorimeter' and assign the proper sensitive action

\author M.Frank
"""
typ = type # noqa: A002
self.description.sensitiveDetector(str(name))
# sd.setType('calorimeter')
if typ is None:
typ = self.sensitive_types['calorimeter']
elif typ is not None and self.sensitive_types.get(typ):
typ = self.sensitive_types[typ]
return self.setupDetector(name, typ, collections)
return self.setupCaloOrTracker(name, caloType, collections, True)

def setupTracker(self, name, type=None, collections=None): # noqa: A002
def setupTracker(self, name, trackerType=None, collections=None): # noqa: A002
"""
Setup subdetector of type 'tracker' and assign the proper sensitive action

\author M.Frank
"""
typ = type
self.description.sensitiveDetector(str(name))
# sd.setType('tracker')
if typ is None:
typ = self.sensitive_types['tracker']
elif typ is not None and self.sensitive_types.get(typ):
typ = self.sensitive_types[typ]
return self.setupDetector(name, typ, collections)
return self.setupCaloOrTracker(name, trackerType, collections, False)

def _private_setupField(self, field, stepper, equation, prt):
import g4units
Expand Down
Loading