11 #include "DD4hep/DetFactoryHelper.h"
12 #include "DD4hep/Printout.h"
13 #include <XML/Helper.h>
15 #include "DDRec/Surface.h"
16 #include "DDRec/DetectorData.h"
17 #include "XML/Layering.h"
21 using namespace dd4hep::rec;
22 using namespace dd4hep::detail;
43 int det_id = x_det.id();
44 string det_name = x_det.nameStr();
47 Assembly assembly( det_name+
"_assembly" );
48 DetElement det(det_name, det_id);
49 Assembly module_assembly(
"module_assembly" );
50 PlacedVolume module_PV;
51 Assembly bar_assembly(
"bar_assembly");
54 xml_dim_t pos = x_det.position();
55 double x_pos = dd4hep::getAttrOrDefault(pos, _Unicode(x),0.0);
56 double y_pos = dd4hep::getAttrOrDefault(pos, _Unicode(y),0.0);
57 double z_pos = dd4hep::getAttrOrDefault(pos, _Unicode(z),0.0);
60 double small_tower_length = 20*mm;
61 double large_tower_length = 40*mm;
62 double offset_btw_towers = 5*mm;
63 double bar_width = 1*mm;
65 double tungsten_thickness = 7*mm;
66 double scintillator_thickness = 3*mm;
67 double dz_scint = scintillator_thickness/2.0 + tungsten_thickness/2.0;
70 auto gray_vis = description.visAttributes(
"GrayVis");
71 auto blue_vis = description.visAttributes(
"BlueVis");
72 auto red_vis = description.visAttributes(
"RedVis");
76 Box s_tungsten_layer_shape(small_tower_length/2.0, small_tower_length/2.0,tungsten_thickness/2.0);
77 Volume s_tungsten_layer_Vol(
"s_tungsten_layer_Vol", s_tungsten_layer_shape, description.material(
"TungstenDens24"));
78 s_tungsten_layer_Vol.setVisAttributes(gray_vis);
80 Box l_tungsten_layer_shape(large_tower_length/2.0, large_tower_length/2.0,tungsten_thickness/2.0);
81 Volume l_tungsten_layer_Vol(
"l_tungsten_layer_Vol", l_tungsten_layer_shape, description.material(
"TungstenDens24"));
82 l_tungsten_layer_Vol.setVisAttributes(gray_vis);
86 Box s_scint_layer_shape(small_tower_length/2.0, small_tower_length/2.0,scintillator_thickness/2.0);
87 Volume s_scint_layer_Vol(
"s_scint_layer_Vol", s_scint_layer_shape, description.material(
"PlasticScint"));
88 s_scint_layer_Vol.setVisAttributes(blue_vis);
90 Box l_scint_layer_shape(large_tower_length/2.0, large_tower_length/2.0,scintillator_thickness/2.0);
91 Volume l_scint_layer_Vol(
"l_scint_layer_Vol", l_scint_layer_shape, description.material(
"PlasticScint"));
92 l_scint_layer_Vol.setVisAttributes(blue_vis);
96 Box sx_bar(bar_width/2.0, small_tower_length/2.0, bar_width/2.0);
97 Volume sx_bar_vol(
"sx_bar_volume", sx_bar, description.material(
"PlasticScint"));
98 sx_bar_vol.setVisAttributes(red_vis);
100 Box sy_bar(small_tower_length/2.0, bar_width/2.0, bar_width/2.0);
101 Volume sy_bar_vol(
"sy_bar_volume", sy_bar, description.material(
"PlasticScint"));
102 sy_bar_vol.setVisAttributes(red_vis);
104 Box lx_bar(bar_width/2.0, large_tower_length/2.0, bar_width/2.0);
105 Volume lx_bar_vol(
"lx_bar_volume", lx_bar, description.material(
"PlasticScint"));
106 lx_bar_vol.setVisAttributes(red_vis);
108 Box ly_bar(large_tower_length/2.0, bar_width/2.0, bar_width/2.0);
109 Volume ly_bar_vol(
"ly_bar_volume", ly_bar, description.material(
"PlasticScint"));
110 ly_bar_vol.setVisAttributes(red_vis);
120 double z_layer = tungsten_thickness/2.0;
121 auto tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
122 tungsten_PV.addPhysVolID(
"layer", 0).addPhysVolID(
"slice", 1);
123 sens.setType(
"calorimeter");
124 s_tungsten_layer_Vol.setSensitiveDetector(sens);
127 auto scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
128 scint_PV.addPhysVolID(
"layer", 1).addPhysVolID(
"slice", 2);
129 sens.setType(
"calorimeter");
130 s_scint_layer_Vol.setSensitiveDetector(sens);
133 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
134 tungsten_PV.addPhysVolID(
"layer", 2).addPhysVolID(
"slice", 1);
135 sens.setType(
"calorimeter");
136 s_tungsten_layer_Vol.setSensitiveDetector(sens);
139 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
140 scint_PV.addPhysVolID(
"layer", 3).addPhysVolID(
"slice", 2);
141 sens.setType(
"calorimeter");
142 s_scint_layer_Vol.setSensitiveDetector(sens);
145 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
146 tungsten_PV.addPhysVolID(
"layer", 4).addPhysVolID(
"slice", 1);
147 sens.setType(
"calorimeter");
148 s_tungsten_layer_Vol.setSensitiveDetector(sens);
150 z_layer += tungsten_thickness/2.0 + bar_width/2.0;
151 double pos_x = -1.0 + bar_width/2.0;
152 for(
int ix=0; ix<20; ix++)
154 pv_bar = module_assembly.placeVolume(sx_bar_vol, Position(pos_x, 0.0, z_layer));
155 pv_bar.addPhysVolID(
"layer", 5+ix).addPhysVolID(
"slice",3);
156 sens.setType(
"calorimeter");
157 sx_bar_vol.setSensitiveDetector(sens);
161 z_layer += bar_width;
162 double pos_y = -1.0 + bar_width/2.0;
163 for(
int iy=0; iy<20; iy++)
165 pv_bar = module_assembly.placeVolume(sy_bar_vol, Position(0.0, pos_y, z_layer));
166 pv_bar.addPhysVolID(
"layer", 25+iy).addPhysVolID(
"slice",3);
167 sens.setType(
"calorimeter");
168 sy_bar_vol.setSensitiveDetector(sens);
172 z_layer += 2.0*bar_width;
173 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
174 scint_PV.addPhysVolID(
"layer", 45).addPhysVolID(
"slice", 2);
175 sens.setType(
"calorimeter");
176 s_scint_layer_Vol.setSensitiveDetector(sens);
179 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
180 tungsten_PV.addPhysVolID(
"layer", 46).addPhysVolID(
"slice", 1);
181 sens.setType(
"calorimeter");
182 s_tungsten_layer_Vol.setSensitiveDetector(sens);
185 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
186 scint_PV.addPhysVolID(
"layer", 47).addPhysVolID(
"slice", 2);
187 sens.setType(
"calorimeter");
188 s_scint_layer_Vol.setSensitiveDetector(sens);
191 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
192 tungsten_PV.addPhysVolID(
"layer", 48).addPhysVolID(
"slice", 1);
193 sens.setType(
"calorimeter");
194 s_tungsten_layer_Vol.setSensitiveDetector(sens);
196 z_layer += tungsten_thickness/2.0 + bar_width/2.0;
197 pos_x = -1.0 + bar_width/2.0;
198 for(
int ix=0; ix<20; ix++)
200 pv_bar = module_assembly.placeVolume(sx_bar_vol, Position(pos_x, 0.0, z_layer));
201 pv_bar.addPhysVolID(
"layer", 49+ix).addPhysVolID(
"slice",3);
202 sens.setType(
"calorimeter");
203 sx_bar_vol.setSensitiveDetector(sens);
207 z_layer += bar_width;
208 pos_y = -1.0 + bar_width/2.0;
209 for(
int iy=0; iy<20; iy++)
211 pv_bar = module_assembly.placeVolume(sy_bar_vol, Position(0.0, pos_y, z_layer));
212 pv_bar.addPhysVolID(
"layer", 69+iy).addPhysVolID(
"slice",3);
213 sens.setType(
"calorimeter");
214 sy_bar_vol.setSensitiveDetector(sens);
218 z_layer += 2.0*bar_width;
219 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
220 scint_PV.addPhysVolID(
"layer", 89).addPhysVolID(
"slice", 2);
221 sens.setType(
"calorimeter");
222 s_scint_layer_Vol.setSensitiveDetector(sens);
225 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
226 tungsten_PV.addPhysVolID(
"layer", 90).addPhysVolID(
"slice", 1);
227 sens.setType(
"calorimeter");
228 s_tungsten_layer_Vol.setSensitiveDetector(sens);
231 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
232 scint_PV.addPhysVolID(
"layer", 91).addPhysVolID(
"slice", 2);
233 sens.setType(
"calorimeter");
234 s_scint_layer_Vol.setSensitiveDetector(sens);
237 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
238 tungsten_PV.addPhysVolID(
"layer", 92).addPhysVolID(
"slice", 1);
239 sens.setType(
"calorimeter");
240 s_tungsten_layer_Vol.setSensitiveDetector(sens);
243 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
244 scint_PV.addPhysVolID(
"layer", 93).addPhysVolID(
"slice", 2);
245 sens.setType(
"calorimeter");
246 s_scint_layer_Vol.setSensitiveDetector(sens);
249 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
250 tungsten_PV.addPhysVolID(
"layer", 94).addPhysVolID(
"slice", 1);
251 sens.setType(
"calorimeter");
252 s_tungsten_layer_Vol.setSensitiveDetector(sens);
255 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
256 scint_PV.addPhysVolID(
"layer", 95).addPhysVolID(
"slice", 2);
257 sens.setType(
"calorimeter");
258 s_scint_layer_Vol.setSensitiveDetector(sens);
261 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
262 tungsten_PV.addPhysVolID(
"layer", 96).addPhysVolID(
"slice", 1);
263 sens.setType(
"calorimeter");
264 s_tungsten_layer_Vol.setSensitiveDetector(sens);
267 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
268 scint_PV.addPhysVolID(
"layer", 97).addPhysVolID(
"slice", 2);
269 sens.setType(
"calorimeter");
270 s_scint_layer_Vol.setSensitiveDetector(sens);
273 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
274 tungsten_PV.addPhysVolID(
"layer", 98).addPhysVolID(
"slice", 1);
275 sens.setType(
"calorimeter");
276 s_tungsten_layer_Vol.setSensitiveDetector(sens);
279 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
280 scint_PV.addPhysVolID(
"layer", 99).addPhysVolID(
"slice", 2);
281 sens.setType(
"calorimeter");
282 s_scint_layer_Vol.setSensitiveDetector(sens);
285 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
286 tungsten_PV.addPhysVolID(
"layer", 100).addPhysVolID(
"slice", 1);
287 sens.setType(
"calorimeter");
288 s_tungsten_layer_Vol.setSensitiveDetector(sens);
291 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
292 scint_PV.addPhysVolID(
"layer", 101).addPhysVolID(
"slice", 2);
293 sens.setType(
"calorimeter");
294 s_scint_layer_Vol.setSensitiveDetector(sens);
297 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
298 tungsten_PV.addPhysVolID(
"layer", 102).addPhysVolID(
"slice", 1);
299 sens.setType(
"calorimeter");
300 s_tungsten_layer_Vol.setSensitiveDetector(sens);
302 z_layer += tungsten_thickness;
303 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
304 tungsten_PV.addPhysVolID(
"layer", 103).addPhysVolID(
"slice", 1);
305 sens.setType(
"calorimeter");
306 s_tungsten_layer_Vol.setSensitiveDetector(sens);
309 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
310 scint_PV.addPhysVolID(
"layer", 104).addPhysVolID(
"slice", 2);
311 sens.setType(
"calorimeter");
312 s_scint_layer_Vol.setSensitiveDetector(sens);
315 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
316 tungsten_PV.addPhysVolID(
"layer", 105).addPhysVolID(
"slice", 1);
317 sens.setType(
"calorimeter");
318 s_tungsten_layer_Vol.setSensitiveDetector(sens);
320 z_layer += tungsten_thickness;
321 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
322 tungsten_PV.addPhysVolID(
"layer", 106).addPhysVolID(
"slice", 1);
323 sens.setType(
"calorimeter");
324 s_tungsten_layer_Vol.setSensitiveDetector(sens);
326 z_layer += tungsten_thickness/2.0 + bar_width/2.0;
327 pos_x = -1.0 + bar_width/2.0;
328 for(
int ix=0; ix<20; ix++)
330 pv_bar = module_assembly.placeVolume(sx_bar_vol, Position(pos_x, 0.0, z_layer));
331 pv_bar.addPhysVolID(
"layer", 107+ix).addPhysVolID(
"slice",3);
332 sens.setType(
"calorimeter");
333 sx_bar_vol.setSensitiveDetector(sens);
337 z_layer += bar_width;
338 pos_y = -1.0 + bar_width/2.0;
339 for(
int iy=0; iy<20; iy++)
341 pv_bar = module_assembly.placeVolume(sy_bar_vol, Position(0.0, pos_y, z_layer));
342 pv_bar.addPhysVolID(
"layer", 127+iy).addPhysVolID(
"slice",3);
343 sens.setType(
"calorimeter");
344 sy_bar_vol.setSensitiveDetector(sens);
348 z_layer += 2.0*bar_width;
349 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
350 scint_PV.addPhysVolID(
"layer", 147).addPhysVolID(
"slice", 2);
351 sens.setType(
"calorimeter");
352 s_scint_layer_Vol.setSensitiveDetector(sens);
355 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
356 tungsten_PV.addPhysVolID(
"layer", 148).addPhysVolID(
"slice", 1);
357 sens.setType(
"calorimeter");
358 s_tungsten_layer_Vol.setSensitiveDetector(sens);
360 z_layer += tungsten_thickness;
361 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
362 tungsten_PV.addPhysVolID(
"layer", 149).addPhysVolID(
"slice", 1);
363 sens.setType(
"calorimeter");
364 s_tungsten_layer_Vol.setSensitiveDetector(sens);
367 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
368 scint_PV.addPhysVolID(
"layer", 150).addPhysVolID(
"slice", 2);
369 sens.setType(
"calorimeter");
370 s_scint_layer_Vol.setSensitiveDetector(sens);
373 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
374 tungsten_PV.addPhysVolID(
"layer", 151).addPhysVolID(
"slice", 1);
375 sens.setType(
"calorimeter");
376 s_tungsten_layer_Vol.setSensitiveDetector(sens);
378 z_layer += tungsten_thickness;
379 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
380 tungsten_PV.addPhysVolID(
"layer", 152).addPhysVolID(
"slice", 1);
381 sens.setType(
"calorimeter");
382 s_tungsten_layer_Vol.setSensitiveDetector(sens);
385 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
386 scint_PV.addPhysVolID(
"layer", 153).addPhysVolID(
"slice", 2);
387 sens.setType(
"calorimeter");
388 s_scint_layer_Vol.setSensitiveDetector(sens);
391 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
392 tungsten_PV.addPhysVolID(
"layer", 154).addPhysVolID(
"slice", 1);
393 sens.setType(
"calorimeter");
394 s_tungsten_layer_Vol.setSensitiveDetector(sens);
396 z_layer += tungsten_thickness;
397 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
398 tungsten_PV.addPhysVolID(
"layer", 155).addPhysVolID(
"slice", 1);
399 sens.setType(
"calorimeter");
400 s_tungsten_layer_Vol.setSensitiveDetector(sens);
402 z_layer += tungsten_thickness/2.0 + bar_width/2.0;
403 pos_x = -1.0 + bar_width/2.0;
404 for(
int ix=0; ix<20; ix++)
406 pv_bar = module_assembly.placeVolume(sx_bar_vol, Position(pos_x, 0.0, z_layer));
407 pv_bar.addPhysVolID(
"layer", 156+ix).addPhysVolID(
"slice",3);
408 sens.setType(
"calorimeter");
409 sx_bar_vol.setSensitiveDetector(sens);
413 z_layer += bar_width;
414 pos_y = -1.0 + bar_width/2.0;
415 for(
int iy=0; iy<20; iy++)
417 pv_bar = module_assembly.placeVolume(sy_bar_vol, Position(0.0, pos_y, z_layer));
418 pv_bar.addPhysVolID(
"layer", 176+iy).addPhysVolID(
"slice",3);
419 sens.setType(
"calorimeter");
420 sy_bar_vol.setSensitiveDetector(sens);
424 z_layer += 2.0*bar_width;
425 scint_PV = module_assembly.placeVolume(s_scint_layer_Vol, Position(0.0, 0.0, z_layer));
426 scint_PV.addPhysVolID(
"layer", 196).addPhysVolID(
"slice", 2);
427 sens.setType(
"calorimeter");
428 s_scint_layer_Vol.setSensitiveDetector(sens);
431 tungsten_PV = module_assembly.placeVolume(s_tungsten_layer_Vol, Position(0.0, 0.0, z_layer));
432 tungsten_PV.addPhysVolID(
"layer", 197).addPhysVolID(
"slice", 1);
433 sens.setType(
"calorimeter");
434 s_tungsten_layer_Vol.setSensitiveDetector(sens);
440 double x_layer = offset_btw_towers/sqrt(2) + (small_tower_length + large_tower_length)/2.0;
441 double y_layer = offset_btw_towers/sqrt(2) + (small_tower_length + large_tower_length)/2.0;
443 z_layer = tungsten_thickness/2.0;
444 auto l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer, y_layer, z_layer));
445 l_tungsten_PV.addPhysVolID(
"layer", 198).addPhysVolID(
"slice", 1);
446 sens.setType(
"calorimeter");
447 l_tungsten_layer_Vol.setSensitiveDetector(sens);
450 auto l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer, y_layer, z_layer));
451 l_scint_PV.addPhysVolID(
"layer", 199).addPhysVolID(
"slice", 2);
452 sens.setType(
"calorimeter");
453 l_scint_layer_Vol.setSensitiveDetector(sens);
456 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer, y_layer, z_layer));
457 l_tungsten_PV.addPhysVolID(
"layer", 200).addPhysVolID(
"slice", 1);
458 sens.setType(
"calorimeter");
459 l_tungsten_layer_Vol.setSensitiveDetector(sens);
462 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer, y_layer, z_layer));
463 l_scint_PV.addPhysVolID(
"layer", 201).addPhysVolID(
"slice", 2);
464 sens.setType(
"calorimeter");
465 l_scint_layer_Vol.setSensitiveDetector(sens);
468 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer, y_layer, z_layer));
469 l_tungsten_PV.addPhysVolID(
"layer", 202).addPhysVolID(
"slice", 1);
470 sens.setType(
"calorimeter");
471 l_tungsten_layer_Vol.setSensitiveDetector(sens);
473 z_layer += tungsten_thickness/2.0 + bar_width/2.0;
474 pos_x = 1.0 + offset_btw_towers/sqrt(2) + bar_width/2.0;
475 for(
int ix=0; ix<40; ix++)
477 pv_bar = module_assembly.placeVolume(lx_bar_vol, Position(pos_x, y_layer, z_layer));
478 pv_bar.addPhysVolID(
"layer", 203+ix).addPhysVolID(
"slice",3);
479 sens.setType(
"calorimeter");
480 lx_bar_vol.setSensitiveDetector(sens);
484 z_layer += bar_width;
485 pos_y = 1.0 + offset_btw_towers/sqrt(2) + bar_width/2.0;
486 for(
int iy=0; iy<40; iy++)
488 pv_bar = module_assembly.placeVolume(ly_bar_vol, Position(x_layer, pos_y, z_layer));
489 pv_bar.addPhysVolID(
"layer", 243+iy).addPhysVolID(
"slice",3);
490 sens.setType(
"calorimeter");
491 ly_bar_vol.setSensitiveDetector(sens);
495 z_layer += 2.0*bar_width;
496 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer, y_layer, z_layer));
497 l_scint_PV.addPhysVolID(
"layer", 283).addPhysVolID(
"slice", 2);
498 sens.setType(
"calorimeter");
499 l_scint_layer_Vol.setSensitiveDetector(sens);
502 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
503 l_tungsten_PV.addPhysVolID(
"layer", 284).addPhysVolID(
"slice", 1);
504 sens.setType(
"calorimeter");
505 s_tungsten_layer_Vol.setSensitiveDetector(sens);
508 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
509 l_scint_PV.addPhysVolID(
"layer", 285).addPhysVolID(
"slice", 2);
510 sens.setType(
"calorimeter");
511 l_scint_layer_Vol.setSensitiveDetector(sens);
514 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
515 l_tungsten_PV.addPhysVolID(
"layer", 286).addPhysVolID(
"slice", 1);
516 sens.setType(
"calorimeter");
517 l_tungsten_layer_Vol.setSensitiveDetector(sens);
519 z_layer += tungsten_thickness/2.0 + bar_width/2.0;
520 pos_x = 1.0 + offset_btw_towers/sqrt(2) + bar_width/2.0;
521 for(
int ix=0; ix<40; ix++)
523 pv_bar = module_assembly.placeVolume(lx_bar_vol, Position(pos_x, y_layer, z_layer));
524 pv_bar.addPhysVolID(
"layer", 287+ix).addPhysVolID(
"slice",3);
525 sens.setType(
"calorimeter");
526 lx_bar_vol.setSensitiveDetector(sens);
530 z_layer += bar_width;
531 pos_y = 1.0 + offset_btw_towers/sqrt(2) + bar_width/2.0;
532 for(
int iy=0; iy<40; iy++)
534 pv_bar = module_assembly.placeVolume(ly_bar_vol, Position(x_layer, pos_y, z_layer));
535 pv_bar.addPhysVolID(
"layer", 327+iy).addPhysVolID(
"slice",3);
536 sens.setType(
"calorimeter");
537 ly_bar_vol.setSensitiveDetector(sens);
541 z_layer += 2.0*bar_width;
542 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
543 l_scint_PV.addPhysVolID(
"layer", 367).addPhysVolID(
"slice", 2);
544 sens.setType(
"calorimeter");
545 l_scint_layer_Vol.setSensitiveDetector(sens);
548 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
549 l_tungsten_PV.addPhysVolID(
"layer", 368).addPhysVolID(
"slice", 1);
550 sens.setType(
"calorimeter");
551 l_tungsten_layer_Vol.setSensitiveDetector(sens);
554 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
555 l_scint_PV.addPhysVolID(
"layer", 369).addPhysVolID(
"slice", 2);
556 sens.setType(
"calorimeter");
557 l_scint_layer_Vol.setSensitiveDetector(sens);
560 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
561 l_tungsten_PV.addPhysVolID(
"layer", 370).addPhysVolID(
"slice", 1);
562 sens.setType(
"calorimeter");
563 l_tungsten_layer_Vol.setSensitiveDetector(sens);
566 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
567 l_scint_PV.addPhysVolID(
"layer", 371).addPhysVolID(
"slice", 2);
568 sens.setType(
"calorimeter");
569 l_scint_layer_Vol.setSensitiveDetector(sens);
572 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
573 l_tungsten_PV.addPhysVolID(
"layer", 372).addPhysVolID(
"slice", 1);
574 sens.setType(
"calorimeter");
575 l_tungsten_layer_Vol.setSensitiveDetector(sens);
578 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
579 l_scint_PV.addPhysVolID(
"layer", 373).addPhysVolID(
"slice", 2);
580 sens.setType(
"calorimeter");
581 l_scint_layer_Vol.setSensitiveDetector(sens);
584 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
585 l_tungsten_PV.addPhysVolID(
"layer", 374).addPhysVolID(
"slice", 1);
586 sens.setType(
"calorimeter");
587 l_tungsten_layer_Vol.setSensitiveDetector(sens);
590 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
591 l_scint_PV.addPhysVolID(
"layer", 375).addPhysVolID(
"slice", 2);
592 sens.setType(
"calorimeter");
593 l_scint_layer_Vol.setSensitiveDetector(sens);
596 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
597 l_tungsten_PV.addPhysVolID(
"layer", 376).addPhysVolID(
"slice", 1);
598 sens.setType(
"calorimeter");
599 l_tungsten_layer_Vol.setSensitiveDetector(sens);
602 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
603 l_scint_PV.addPhysVolID(
"layer", 377).addPhysVolID(
"slice", 2);
604 sens.setType(
"calorimeter");
605 l_scint_layer_Vol.setSensitiveDetector(sens);
608 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
609 l_tungsten_PV.addPhysVolID(
"layer", 378).addPhysVolID(
"slice", 1);
610 sens.setType(
"calorimeter");
611 l_tungsten_layer_Vol.setSensitiveDetector(sens);
614 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
615 l_scint_PV.addPhysVolID(
"layer", 379).addPhysVolID(
"slice", 2);
616 sens.setType(
"calorimeter");
617 l_scint_layer_Vol.setSensitiveDetector(sens);
620 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
621 l_tungsten_PV.addPhysVolID(
"layer", 380).addPhysVolID(
"slice", 1);
622 sens.setType(
"calorimeter");
623 l_tungsten_layer_Vol.setSensitiveDetector(sens);
625 z_layer += tungsten_thickness;
626 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
627 l_tungsten_PV.addPhysVolID(
"layer", 381).addPhysVolID(
"slice", 1);
628 sens.setType(
"calorimeter");
629 l_tungsten_layer_Vol.setSensitiveDetector(sens);
632 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
633 l_scint_PV.addPhysVolID(
"layer", 382).addPhysVolID(
"slice", 2);
634 sens.setType(
"calorimeter");
635 l_scint_layer_Vol.setSensitiveDetector(sens);
638 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
639 l_tungsten_PV.addPhysVolID(
"layer", 383).addPhysVolID(
"slice", 1);
640 sens.setType(
"calorimeter");
641 l_tungsten_layer_Vol.setSensitiveDetector(sens);
643 z_layer += tungsten_thickness;
644 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
645 l_tungsten_PV.addPhysVolID(
"layer", 384).addPhysVolID(
"slice", 1);
646 sens.setType(
"calorimeter");
647 l_tungsten_layer_Vol.setSensitiveDetector(sens);
649 z_layer += tungsten_thickness/2.0 + bar_width/2.0;
650 pos_x = 1.0 + offset_btw_towers/sqrt(2) + bar_width/2.0;
651 for(
int ix=0; ix<40; ix++)
653 pv_bar = module_assembly.placeVolume(lx_bar_vol, Position(pos_x, y_layer, z_layer));
654 pv_bar.addPhysVolID(
"layer", 385+ix).addPhysVolID(
"slice",3);
655 sens.setType(
"calorimeter");
656 lx_bar_vol.setSensitiveDetector(sens);
660 z_layer += bar_width;
661 pos_y = 1.0 + offset_btw_towers/sqrt(2) + bar_width/2.0;
662 for(
int iy=0; iy<40; iy++)
664 pv_bar = module_assembly.placeVolume(ly_bar_vol, Position(x_layer, pos_y, z_layer));
665 pv_bar.addPhysVolID(
"layer", 425+iy).addPhysVolID(
"slice",3);
666 sens.setType(
"calorimeter");
667 ly_bar_vol.setSensitiveDetector(sens);
671 z_layer += 2.0*bar_width;
672 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
673 l_scint_PV.addPhysVolID(
"layer", 465).addPhysVolID(
"slice", 2);
674 sens.setType(
"calorimeter");
675 l_scint_layer_Vol.setSensitiveDetector(sens);
678 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
679 l_tungsten_PV.addPhysVolID(
"layer", 466).addPhysVolID(
"slice", 1);
680 sens.setType(
"calorimeter");
681 l_tungsten_layer_Vol.setSensitiveDetector(sens);
683 z_layer += tungsten_thickness;
684 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
685 l_tungsten_PV.addPhysVolID(
"layer", 467).addPhysVolID(
"slice", 1);
686 sens.setType(
"calorimeter");
687 l_tungsten_layer_Vol.setSensitiveDetector(sens);
690 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
691 l_scint_PV.addPhysVolID(
"layer", 468).addPhysVolID(
"slice", 2);
692 sens.setType(
"calorimeter");
693 l_scint_layer_Vol.setSensitiveDetector(sens);
696 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
697 l_tungsten_PV.addPhysVolID(
"layer", 469).addPhysVolID(
"slice", 1);
698 sens.setType(
"calorimeter");
699 l_tungsten_layer_Vol.setSensitiveDetector(sens);
701 z_layer += tungsten_thickness;
702 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
703 l_tungsten_PV.addPhysVolID(
"layer", 470).addPhysVolID(
"slice", 1);
704 sens.setType(
"calorimeter");
705 l_tungsten_layer_Vol.setSensitiveDetector(sens);
708 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
709 l_scint_PV.addPhysVolID(
"layer", 471).addPhysVolID(
"slice", 2);
710 sens.setType(
"calorimeter");
711 l_scint_layer_Vol.setSensitiveDetector(sens);
714 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
715 l_tungsten_PV.addPhysVolID(
"layer", 472).addPhysVolID(
"slice", 1);
716 sens.setType(
"calorimeter");
717 l_tungsten_layer_Vol.setSensitiveDetector(sens);
719 z_layer += tungsten_thickness;
720 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer,y_layer, z_layer));
721 l_tungsten_PV.addPhysVolID(
"layer", 473).addPhysVolID(
"slice", 1);
722 sens.setType(
"calorimeter");
723 l_tungsten_layer_Vol.setSensitiveDetector(sens);
725 z_layer += tungsten_thickness/2.0 + bar_width/2.0;
726 pos_x = 1.0 + offset_btw_towers/sqrt(2) + bar_width/2.0;
727 for(
int ix=0; ix<40; ix++)
729 pv_bar = module_assembly.placeVolume(lx_bar_vol, Position(pos_x, y_layer, z_layer));
730 pv_bar.addPhysVolID(
"layer", 474+ix).addPhysVolID(
"slice",3);
731 sens.setType(
"calorimeter");
732 lx_bar_vol.setSensitiveDetector(sens);
736 z_layer += bar_width;
737 pos_y = 1.0 + offset_btw_towers/sqrt(2) + bar_width/2.0;
738 for(
int iy=0; iy<40; iy++)
740 pv_bar = module_assembly.placeVolume(ly_bar_vol, Position(x_layer, pos_y, z_layer));
741 pv_bar.addPhysVolID(
"layer", 514+iy).addPhysVolID(
"slice",3);
742 sens.setType(
"calorimeter");
743 ly_bar_vol.setSensitiveDetector(sens);
747 z_layer += 2.0*bar_width;
748 l_scint_PV = module_assembly.placeVolume(l_scint_layer_Vol, Position(x_layer,y_layer, z_layer));
749 l_scint_PV.addPhysVolID(
"layer", 554).addPhysVolID(
"slice", 2);
750 sens.setType(
"calorimeter");
751 l_scint_layer_Vol.setSensitiveDetector(sens);
754 l_tungsten_PV = module_assembly.placeVolume(l_tungsten_layer_Vol, Position(x_layer, y_layer, z_layer));
755 l_tungsten_PV.addPhysVolID(
"layer", 555).addPhysVolID(
"slice", 1);
756 sens.setType(
"calorimeter");
757 l_tungsten_layer_Vol.setSensitiveDetector(sens);
760 module_PV = assembly.placeVolume(module_assembly, Position(x_pos,y_pos,z_pos));
761 module_PV.addPhysVolID(
"module", 0);
763 Volume motherVol = description.pickMotherVolume(det);
764 PlacedVolume envPV = motherVol.placeVolume(assembly, Transform3D(RotationZ(M_PI/4.0), Position(0, 0, 0)));
766 envPV.addPhysVolID(
"system", det_id);
767 det.setPlacement(envPV);