29 string det_name = x_det.nameStr();
30 bool reflect = x_det.reflect();
31 double zmin = dim.inner_z();
32 double rmin = dim.inner_r();
33 double rmax = dim.outer_r();
36 Tube envelope (rmin,rmax,totWidth/2);
37 Volume envelopeVol(det_name+
"_envelope",envelope,air);
44 double layerWidth = 0;
47 for(
int i=0, im=0, repeat=x_layer.repeat(); i<repeat; ++i) {
49 string layer_name = det_name +
_toString(layer_num,
"_layer%d");
50 Volume layer_vol(layer_name,
Tube(rmin,rmax,layerWidth * 0.5),air);
54 double w = x_slice.thickness();
55 string slice_name = layer_name +
_toString(im+1,
"slice%d");
57 Volume slice_vol (slice_name,
Tube(rmin,rmax,w * 0.5),slice_mat);
59 if ( x_slice.isSensitive() ) {
61 slice_vol.setSensitiveDetector(sens);
63 slice_vol.setAttributes(description,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr());
64 pv = layer_vol.placeVolume(slice_vol,
Position(0,0,z-zlayer-layerWidth/2+w/2));
68 layer_vol.setVisAttributes(description,x_layer.visStr());
70 Position layer_pos(0,0,zlayer-zmin-totWidth/2+layerWidth/2);
71 pv = envelopeVol.placeVolume(layer_vol,layer_pos);
73 printout(DEBUG,
"Calo",
"CylindricalEndcapCalorimeter: built layer %d -> %s",layer_num,layer_name.c_str());
77 envelope.setDimensions(rmin,rmax,totWidth/2);
79 envelopeVol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr());
82 Assembly assembly(det_name+
"_assembly");
86 sdet.setPlacement(phv);
88 DetElement sdetA(sdet,det_name+(reflect ?
"_A" :
""),x_det.id());
89 phv = assembly.placeVolume(envelopeVol,
Position(0,0,zmin+totWidth/2));
91 sdetA.setPlacement(phv);
97 DetElement sdetB(sdet,det_name+
"_B",x_det.id());
98 sdetB.setPlacement(phv);