This repository was archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsensitive_detectors.py
More file actions
143 lines (108 loc) · 4.13 KB
/
Copy pathsensitive_detectors.py
File metadata and controls
143 lines (108 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
"""Configuration classes for sensitive detectors"""
from LDMX.SimCore import simcfg
class ScoringPlaneSD(simcfg.SensitiveDetector) :
"""Scoring plane SD
Simply collecting tracker-hit equivalent for scoring planes that
enclose different subsystems
Parameters
----------
subsystem : str
Name of subsystem to store scoring plane hits for
Names must match what is in gdml for <subsystem>_sp
"""
def __init__(self,subsystem) :
super().__init__(f'{subsystem}_sp','simcore::ScoringPlaneSD','SimCore_SDs')
self.collection_name = f'{subsystem.capitalize()}ScoringPlaneHits'
self.match_substr = f'sp_{subsystem.lower()}' #depends on gdml
def ecal() :
return ScoringPlaneSD('ecal')
def hcal() :
return ScoringPlaneSD('hcal')
def target() :
return ScoringPlaneSD('target')
def magnet() :
return ScoringPlaneSD('magnet')
def tracker() :
sp = ScoringPlaneSD('tracker')
sp.match_substr = 'sp_recoil'
return sp
class TrackerSD(simcfg.SensitiveDetector) :
"""SD for the recoil and tagging trackers
Parameters
----------
subsystem : str
Recoil or Tagger
subdet_id : int
ID number for the subsystem
"""
def __init__(self,subsystem,subdet_id) :
super().__init__(f'{subsystem}_TrackerSD','simcore::TrackerSD','SimCore_SDs')
self.subsystem = subsystem
self.subdet_id = subdet_id
self.collection_name = f'{subsystem}SimHits'
def tagger() :
return TrackerSD('Tagger',1)
def recoil() :
return TrackerSD('Recoil',4)
class HcalSD(simcfg.SensitiveDetector) :
"""SD for the HCal
Separate from the other calorimeters since it includes a Birks law
estimate.
Parameters
----------
gdml_identifiers : list[str]
A list of strings used to determine which volumes in the Hcal are
considered sensitive. Any volume name containing at least one of these
identifiers will have a sensitive detector attached.
The current defaults match the mainline LDMX Hcal (ScintBox) and
prototype Hcal (scint_box) scintillator geometries.
"""
def __init__(self, gdml_identifiers = ['ScintBox', 'scint_box']) :
super().__init__('hcal_sd', 'simcore::HcalSD','SimCore_SDs')
self.gdml_identifiers = gdml_identifiers
class EcalSD(simcfg.SensitiveDetector) :
"""SD for the ECal
The two configurable parameters are inherited from a legacy method of
merging simulated hit contribs. We have plans to update this hit merging
in the future.
Parameters
----------
enableHitContribs : bool, optional
Should the simulation save contributions to Ecal sim hits?
compressHitContribs : bool, optional
Should the simulation compress contributions to Ecal sim hits by PDG ID?
"""
def __init__(self) :
super().__init__('ecal_sd', 'simcore::EcalSD','SimCore_SDs')
self.enableHitContribs = True
self.compressHitContribs = True
class TrigScintSD(simcfg.SensitiveDetector) :
"""Trigger Scintillaotr Sensitive Detector
used for both the trigger pad modules as well as collecting hits
within the target itself
Parameters
----------
module : int
ID number for the module we are collecting hits from
name : str
Short name to be used in building collection name
vol : str
Name of logical volume(s) that this SD should be attached to
DEPENDS ON GDML
"""
def __init__(self, module, name, vol) :
super().__init__(f'trig_scint_{name}_sd', 'simcore::TrigScintSD','SimCore_SDs')
self.module_id = module
self.volume_name = vol
coll = name+'SimHits'
if name != 'Target' :
coll = 'TriggerPad'+coll
self.collection_name = coll
def up() :
return TrigScintSD(2,'Up','trigger_pad_up_bar_volume')
def tag() :
return TrigScintSD(1,'Tagger','trigger_pad_tag_bar_volume')
def down() :
return TrigScintSD(3,'Down','trigger_pad_dn_bar_volume')
def target() :
return TrigScintSD(4,'Target','target')