83 Volume parentVolume = ns.volume(
args.parentName());
84 Volume swedLog = ns.volume(
"esalgo:SWED");
85 Volume sfLog = ns.volume(
"esalgo:SF");
86 Volume sfbxLog = ns.volume(
"esalgo:SFBX");
87 Volume sfbyLog = ns.volume(
"esalgo:SFBY");
90 es.asymLadd =
args.vecDble(
"ASYMETRIC_LADDER");
91 es.typesL5 =
args.vecStr(
"TYPES_OF_LADD_L5");
92 es.typesL4 =
args.vecStr(
"TYPES_OF_LADD_L4");
93 es.laddL5map =
args.vecDble(
"LADD_L5_MAP");
94 es.laddL4map =
args.vecDble(
"LADD_L4_MAP");
95 es.noLaddInCol =
args.vecDble(
"NUMB_OF_LADD_IN_COL");
96 es.startOfFirstLadd =
args.vecDble(
"START_OF_1ST_LADD");
97 es.typeOfLaddRow0 =
args.vecStr(
"TYPE_OF_LADD_1");
98 es.typeOfLaddRow1 =
args.vecStr(
"TYPE_OF_LADD_2");
99 es.typeOfLaddRow2 =
args.vecStr(
"TYPE_OF_LADD_3");
100 es.typeOfLaddRow3 =
args.vecStr(
"TYPE_OF_LADD_4");
101 es.thickLayers =
args.vecDble(
"Layers");
102 es.thickness =
args.dble(
"PRESH_Z_TOTAL");
103 es.materials =
args.vecStr(
"LayMat");
104 es.layName =
args.vecStr(
"LayName");
105 es.rmaxVec =
args.vecDble(
"R_MAX");
106 es.rminVec =
args.vecDble(
"R_MIN");
107 es.waf_intra_col_sep =
args.dble(
"waf_intra_col_sep");
108 es.waf_inter_col_sep =
args.dble(
"waf_inter_col_sep");
109 es.waf_active =
args.dble(
"waf_active");
110 es.wedge_length =
args.dble(
"wedge_length");
111 es.wedge_offset =
args.dble(
"wedge_offset");
112 es.zwedge_ceramic_diff =
args.dble(
"zwedge_ceramic_diff");
113 es.ywedge_ceramic_diff =
args.dble(
"ywedge_ceramic_diff");
114 es.ceramic_length =
args.dble(
"ceramic_length");
115 es.wedge_angle =
args.dble(
"wedge_angle");
116 es.wedge_back_thick =
args.dble(
"wedge_back_thick");
117 es.ladder_thick =
args.dble(
"ladder_thick");
118 es.ladder_width =
args.dble(
"ladder_width");
119 es.micromodule_length =
args.dble(
"micromodule_length");
120 es.box_thick =
args.dble(
"box_thick");
121 es.abs1stx =
args.vecDble(
"1ST_ABSX");
122 es.abs1sty =
args.vecDble(
"1ST_ABSY");
123 es.abs2ndx =
args.vecDble(
"2ND_ABSX");
124 es.abs2ndy =
args.vecDble(
"2ND_ABSY");
125 es.ladPfx =
args.vecStr(
"LadPrefix");
126 es.laddMaterial =
args.str(
"LadderMaterial");
127 es.ldrFrnt_Length =
args.dble(
"LdrFrnt_Length");
128 es.ldrFrnt_Offset =
args.dble(
"LdrFrnt_Offset");
129 es.ldrBck_Length =
args.dble(
"LdrBck_Length");
130 es.ldrBck_Offset =
args.dble(
"LdrBck_Offset");
131 es.dee_separation =
args.dble(
"dee_sep");
132 es.in_rad_Abs_Al =
args.dble(
"R_MIN_Abs_Al");
133 es.in_rad_Abs_Pb =
args.dble(
"R_MIN_Abs_Pb");
134 es.rMax_Abs_Al =
args.dble(
"R_MAX_Abs_Al");
135 es.absAlX_X =
args.dble(
"AbsAlX_X");
136 es.absAlX_Y =
args.dble(
"AbsAlX_Y");
137 es.absAlX_subtr1_Xshift =
args.dble(
"AbsAlX_subtr1_Xshift");
138 es.absAlX_subtr1_Yshift =
args.dble(
"AbsAlX_subtr1_Yshift");
139 es.absAlY_X =
args.dble(
"AbsAlY_X");
140 es.absAlY_Y =
args.dble(
"AbsAlY_Y");
141 es.absAlY_subtr1_Xshift =
args.dble(
"AbsAlY_subtr1_Xshift");
142 es.absAlY_subtr1_Yshift =
args.dble(
"AbsAlY_subtr1_Yshift");
146 double zpos = -es.thickness / 2., sdx(0), sdy(0), bdx(0), bdy(0);
148 for (
size_t i = 0;
i < es.thickLayers.size(); ++
i) {
151 double rIn(0), rOut(0), zHalf(0);
154 const string& ddname(
"esalgo:" + es.layName[
i]);
158 rOut = es.rmaxVec[
i];
159 zHalf = es.thickLayers[
i] / 2.;
162 Solid solid = ns.addSolid(ddname, Tube(ddname, rIn, rOut, zHalf, 0., 360._deg));
163 Volume layer = ns.addVolume(
Volume(ddname, solid, ns.material(es.materials[
i])));
170 if (
I == 2 ||
I == 28 ||
I == 13 ||
I == 23) {
176 es.zlead1 = zpos + zHalf;
179 es.zlead2 = zpos + zHalf;
182 if (
I == 10 ||
I == 20) {
185 double outalbx, outalby, shiftR, outalbx2, outalby2, shiftR2;
187 absz =
int(es.abs1stx.size());
189 absz =
int(es.abs2ndx.size());
193 const string& dd_tmp_name_b(
"esalgo:" + es.layName[
i] +
"Lcut");
194 const string& dd_tmp_name_c(
"esalgo:" + es.layName[
i] +
"tmpb");
195 const string& dd_tmp_name_d(
"esalgo:" + es.layName[
i] +
"LinPb");
196 const string& dd_tmp_name_e(
"esalgo:" + es.layName[
i] +
"LinAl");
197 const string& dd_tmp_name_f(
"esalgo:" + es.layName[
i] +
"LOutAl");
199 const string& dd_Alname_f(
"esalgo:" + es.layName[
i] +
"LOutAl");
200 const string& dd_Alname_g(
"esalgo:" + es.layName[
i] +
"LOutAl2");
201 const string& dd_Alname_h(
"esalgo:" + es.layName[
i] +
"LOutAltmp");
202 const string& dd_Alname_i(
"esalgo:" + es.layName[
i] +
"LOutAltmp2");
203 const string& dd_Alname_j(
"esalgo:" + es.layName[
i] +
"LOutAltmp3");
204 const string& dd_Alname_k(
"esalgo:" + es.layName[
i] +
"LOutAltmp4");
205 const string& dd_Alname_l(
"esalgo:" + es.layName[
i] +
"LOutAltmp5");
206 const string& dd_Alname_m(
"esalgo:" + es.layName[
i] +
"LOutAltmp6");
209 ns.addSolid(dd_Alname_f, Tube(dd_Alname_f, es.rMax_Abs_Al - 70_cm, es.rMax_Abs_Al, zHalf, 0., 90._deg));
211 outalbx = es.absAlX_X * 0.1;
212 outalby = es.rMax_Abs_Al + 0.1_mm - es.absAlX_subtr1_Yshift;
213 shiftR = es.absAlX_subtr1_Yshift;
215 outalbx = es.absAlY_X * 0.1;
216 outalby = es.rMax_Abs_Al + 0.1_mm - es.absAlY_subtr1_Yshift;
217 shiftR = es.absAlY_subtr1_Xshift;
220 ns.addSolid(dd_Alname_h, Box(dd_Alname_h, outalbx / 2. + 0.1_mm, outalby / 2. + 0.1_mm, zHalf + 0.1_mm));
221 Solid outAltmp3 = ns.addSolid(
223 SubtractionSolid(dd_Alname_j, outAl, outAltmp,
Position(outalbx / 2., outalby / 2. + shiftR, 0)));
225 outalby2 = es.absAlX_Y * 0.1;
226 outalbx2 = es.rMax_Abs_Al + 0.1_mm - es.absAlX_subtr1_Xshift;
227 shiftR2 = es.absAlX_subtr1_Xshift;
229 outalby2 = es.absAlY_Y * 0.1;
230 outalbx2 = es.rMax_Abs_Al + 0.1_mm - es.absAlY_subtr1_Xshift;
231 shiftR2 = es.absAlY_subtr1_Xshift;
234 ns.addSolid(dd_Alname_i, Box(dd_Alname_i, outalbx2 / 2. + 0.1_mm, outalby2 / 2. + 0.1_mm, zHalf + 0.1_mm));
235 Solid outAltmp4 = ns.addSolid(
237 SubtractionSolid(dd_Alname_k, outAltmp3, outAltmp2,
Position(outalbx2 / 2. + shiftR2, outalby2 / 2., 0)));
239 ns.addSolid(dd_Alname_l, UnionSolid(dd_Alname_l, outAltmp4, outAltmp4, ns.rotation(
"esalgo:RABS90")));
241 ns.addSolid(dd_Alname_m, UnionSolid(dd_Alname_m, outAltmp5, outAltmp4, ns.rotation(
"esalgo:RABS180B")));
243 ns.addSolid(dd_Alname_g, UnionSolid(dd_Alname_g, outAltmp6, outAltmp4, ns.rotation(
"esalgo:R180")));
245 Solid outAlCut = Box(65_cm, 60_cm - 0.1_mm, zHalf + 0.2_mm);
246 Solid outAlFin = SubtractionSolid(outAl2, outAlCut);
248 Volume layerFinOutAl =
Volume(dd_tmp_name_f, outAlFin, ns.material(es.materials[
i - 1]));
250 for (
int L = 0;
L < absz; ++
L) {
252 ostringstream tmp_name_b, tmp_name_b2, tmp_FAl_name_c, tmp_FAl_name_d1, tmp_FAl_name_d2, tmp_FAl_name_d3,
254 tmp_name_b << es.layName[
i] <<
"L" << K;
255 tmp_name_b2 << es.layName[
i] <<
"Lb2" << K;
258 tmp_FAl_name_c << es.layName[
i] <<
"LOutAl2";
260 tmp_FAl_name_c << es.layName[
i] <<
"LtmpAl" << K - 1;
262 tmp_FAl_name_d1 << es.layName[
i] <<
"LtmpAl" << K <<
"_1";
263 tmp_FAl_name_d2 << es.layName[
i] <<
"LtmpAl" << K <<
"_2";
264 tmp_FAl_name_d3 << es.layName[
i] <<
"LtmpAl" << K <<
"_3";
265 tmp_FAl_name_d << es.layName[
i] <<
"LtmpAl" << K;
267 const string& dd_tmp_name_b(
"esalgo:" + tmp_name_b.str());
268 const string& dd_tmp_name_b2(
"esalgo:" + tmp_name_b2.str());
269 const string& dd_FAl_name_c(
"esalgo:" + tmp_FAl_name_c.str());
270 const string& dd_FAl_name_d1(
"esalgo:" + tmp_FAl_name_d1.str());
271 const string& dd_FAl_name_d2(
"esalgo:" + tmp_FAl_name_d2.str());
272 const string& dd_FAl_name_d3(
"esalgo:" + tmp_FAl_name_d3.str());
273 const string& dd_FAl_name_d(
"esalgo:" + tmp_FAl_name_d.str());
276 bdx =
abs(es.abs1stx[K]) / 2.;
278 bdx =
abs(es.abs1stx[K] - es.abs1stx[K - 1]) / 2.;
280 if (es.abs1stx[K] < rIn + 30_cm) {
281 bdy = es.abs1sty[K] / 2. - 30_cm;
287 bdx =
abs(es.abs2ndx[K]) / 2.;
289 bdx =
abs(es.abs2ndx[K] - es.abs2ndx[K - 1]) / 2.;
293 if ((es.abs2ndx[K] < rIn + 30_cm) &&
I == 20) {
294 bdy = es.abs2ndy[K] / 2. - 30_cm;
298 Solid solid_b = Box(dd_tmp_name_b, bdx, bdy, zHalf);
299 Solid solid_b2 = Box(dd_tmp_name_b2, bdx + 0.1_mm, bdy + 0.1_mm, zHalf);
301 sdx = es.abs1stx[K] - bdx;
303 if (es.abs1stx[K] < rIn + 30_cm)
304 sdy = es.abs1sty[K] - bdy;
307 sdx = es.abs2ndx[K] - bdx;
310 if ((es.abs2ndx[K] < rIn + 30_cm) &&
I == 20)
311 sdy = es.abs2ndy[K] - bdy;
313 Volume layer =
Volume(dd_tmp_name_b, solid_b, ns.material(es.materials[
i]));
315 layerFinOutAl.placeVolume(layer, 1,
Position(sdx, sdy, 0));
316 layerFinOutAl.placeVolume(layer, 2,
Position(-sdx, sdy, 0));
318 Solid solid_c = ns.solid(dd_FAl_name_c);
319 Solid solid_d1 = UnionSolid(dd_FAl_name_d1, solid_c, solid_b2,
Position(sdx, sdy, 0));
321 ns.addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d1, solid_b2,
Position(-sdx, -sdy, 0)));
323 if (((es.abs1stx[K] < rIn + 30_cm) &&
I == 10) || ((es.abs2ndx[K] < rIn + 30_cm) &&
I == 20)) {
324 layerFinOutAl.placeVolume(layer, 3,
Position(sdx, -sdy, 0));
325 layerFinOutAl.placeVolume(layer, 4,
Position(-sdx, -sdy, 0));
327 Solid solid_c = ns.solid(dd_FAl_name_c);
328 Solid solid_d1 = UnionSolid(dd_FAl_name_d1, solid_c, solid_b2,
Position(sdx, sdy, 0));
329 ns.addSolid(dd_FAl_name_d2, UnionSolid(dd_FAl_name_d2, solid_d1, solid_b2,
Position(sdx, -sdy, 0)));
330 Solid solid_d3 = UnionSolid(dd_FAl_name_d3, solid_d2, solid_b2,
Position(-sdx, sdy, 0));
331 ns.addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d3, solid_b2,
Position(-sdx, -sdy, 0)));
335 bdx = es.abs1stx[cutabsx];
337 bdx = es.abs2ndx[cutabsy];
340 Solid solidcut = Box(dd_tmp_name_b, bdx, bdy, zHalf);
341 Solid iner = Tube(dd_tmp_name_c, 0, es.in_rad_Abs_Pb, zHalf + 0.1_mm, 0., 360._deg);
342 Solid
final = SubtractionSolid(dd_tmp_name_d, solidcut, iner);
344 Volume blayer =
Volume(dd_tmp_name_d,
final, ns.material(es.materials[
i]));
345 parentVolume.placeVolume(blayer, 1,
Position(0, 0, zpos));
347 Solid iner_Al = Tube(dd_tmp_name_e, es.in_rad_Abs_Al, es.in_rad_Abs_Pb - 0.01_mm, zHalf, 0., 360._deg);
348 Volume layerAl =
Volume(dd_tmp_name_e, iner_Al, ns.material(es.materials[
i - 1]));
349 parentVolume.placeVolume(layerAl, 1,
Position(0, 0, zpos));
350 parentVolume.placeVolume(layerFinOutAl, 1,
Position(0, 0, zpos));
352 parentVolume.placeVolume(layer, 1,
Position(0., 0., zpos));
359 double xpos(0.), ypos(0.), zpos(0.), sdx(0.), sdy(0.), sdz(0.);
360 double prev_length(0.), ladder_new_length(0.);
361 double ladd_shift(0.);
362 double ladder_length(0.);
363 int enb(0), swed_scopy_glob(0);
364 double sdxe[50] = {0}, sdye[50] = {0}, sdze[50] = {0};
365 double sdxe2[50] = {0}, sdye2[50] = {0}, sdze2[50] = {0}, sdxe3[50] = {0}, sdye3[50] = {0}, sdze3[50] = {0};
367 for (
int M = 0; M <
int(es.typesL5.size() + es.typesL4.size()); M++) {
369 double boxax(0.), boxay(0.), boxaz(0.);
370 int ladd_not_plain(0), ladd_subtr_no(0), ladd_upper(0), ladd_side(0);
371 Solid solid_lfront = Trap(
"esalgo:LDRFRNT",
372 es.ldrFrnt_Length / 2.,
375 es.ladder_width / 2.,
376 (es.ladder_thick) / 2.,
377 (es.ladder_thick) / 2.,
379 es.ladder_width / 2.,
380 (es.ladder_thick - es.ceramic_length *
sin(es.wedge_angle * 2.)) / 2.,
381 (es.ladder_thick - es.ceramic_length *
sin(es.wedge_angle * 2.)) / 2.,
384 Solid solid_lbck = Trap(
"esalgo:LDRBCK",
385 es.ldrBck_Length / 2.,
388 es.ladder_width / 2.,
389 (es.box_thick /
cos(es.wedge_angle * 2) + 0.02_mm) / 2.,
390 (es.box_thick /
cos(es.wedge_angle * 2) + 0.02_mm) / 2.,
392 es.ladder_width / 2.,
393 (es.ladder_thick - es.wedge_back_thick) / 2.,
394 (es.ladder_thick - es.wedge_back_thick) / 2.,
397 Solid solid_lfhalf = Trap(
"esalgo:LDRFHALF",
398 es.ldrFrnt_Length / 2.,
401 (es.ladder_width / 2.) / 2.,
402 (es.ladder_thick) / 2.,
403 (es.ladder_thick) / 2.,
405 (es.ladder_width / 2.) / 2.,
406 (es.ladder_thick - es.ceramic_length *
sin(es.wedge_angle * 2.)) / 2.,
407 (es.ladder_thick - es.ceramic_length *
sin(es.wedge_angle * 2.)) / 2.,
410 Solid solid_lbhalf = Trap(
"esalgo:LDRBHALF",
411 es.ldrBck_Length / 2.,
414 (es.ladder_width / 2.) / 2.,
415 (es.box_thick /
cos(es.wedge_angle * 2.) + 0.02_mm) / 2.,
416 (es.box_thick /
cos(es.wedge_angle * 2.) + 0.02_mm) / 2.,
418 (es.ladder_width / 2.) / 2.,
419 (es.ladder_thick - es.wedge_back_thick) / 2.,
420 (es.ladder_thick - es.wedge_back_thick) / 2.,
423 Solid solid_lfhtrunc =
424 Trap(
"esalgo:LDRFHTR",
425 (es.ldrFrnt_Length - es.waf_active) / 2.,
428 (es.ladder_width / 2.) / 2.,
429 (es.ladder_thick) / 2.,
430 (es.ladder_thick) / 2.,
432 (es.ladder_width / 2.) / 2.,
433 (es.ladder_thick - (es.ceramic_length - es.waf_active) *
sin(es.wedge_angle * 2)) / 2.,
434 (es.ladder_thick - (es.ceramic_length - es.waf_active) *
sin(es.wedge_angle * 2)) / 2.,
439 if (M <
int(es.typesL5.size())) {
440 for (
int i = 0;
i <= 1;
i++) {
441 for (
int j = 0;
j <= 3;
j++) {
442 if (es.laddL5map[(
i +
j * 2 + M * 10)] != 1) {
451 const string& ddname(
"esalgo:" + es.ladPfx[0] + es.typesL5[M]);
452 ladder_length = es.micromodule_length + 4 * es.waf_active + 0.1_mm;
454 if (ladd_not_plain) {
457 const string& dd_tmp_name_5a(
"esalgo:" + es.ladPfx[2]);
458 const string& dd_tmp_name_5b(
"esalgo:" + es.ladPfx[3] + to_string(enb));
459 const string& dd_tmp_name_5c(
"esalgo:" + es.ladPfx[4] + to_string(enb));
461 boxay = ladder_length - es.ldrFrnt_Length - es.ldrBck_Length;
462 boxax = es.ladder_width;
463 boxaz = es.ladder_thick;
465 Solid solid_5a = Box(dd_tmp_name_5a, boxax / 2., boxay / 2., boxaz / 2.);
467 sdxe[enb] = es.ladder_width / 4.;
468 sdye[enb] = -boxay / 2. - es.ldrFrnt_Length / 2.;
469 sdze[enb] = -es.ladder_thick / 2. + es.ldrFrnt_Offset;
471 sdxe[enb] = -es.ladder_width / 4.;
474 UnionSolid(dd_tmp_name_5b,
477 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdxe[enb], sdye[enb], sdze[enb])));
480 sdxe2[enb] = -es.ladder_width / 4.;
481 sdye2[enb] = -boxay / 2. - es.ldrFrnt_Length / 2. + es.waf_active / 2.;
482 sdze2[enb] = -es.ladder_thick / 2. + es.ldrFrnt_Offset + (es.waf_active *
sin(es.wedge_angle * 2)) / 4.;
484 sdxe2[enb] = es.ladder_width / 4.;
487 UnionSolid(dd_tmp_name_5c,
490 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
493 sdye3[enb] = boxay / 2. + es.ldrBck_Length / 2.;
494 sdze3[enb] = -es.ladder_thick / 2. + es.ldrBck_Offset;
499 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdxe3[enb], sdye3[enb], sdze3[enb])));
501 ns.addVolumeNS(
Volume(ddname, solid, ns.material(es.laddMaterial)));
502 ns.addVolumeNS(
Volume(
"esalgo:" + es.ladPfx[1] + es.typesL5[M], solid, ns.material(es.laddMaterial)));
506 const string& dd_tmp_name_5pa(
"esalgo:" + es.ladPfx[2] +
"5p");
507 const string& dd_tmp_name_5pb(
"esalgo:" + es.ladPfx[3] +
"5p");
509 boxay = ladder_length - es.ldrFrnt_Length - es.ldrBck_Length;
510 boxax = es.ladder_width;
511 boxaz = es.ladder_thick;
513 Solid solid_5pa = Box(dd_tmp_name_5pa, boxax / 2., boxay / 2., boxaz / 2.);
515 sdy = -boxay / 2. - es.ldrFrnt_Length / 2.;
516 sdz = -es.ladder_thick / 2. + es.ldrFrnt_Offset;
518 Solid solid_5pb = UnionSolid(dd_tmp_name_5pb,
521 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdx, sdy, sdz)));
524 sdy = boxay / 2. + es.ldrBck_Length / 2.;
525 sdz = -es.ladder_thick / 2. + es.ldrBck_Offset;
527 Solid solid = UnionSolid(
528 ddname, solid_5pb, solid_lbck, Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdx, sdy, sdz)));
529 ns.addVolumeNS(
Volume(ddname, solid, ns.material(es.laddMaterial)));
530 ns.addVolumeNS(
Volume(
"esalgo:" + es.ladPfx[1] + es.typesL5[M], solid, ns.material(es.laddMaterial)));
536 if (M >=
int(es.typesL5.size())) {
537 int d = M - es.typesL5.size();
539 for (
int i = 0;
i <= 1;
i++) {
540 for (
int j = 0;
j <= 3;
j++) {
541 if (es.laddL4map[(
i +
j * 2 + (M - es.typesL5.size()) * 8)] != 1) {
550 const string& ddname(
"esalgo:" + es.ladPfx[0] + es.typesL4[
d]);
551 ladder_length = es.micromodule_length + 3 * es.waf_active + 0.1_mm;
553 if (ladd_not_plain) {
557 const string& dd_tmp_name_a(
"esalgo:" + es.ladPfx[7]);
558 const string& dd_tmp_name_b(
"esalgo:" + es.ladPfx[8] + to_string(enb));
560 boxay = ladder_length - es.ldrFrnt_Length - es.ldrBck_Length;
561 boxax = es.ladder_width;
562 boxaz = es.ladder_thick;
563 Solid solid_a = Box(dd_tmp_name_a, boxax / 2., boxay / 2., boxaz / 2.);
566 sdye[enb] = -boxay / 2. - es.ldrFrnt_Length / 2.;
567 sdze[enb] = -es.ladder_thick / 2. + es.ldrFrnt_Offset;
569 UnionSolid(dd_tmp_name_b,
572 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdxe[enb], sdye[enb], sdze[enb])));
575 sdxe2[enb] = es.ladder_width / 4.;
576 sdye2[enb] = boxay / 2. + es.ldrBck_Length / 2.;
577 sdze2[enb] = -es.ladder_thick / 2. + es.ldrBck_Offset;
579 sdxe2[enb] = -es.ladder_width / 4.;
584 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
586 ns.addVolumeNS(
Volume(ddname, solid, ns.material(es.laddMaterial)));
587 ns.addVolumeNS(
Volume(
"esalgo:" + es.ladPfx[1] + es.typesL4[
d], solid, ns.material(es.laddMaterial)));
591 if (ladd_subtr_no > 1) {
594 const string& dd_tmp_name_a(
"esalgo:" + es.ladPfx[7]);
595 const string& dd_tmp_name_b(
"esalgo:" + es.ladPfx[8] + to_string(enb));
597 boxay = ladder_length - es.ldrFrnt_Length - es.ldrBck_Length;
598 boxax = es.ladder_width;
599 boxaz = es.ladder_thick;
601 Solid solid_a = Box(dd_tmp_name_a, boxax / 2., boxay / 2., boxaz / 2.);
603 sdxe[enb] = es.ladder_width / 4.;
604 sdye[enb] = -boxay / 2. - es.ldrFrnt_Length / 2.;
605 sdze[enb] = -es.ladder_thick / 2. + es.ldrFrnt_Offset;
607 sdxe[enb] = -es.ladder_width / 4.;
610 UnionSolid(dd_tmp_name_b,
613 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdxe[enb], sdye[enb], sdze[enb])));
616 sdye2[enb] = boxay / 2. + es.ldrBck_Length / 2.;
617 sdze2[enb] = -es.ladder_thick / 2. + es.ldrBck_Offset;
623 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
625 ns.addVolumeNS(
Volume(ddname, solid, ns.material(es.laddMaterial)));
626 ns.addVolumeNS(
Volume(
"esalgo:" + es.ladPfx[1] + es.typesL4[
d], solid, ns.material(es.laddMaterial)));
629 const string& dd_tmp_name_a(
"esalgo:" + es.ladPfx[7]);
630 const string& dd_tmp_name_b(
"esalgo:" + es.ladPfx[8] + to_string(enb));
631 const string& dd_tmp_name_c(
"esalgo:" + es.ladPfx[9] + to_string(enb));
633 boxay = ladder_length - es.ldrFrnt_Length - es.ldrBck_Length;
634 boxax = es.ladder_width;
635 boxaz = es.ladder_thick;
636 Solid solid_a = Box(dd_tmp_name_a, boxax / 2., boxay / 2., boxaz / 2.);
638 sdxe[enb] = es.ladder_width / 4.;
639 sdye[enb] = -boxay / 2. - es.ldrFrnt_Length / 2.;
640 sdze[enb] = -es.ladder_thick / 2. + es.ldrFrnt_Offset;
642 sdxe[enb] = -es.ladder_width / 4.;
645 UnionSolid(dd_tmp_name_b,
648 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdxe[enb], sdye[enb], sdze[enb])));
651 sdxe2[enb] = -es.ladder_width / 4.;
652 sdye2[enb] = -boxay / 2. - es.ldrFrnt_Length / 2. + es.waf_active / 2.;
653 sdze2[enb] = -es.ladder_thick / 2. + es.ldrFrnt_Offset + (es.waf_active *
sin(es.wedge_angle * 2)) / 4.;
655 sdxe2[enb] = es.ladder_width / 4.;
658 UnionSolid(dd_tmp_name_c,
661 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
664 sdye3[enb] = boxay / 2. + es.ldrBck_Length / 2.;
665 sdze3[enb] = -es.ladder_thick / 2. + es.ldrBck_Offset;
670 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdxe3[enb], sdye3[enb], sdze3[enb])));
672 ns.addVolumeNS(
Volume(ddname, solid, ns.material(es.laddMaterial)));
673 ns.addVolumeNS(
Volume(
"esalgo:" + es.ladPfx[1] + es.typesL4[
d], solid, ns.material(es.laddMaterial)));
678 const string& dd_tmp_name_pa(
"esalgo:" + es.ladPfx[2] +
"p");
679 const string& dd_tmp_name_pb(
"esalgo:" + es.ladPfx[3] +
"p");
681 boxay = ladder_length - es.ldrFrnt_Length - es.ldrBck_Length;
682 boxax = es.ladder_width;
683 boxaz = es.ladder_thick;
685 Solid solid_pa = Box(dd_tmp_name_pa, boxax / 2., boxay / 2., boxaz / 2.);
687 sdy = -boxay / 2. - es.ldrFrnt_Length / 2.;
688 sdz = -es.ladder_thick / 2. + es.ldrFrnt_Offset;
690 Solid solid_pb = UnionSolid(dd_tmp_name_pb,
693 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdx, sdy, sdz)));
696 sdy = boxay / 2. + es.ldrBck_Length / 2.;
697 sdz = -es.ladder_thick / 2. + es.ldrBck_Offset;
698 Solid solid = UnionSolid(
699 ddname, solid_pb, solid_lbck, Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(sdx, sdy, sdz)));
700 ns.addVolumeNS(
Volume(ddname, solid, ns.material(es.laddMaterial)));
701 ns.addVolumeNS(
Volume(
"esalgo:" + es.ladPfx[1] + es.typesL4[
d], solid, ns.material(es.laddMaterial)));
707 if (M <
int(es.typesL5.size())) {
708 const string& ddname(
"esalgo:" + es.ladPfx[0] + es.typesL5[M]);
709 const string& ddname2(
"esalgo:" + es.ladPfx[1] + es.typesL5[M]);
710 for (
int i = 0;
i <= 1;
i++) {
711 for (
int j = 0;
j <= 4;
j++) {
712 xpos = (
i * 2 - 1) * es.waf_intra_col_sep / 2.;
713 ypos = -ladder_length / 2. + 0.05_mm - (es.ldrFrnt_Length - es.ldrBck_Length) / 2. + es.wedge_length / 2. +
715 zpos = -es.ladder_thick / 2. + 0.005_mm + es.wedge_offset;
716 if (es.laddL5map[(
i +
j * 2 + M * 10)] == 1) {
718 ns.volume(ddname).placeVolume(swedLog,
719 scopy + 1000 * swed_scopy_glob,
720 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(xpos, ypos, zpos)));
721 ns.volume(ddname2).placeVolume(swedLog,
722 scopy + 1000 * swed_scopy_glob + 100,
723 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(xpos, ypos, zpos)));
725 ypos = ypos + es.ywedge_ceramic_diff;
726 zpos = -es.ladder_thick / 2. + 0.005_mm + es.zwedge_ceramic_diff;
727 ns.volume(ddname).placeVolume(sfbxLog,
728 scopy + 1000 * swed_scopy_glob,
729 Transform3D(ns.rotation(
"esalgo:RM1298"),
Position(xpos, ypos, zpos)));
730 ns.volume(ddname2).placeVolume(sfbyLog,
731 scopy + 1000 * swed_scopy_glob,
732 Transform3D(ns.rotation(
"esalgo:RM1300A"),
Position(xpos, ypos, zpos)));
737 int d = M - es.typesL5.size();
738 const string& ddname(
"esalgo:" + es.ladPfx[0] + es.typesL4[
d]);
739 const string& ddname2(
"esalgo:" + es.ladPfx[1] + es.typesL4[
d]);
740 for (
int i = 0;
i <= 1;
i++) {
741 for (
int j = 0;
j <= 3;
j++) {
742 xpos = (
i * 2 - 1) * es.waf_intra_col_sep / 2.;
743 ypos = -ladder_length / 2. + 0.05_mm - (es.ldrFrnt_Length - es.ldrBck_Length) / 2. + es.wedge_length / 2. +
745 zpos = -es.ladder_thick / 2. + 0.005_mm + es.wedge_offset;
746 if (es.laddL4map[(
i +
j * 2 + (M - es.typesL5.size()) * 8)] == 1) {
748 ns.volume(ddname).placeVolume(swedLog,
749 scopy + 1000 * swed_scopy_glob,
750 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(xpos, ypos, zpos)));
751 ns.volume(ddname2).placeVolume(swedLog,
752 scopy + 1000 * swed_scopy_glob + 100,
753 Transform3D(ns.rotation(
"esalgo:RM1299"),
Position(xpos, ypos, zpos)));
755 ypos = ypos + es.ywedge_ceramic_diff;
756 zpos = -es.ladder_thick / 2. + 0.005_mm + es.zwedge_ceramic_diff;
757 ns.volume(ddname).placeVolume(sfbxLog,
758 scopy + 1000 * swed_scopy_glob,
759 Transform3D(ns.rotation(
"esalgo:RM1298"),
Position(xpos, ypos, zpos)));
760 ns.volume(ddname2).placeVolume(sfbyLog,
761 scopy + 1000 * swed_scopy_glob,
762 Transform3D(ns.rotation(
"esalgo:RM1300A"),
Position(xpos, ypos, zpos)));
770 int icopy[100] = {0};
771 constexpr
int sz = 20;
773 for (
int I = -9;
I <= 9; ++
I) {
776 for (
int K = 0; K < es.noLaddInCol[J]; K++) {
779 ladder_new_length = es.micromodule_length + 3. * es.waf_active;
780 ladd_shift = 4. * es.waf_active;
783 type = es.typeOfLaddRow0[J];
785 type = es.typeOfLaddRow1[J];
787 type = es.typeOfLaddRow2[J];
789 type = es.typeOfLaddRow3[J];
791 for (
const auto&
i : es.typesL5)
793 ladder_new_length = es.micromodule_length + 4. * es.waf_active;
794 ladd_shift = 5. * es.waf_active;
799 for (
int t = 0;
t <
int(es.typesL5.size());
t++)
800 if (
type == es.typesL5[
t]) {
802 if (
I < 0 && es.asymLadd[
t] == 1) {
804 type = es.typesL5[
j];
807 for (
int t = 0;
t <
int(es.typesL4.size());
t++)
808 if (
type == es.typesL4[
t]) {
809 j =
t + es.typesL5.size();
810 if (
I < 0 && es.asymLadd[(
t + es.typesL5.size())] == 1) {
812 type = es.typesL4[
j - es.typesL5.size()];
816 xpos =
I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
818 xpos = xpos + es.dee_separation;
820 xpos = xpos - es.dee_separation;
822 ypos = (sz -
int(es.startOfFirstLadd[J])) * es.waf_active - ladder_new_length / 2. +
823 (es.ldrFrnt_Length - es.ldrBck_Length) / 2. + es.micromodule_length + 0.05_cm - prev_length;
825 prev_length += ladd_shift;
827 zpos = es.zlead1 + es.ladder_thick / 2. + 0.01_mm;
830 sfLog.placeVolume(ns.volume(
"esalgo:" + es.ladPfx[0] +
type), icopy[
j],
Position(xpos, ypos, zpos));
832 xpos =
I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
833 sfLog.placeVolume(ns.volume(
"esalgo:" + es.ladPfx[1] +
type),
835 Transform3D(ns.rotation(
"esalgo:R270"),
Position(ypos, -xpos, zpos - es.zlead1 + es.zlead2)));
838 for (
int t = 0;
t <
int(es.typesL5.size());
t++)
839 if (
type == es.typesL5[
t]) {
841 if (es.asymLadd[
t] == 2 && !changed) {
845 if (es.asymLadd[
t] == 1 && !changed) {
849 type = es.typesL5[
j];
851 for (
int t = 0;
t <
int(es.typesL4.size());
t++)
852 if (
type == es.typesL4[
t]) {
853 j =
t + es.typesL5.size();
854 if (es.asymLadd[(
t + es.typesL5.size())] == 2 && !changed) {
858 if (es.asymLadd[(
t + es.typesL5.size())] == 1 && !changed) {
862 type = es.typesL4[
j - es.typesL5.size()];
868 xpos = xpos + es.dee_separation;
870 xpos = xpos - es.dee_separation;
872 sfLog.placeVolume(ns.volume(
"esalgo:" + es.ladPfx[0] +
type),
874 Transform3D(ns.rotation(
"esalgo:R180"),
Position(xpos, -ypos, zpos)));
876 xpos =
I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
879 ns.volume(
"esalgo:" + es.ladPfx[1] +
type),
881 Transform3D(ns.rotation(
"esalgo:R090"),
Position(-ypos, -xpos, zpos - es.zlead1 + es.zlead2)));
887 double xpos(0), ypos(0);
888 Volume sfwxLog = ns.volume(
"esalgo:SFWX");
889 Volume sfwyLog = ns.volume(
"esalgo:SFWY");
890 Volume sfsxLog = ns.volume(
"esalgo:SFSX");
891 Volume sfsyLog = ns.volume(
"esalgo:SFSY");
893 for (
size_t i = 0;
i < 32; ++
i) {
894 xpos = -es.waf_active / 2. +
i * es.waf_active / 32. + es.waf_active / 64.;
895 sfwxLog.placeVolume(sfsxLog,
i + 1,
Position(xpos, 0., 0.));
897 ypos = -es.waf_active / 2. +
i * es.waf_active / 32. + es.waf_active / 64.;
898 sfwyLog.placeVolume(sfsyLog,
i + 1,
Position(0., ypos, 0.));