-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprototype-geometry-reference.py
More file actions
361 lines (289 loc) · 11.6 KB
/
prototype-geometry-reference.py
File metadata and controls
361 lines (289 loc) · 11.6 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
#!/usr/bin/env python3
# A short script containing representations of the variables that are used in
# the geometry description. Useful for testing and calculations.
#
# Note that all units are in mm
import numpy as np
# Constants
center = np.array([0., 0., 0.])
hadron_calorimeter_pos = np.array([0., 0., 0.])
world_dim = 10000.
absorber_width = 665.
absorber_height = 700.
absorber_thickness = 20.
absorber_hole_radius = 6.5
absorber_hole_distance_from_edge = 16.
bar_mounting_plate_thickness = 3.
scint_thickness = 20.
scint_bar_length = 2000.
scint_bar_width = 50.
scint_bar_cover_thickness = 0.5
layer_thickness = 45. # Note hardcoded
air_thickness = layer_thickness - (
absorber_thickness +
bar_mounting_plate_thickness +
scint_thickness +
scint_bar_cover_thickness) # Derived from other variables now
num_bars_front = 8
num_bars_back = 12
num_layers_front_vertical = 4
num_layers_front_horizontal = 5
num_layers_front = num_layers_front_vertical + num_layers_front_horizontal
num_layers_back_vertical = 5
num_layers_back_horizontal = 5
num_layers_back = num_layers_back_vertical + num_layers_back_horizontal
num_layers = num_layers_front + num_layers_back
num_absorbers = num_layers + 1 # 1 Extra plate in the back
back_start = num_layers_front * layer_thickness
dx = 3000.
dy = 3000.
dz = num_layers * layer_thickness
first_layer_zpos = -dz / 2
first_layer_absorber_zpos = first_layer_zpos + absorber_thickness / 2
first_layer_scint_cover_zpos = first_layer_zpos + \
absorber_thickness + \
scint_bar_cover_thickness / 2
assert (first_layer_scint_cover_zpos ==
first_layer_absorber_zpos +
absorber_thickness / 2 +
scint_bar_cover_thickness / 2)
first_layer_scint_zpos = first_layer_zpos + \
absorber_thickness + \
scint_bar_cover_thickness + \
scint_thickness / 2
assert (first_layer_scint_zpos ==
first_layer_scint_cover_zpos +
scint_bar_cover_thickness / 2 +
scint_thickness / 2)
first_layer_bar_mounting_plate_zpos = first_layer_zpos + \
absorber_thickness + \
scint_bar_cover_thickness + \
scint_thickness + \
bar_mounting_plate_thickness / 2
assert (first_layer_bar_mounting_plate_zpos ==
first_layer_scint_zpos +
scint_thickness / 2 +
bar_mounting_plate_thickness / 2)
first_back_layer_zpos = first_layer_zpos + back_start
scint_front_vertical_x = num_bars_front * scint_bar_width
scint_front_vertical_y = scint_bar_length
scint_front_horizontal_x = scint_bar_length
scint_front_horizontal_y = num_bars_front * scint_bar_width
scint_back_vertical_x = num_bars_back * scint_bar_width
scint_back_vertical_y = scint_bar_length
scint_back_horizontal_x = scint_bar_length
scint_back_horizontal_y = num_bars_back * scint_bar_width
bar_mounting_plate_horizontal_x = scint_back_horizontal_x
bar_mounting_plate_horizontal_y = scint_back_horizontal_y
bar_mounting_plate_vertical_x = scint_back_vertical_x
bar_mounting_plate_vertical_y = scint_back_vertical_y
trigger_bar_gap = 0.3
trigger_bar_dx = 40.
trigger_bar_dy = 3.
trigger_bar_dz = 2.
number_of_trigger_bars = 6
trigger_layer_distance_from_detector = 300.
lyso_bar_gap = 0.3
lyso_bar_dx = 30
lyso_bar_dy = 2.1
lyso_bar_dz = 0.6
number_of_lyso_bars = 8
lyso_plate_dx = 30
lyso_plate_dy = 20
lyso_plate_dz = 1.2
prototype_extra_space = 1000.
trigger_scintillator_extra_dz = trigger_layer_distance_from_detector + \
trigger_bar_dz + \
trigger_bar_gap
prototype_box_dz = dz + \
2 * trigger_scintillator_extra_dz + \
prototype_extra_space
# Solids
absorber_box = {"width": absorber_width,
"height": absorber_height,
"depth": absorber_thickness}
vertical_bar_mounting_plate_box = {"width": bar_mounting_plate_vertical_x,
"height": bar_mounting_plate_vertical_y,
"depth": bar_mounting_plate_thickness}
horizontal_bar_mounting_plate_box = {"width": bar_mounting_plate_horizontal_x,
"height": bar_mounting_plate_horizontal_y,
"depth": bar_mounting_plate_thickness}
front_vertical_scint_box = {"width": scint_front_vertical_x,
"height": scint_front_vertical_y,
"depth": scint_thickness}
front_horizontal_scint_box = {"width": scint_front_horizontal_x,
"height": scint_front_horizontal_y,
"depth": scint_thickness}
back_vertical_scint_box = {"width": scint_back_vertical_x,
"height": scint_back_vertical_y,
"depth": scint_thickness}
back_horizontal_scint_box = {"width": scint_back_horizontal_x,
"height": scint_back_horizontal_y,
"depth": scint_thickness}
front_vertical_scint_cover_box = {"width": scint_front_vertical_x,
"height": scint_front_vertical_y,
"depth": scint_bar_cover_thickness}
front_horizontal_scint_cover_box = {"width": scint_front_horizontal_x,
"height": scint_front_horizontal_y,
"depth": scint_bar_cover_thickness}
back_vertical_scint_cover_box = {"width": scint_back_vertical_x,
"height": scint_back_vertical_y,
"depth": scint_bar_cover_thickness}
back_horizontal_scint_cover_box = {"width": scint_back_horizontal_x,
"height": scint_back_horizontal_y,
"depth": scint_bar_cover_thickness
}
air_box = {"width": dx,
"height": dy,
"depth": air_thickness}
prototype_box = {"width": dx,
"height": dy,
"depth": prototype_box_dz}
world_box = {"width": world_dim,
"height": world_dim,
"depth": world_dim}
trigger_bar_box = {"width": trigger_bar_dx,
"height": trigger_bar_dy,
"depth": trigger_bar_dz}
lyso_bar_box = {"width": lyso_bar_dx,
"height": lyso_bar_dy,
"depth": lyso_bar_dz}
lyso_plate_box = {"width": lyso_plate_dx,
"height": lyso_plate_dy,
"depth": lyso_plate_dz}
class physical_volume:
def __init__(self, position, name="", CopyNumber=None):
self.position = position
if CopyNumber is not None:
self.CopyNumber = CopyNumber
self.depth = position[2]
def __repr__(self):
return str(self.__dict__)
# Physical volumes
first_layer_absorber_pos = np.array([0.,
0.,
first_layer_absorber_zpos])
distance_to_subsequent_absorber_layer = np.array(
[0.,
0.,
layer_thickness])
absorber_physvols = [
physical_volume(position=first_layer_absorber_pos +
distance_to_subsequent_absorber_layer * (i - 1),
name="absorber_physvol",
CopyNumber=i)
for i in range(1, num_absorbers + 1)
]
distance_to_subsequent_scint_layer = np.array(
[0.,
0.,
2. * layer_thickness])
scint_front_horizontal_first_layer_pos = np.array(
[bar_x_displacement,
0.,
first_layer_scint_zpos]
)
front_horizontal_scint_physvols = [
physical_volume(position=(layer - 1) * distance_to_subsequent_scint_layer +
scint_front_horizontal_first_layer_pos,
name="front_horizontal_scint_physvol",
CopyNumber=2*layer - 1)
for layer in range(1, num_layers_front_horizontal + 1)
]
scint_front_vertical_first_layer_pos = np.array(
[0.,
0.,
first_layer_scint_zpos]) \
+ distance_to_subsequent_scint_layer / 2
front_vertical_scint_physvols = [
physical_volume(position=(layer - 1) * distance_to_subsequent_scint_layer +
scint_front_vertical_first_layer_pos,
name="front_vertical_scint_physvol",
CopyNumber=2*layer)
for layer in range(1, num_layers_front_vertical + 1)
]
scint_back_vertical_first_layer_pos = np.array(
[0.,
0.,
first_layer_scint_zpos + back_start])
back_vertical_scint_physvols = [
physical_volume(position=(layer - 1) * distance_to_subsequent_scint_layer +
scint_back_vertical_first_layer_pos,
name="back_vertical_scint_physvol",
CopyNumber=2*layer + num_layers_front - 1)
for layer in range(1, num_layers_back_vertical + 1)
]
scint_back_horizontal_first_layer_pos = np.array([
bar_x_displacement,
0.,
first_layer_scint_zpos +
back_start]) \
+ distance_to_subsequent_scint_layer / 2
back_horizontal_scint_physvols = [
physical_volume(position=(layer - 1) * distance_to_subsequent_scint_layer +
scint_back_horizontal_first_layer_pos,
name="back_horizontal_scint_physvol",
CopyNumber=2*layer + num_layers_front
)
for layer in range(1, num_layers_back_horizontal + 1)
]
distance_to_subsequent_trigger_layer = np.array(
[0.,
trigger_bar_dy + trigger_bar_gap,
0])
trigger_first_layer_even_pos = np.array(
[0,
trigger_bar_dy*(1 - 0.5 - number_of_trigger_bars/2) +
trigger_bar_gap*(1 - 1 - number_of_trigger_bars/2),
- trigger_bar_dz - trigger_bar_gap - dz/2
- trigger_layer_distance_from_detector])
trigger_first_layer_odd_pos = np.array(
[0,
trigger_bar_dy*(1 - 0 - number_of_trigger_bars/2) +
trigger_bar_gap*(1 - 1 - number_of_trigger_bars/2),
-dz/2 - trigger_layer_distance_from_detector])
trigger_physvols = ["placeholder" for i in range(1, number_of_trigger_bars*2)]
for i in range(1, number_of_trigger_bars):
trigger_physvols[i*2-2] = physical_volume(
position=trigger_first_layer_even_pos +
(i - 1) * distance_to_subsequent_trigger_layer,
name="trigger_physvol",
CopyNumber=2*i-2)
trigger_physvols[i*2-1] = physical_volume(
position=trigger_first_layer_odd_pos +
(i - 1) * distance_to_subsequent_trigger_layer,
name="trigger_physvol",
CopyNumber=2*i-1)
def absorber_copynumbers():
return [absorber_physvols[i].CopyNumber
for i in range(0, num_layers)]
def front_horizontal_copynumbers():
return [front_horizontal_scint_physvols[i].CopyNumber
for i in range(0, num_layers_front_horizontal)]
def front_vertical_copynumbers():
return [front_vertical_scint_physvols[i].CopyNumber
for i in range(0, num_layers_front_vertical)]
def back_horizontal_copynumbers():
return [back_horizontal_scint_physvols[i].CopyNumber
for i in range(0, num_layers_back_horizontal)]
def back_vertical_copynumbers():
return [back_vertical_scint_physvols[i].CopyNumber
for i in range(0, num_layers_back_vertical)]
def trigger_copynumbers():
return [trigger_physvols[i].CopyNumber
for i in range(0, number_of_trigger_bars*2)]
def front_horizontal_depths():
return [front_horizontal_scint_physvols[i].depth
for i in range(0, num_layers_front_horizontal)]
def front_vertical_depths():
return [front_vertical_scint_physvols[i].depth
for i in range(0, num_layers_front_vertical)]
def back_horizontal_depths():
return [back_horizontal_scint_physvols[i].depth
for i in range(0, num_layers_back_horizontal)]
def back_vertical_depths():
return [back_vertical_scint_physvols[i].depth
for i in range(0, num_layers_back_vertical)]
def trigger_depths():
return [trigger_physvols[i].depth
for i in range(0, number_of_trigger_bars*2)]