Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Commit e3c8bdc

Browse files
fixup string manipulation for scoring planes
We do two things with the input subsystem name: 1. We capitalize the first letter and then append 'ScoringPlaneHits' to be the collection name 2. We prepend 'sp_' to be the match substring for logical volumes This means the input subsystem is the name of the scoring planes in the GDML with the 'sp_' prefix removed.
1 parent 84a117b commit e3c8bdc

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

python/sensitive_detectors.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ class ScoringPlaneSD(simcfg.SensitiveDetector) :
1212
----------
1313
subsystem : str
1414
Name of subsystem to store scoring plane hits for
15-
Names must match what is in gdml for <subsystem>_sp
15+
Names must match what is in gdml for sp_<subsystem>
1616
"""
1717
def __init__(self,subsystem) :
1818
super().__init__(f'{subsystem}_sp','simcore::ScoringPlaneSD','SimCore_SDs')
1919

20-
self.collection_name = f'{subsystem.capitalize()}ScoringPlaneHits'
21-
self.match_substr = f'sp_{subsystem.lower()}' #depends on gdml
20+
# we don't use the Python built-in str.capitalize since
21+
# that function changes all characters after the first one to lowercase
22+
self.collection_name = f'{subsystem[0].upper()+subsystem[1:]}ScoringPlaneHits'
23+
self.match_substr = f'sp_{subsystem}' #depends on gdml
2224

2325
def ecal() :
2426
return ScoringPlaneSD('ecal')

0 commit comments

Comments
 (0)