25 static double tolerance = 0e0;
29 int det_id = x_det.id();
30 string det_name = x_det.nameStr();
33 int nsides = x_dim.numsides();
34 double inner_r = x_dim.rmin();
35 double dphi = (2*
M_PI/nsides);
37 double mod_z = layering.totalThickness();
38 double outer_r = inner_r + mod_z;
39 double totThick = mod_z;
42 PolyhedraRegular hedra (nsides,inner_r,inner_r+totThick+tolerance*2e0,x_dim.z());
43 Volume envelope (det_name,hedra,air);
48 sdet.setPlacement(env_phv);
54 double trd_x2 = (2 * std::tan(hphi) * outer_r - dx)/2 - tolerance;
55 double trd_x1 = (2 * std::tan(hphi) * inner_r + dx)/2 - tolerance;
56 double trd_y1 = x_dim.z()/2 - tolerance;
57 double trd_y2 = trd_y1;
58 double trd_z = mod_z/2 - tolerance;
67 Volume mod_vol(
"stave",trd,air);
72 double stave_z = trd_y1;
73 double tan_hphi = std::tan(hphi);
74 double l_dim_x = trd_x1;
75 double l_pos_z = -(layering.totalThickness() / 2);
81 int repeat = x_layer.repeat();
83 for (
int j=0; j<repeat; j++) {
84 string l_name =
_toString(l_num,
"layer%d");
85 double l_thickness = layering.layer(l_num-1)->thickness();
87 Position l_pos(0,0,l_pos_z+l_thickness/2);
88 Box l_box(l_dim_x-tolerance,stave_z-tolerance,l_thickness / 2-tolerance);
89 Volume l_vol(l_name,l_box,air);
94 double s_pos_z = -(l_thickness / 2);
97 string s_name =
_toString(s_num,
"slice%d");
98 double s_thick = x_slice.thickness();
99 Box s_box(l_dim_x-tolerance,stave_z-tolerance,s_thick / 2-tolerance);
100 Volume s_vol(s_name,s_box,description.
material(x_slice.materialStr()));
103 if ( x_slice.isSensitive() ) {
104 s_vol.setSensitiveDetector(sens);
106 slice.setAttributes(description,s_vol,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr());
111 slice.setPlacement(slice_phv);
120 layer.setAttributes(description,l_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr());
122 PlacedVolume layer_phv = mod_vol.placeVolume(l_vol,l_pos);
124 layer.setPlacement(layer_phv);
126 double xcut = l_thickness * tan_hphi;
128 l_pos_z += l_thickness;
136 mod_vol.setVisAttributes(description.
visAttributes(x_staves.visStr()));
139 double phi =
M_PI / nsides;
140 double mod_x_off = dx / 2;
141 double mod_y_off = inner_r + mod_z/2;
144 for (
int i = 0; i < nsides; i++, phi -= dphi) {
146 double m_pos_x = mod_x_off * std::cos(phi) - mod_y_off * std::sin(phi);
147 double m_pos_y = mod_x_off * std::sin(phi) + mod_y_off * std::cos(phi);
159 envelope.
setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr());