18 #include "DD4hep/DetFactoryHelper.h"
19 #include "DD4hep/Printout.h"
27 string det_name = x_det.nameStr();
28 Material air = lcdd.air();
29 DetElement sdet (det_name,x_det.id());
30 Assembly assembly (det_name+
"_assembly");
36 std::cout <<
" TESTING ...\n";
38 for(xml_coll_t i(x_det,_U(layer)); i; ++i, ++n) {
39 xml_comp_t x_layer = i;
40 string l_name = det_name+_toString(n,
"_layer%d");
41 double z = x_layer.outer_z();
42 double rmin = x_layer.inner_r();
43 double z_offset = 0.0;
44 if(x_layer.hasAttr(_Unicode(z_offset))) {
45 z_offset = x_layer.z_offset();
48 DetElement layer(sdet,_toString(n,
"layer%d"),x_layer.id());
51 printout(INFO,
"GenericShapeJLEIC",
"Creating a Generic Layer");
52 for(xml_coll_t j(x_layer,_U(slice)); j; ++j, ++m) {
53 xml_comp_t x_slice = j;
54 Material mat = lcdd.material(x_slice.materialStr());
55 string s_name= l_name+_toString(m,
"_slice%d");
56 double thickness = x_slice.thickness();
57 Tube s_tub(r, r+thickness,z);
58 Volume s_vol(s_name, s_tub, mat);
61 s_vol.setVisAttributes(lcdd,x_det.visStr());
62 pv = assembly.placeVolume(s_vol,Position(0, 0, z_offset));
64 pv.addPhysVolID(
"slice",m);
65 printout(INFO,
"GenericShapeJLEIC",
"Creating Generic Slice");
71 pv = lcdd.pickMotherVolume(sdet).placeVolume(assembly);
72 pv.addPhysVolID(
"system",sdet.id()).addPhysVolID(
"barrel",0);
73 sdet.setPlacement(pv);