1 #include "DD4hep/DetFactoryHelper.h" 5 #include "DD4hep/Shapes.h" 18 vector<string> materials_;
19 vector<string> layName_;
20 vector<string> ladPfx_;
22 vector<double> thickLayers_;
23 vector<double> abs1stx;
24 vector<double> abs1sty;
25 vector<double> abs2ndx;
26 vector<double> abs2ndy;
27 vector<double> asym_ladd_;
28 vector<double> rminVec;
29 vector<double> rmaxVec;
30 vector<double> noLaddInCol_;
31 vector<double> startOfFirstLadd_;
32 vector<string> types_l5_;
33 vector<string> types_l4_;
34 vector<double> ladd_l5_map_;
35 vector<double> ladd_l4_map_;
36 vector<string> typeOfLaddRow0;
37 vector<string> typeOfLaddRow1;
38 vector<string> typeOfLaddRow2;
39 vector<string> typeOfLaddRow3;
41 double zlead1_, zlead2_, zfoam1_, zfoam2_;
42 double waf_intra_col_sep, waf_inter_col_sep, waf_active, wedge_length, wedge_offset, zwedge_ceramic_diff,
43 ywedge_ceramic_diff, wedge_angle, box_thick, dee_separation, In_rad_Abs_Al, In_rad_Abs_Pb;
44 double ladder_thick, yladder_1stwedge_diff, ladder_width, ladder_length, micromodule_length;
45 double absAlX_X_, absAlX_Y_, absAlX_subtr1_Xshift_, absAlX_subtr1_Yshift_, rMax_Abs_Al_;
46 double absAlY_X_, absAlY_Y_, absAlY_subtr1_Xshift_, absAlY_subtr1_Yshift_;
47 double LdrBck_Length, LdrFrnt_Length, LdrFrnt_Offset, LdrBck_Offset, ceramic_length, wedge_back_thick;
54 dd4hep::SensitiveDetector& ) {
66 es.asym_ladd_ = args.
vecDble(
"ASYMETRIC_LADDER");
67 es.types_l5_ = args.
vecStr(
"TYPES_OF_LADD_L5");
68 es.types_l4_ = args.
vecStr(
"TYPES_OF_LADD_L4");
69 es.ladd_l5_map_ = args.
vecDble(
"LADD_L5_MAP");
70 es.ladd_l4_map_ = args.
vecDble(
"LADD_L4_MAP");
71 es.noLaddInCol_ = args.
vecDble(
"NUMB_OF_LADD_IN_COL");
72 es.startOfFirstLadd_ = args.
vecDble(
"START_OF_1ST_LADD");
73 es.typeOfLaddRow0 = args.
vecStr(
"TYPE_OF_LADD_1");
74 es.typeOfLaddRow1 = args.
vecStr(
"TYPE_OF_LADD_2");
75 es.typeOfLaddRow2 = args.
vecStr(
"TYPE_OF_LADD_3");
76 es.typeOfLaddRow3 = args.
vecStr(
"TYPE_OF_LADD_4");
77 es.thickLayers_ = args.
vecDble(
"Layers");
78 es.thickness_ = args.
dble(
"PRESH_Z_TOTAL");
79 es.materials_ = args.
vecStr(
"LayMat");
80 es.layName_ = args.
vecStr(
"LayName");
81 es.rmaxVec = args.
vecDble(
"R_MAX");
82 es.rminVec = args.
vecDble(
"R_MIN");
83 es.waf_intra_col_sep = args.
dble(
"waf_intra_col_sep");
84 es.waf_inter_col_sep = args.
dble(
"waf_inter_col_sep");
85 es.waf_active = args.
dble(
"waf_active");
86 es.wedge_length = args.
dble(
"wedge_length");
87 es.wedge_offset = args.
dble(
"wedge_offset");
88 es.zwedge_ceramic_diff = args.
dble(
"zwedge_ceramic_diff");
89 es.ywedge_ceramic_diff = args.
dble(
"ywedge_ceramic_diff");
90 es.ceramic_length = args.
dble(
"ceramic_length");
91 es.wedge_angle = args.
dble(
"wedge_angle");
92 es.wedge_back_thick = args.
dble(
"wedge_back_thick");
93 es.ladder_thick = args.
dble(
"ladder_thick");
94 es.ladder_width = args.
dble(
"ladder_width");
95 es.micromodule_length = args.
dble(
"micromodule_length");
96 es.box_thick = args.
dble(
"box_thick");
97 es.abs1stx = args.
vecDble(
"1ST_ABSX");
98 es.abs1sty = args.
vecDble(
"1ST_ABSY");
99 es.abs2ndx = args.
vecDble(
"2ND_ABSX");
100 es.abs2ndy = args.
vecDble(
"2ND_ABSY");
101 es.ladPfx_ = args.
vecStr(
"LadPrefix");
102 es.LaddMaterial_ = args.
str(
"LadderMaterial");
103 es.LdrFrnt_Length = args.
dble(
"LdrFrnt_Length");
104 es.LdrFrnt_Offset = args.
dble(
"LdrFrnt_Offset");
105 es.LdrBck_Length = args.
dble(
"LdrBck_Length");
106 es.LdrBck_Offset = args.
dble(
"LdrBck_Offset");
107 es.dee_separation = args.
dble(
"dee_sep");
108 es.In_rad_Abs_Al = args.
dble(
"R_MIN_Abs_Al");
109 es.In_rad_Abs_Pb = args.
dble(
"R_MIN_Abs_Pb");
110 es.rMax_Abs_Al_ = args.
dble(
"R_MAX_Abs_Al");
111 es.absAlX_X_ = args.
dble(
"AbsAlX_X");
112 es.absAlX_Y_ = args.
dble(
"AbsAlX_Y");
113 es.absAlX_subtr1_Xshift_ = args.
dble(
"AbsAlX_subtr1_Xshift");
114 es.absAlX_subtr1_Yshift_ = args.
dble(
"AbsAlX_subtr1_Yshift");
115 es.absAlY_X_ = args.
dble(
"AbsAlY_X");
116 es.absAlY_Y_ = args.
dble(
"AbsAlY_Y");
117 es.absAlY_subtr1_Xshift_ = args.
dble(
"AbsAlY_subtr1_Xshift");
118 es.absAlY_subtr1_Yshift_ = args.
dble(
"AbsAlY_subtr1_Yshift");
122 double zpos = -es.thickness_ / 2., sdx(0), sdy(0), bdx(0), bdy(0);
124 for (
size_t i = 0;
i < es.thickLayers_.size(); ++
i) {
127 double rIn(0), rOut(0), zHalf(0);
130 string ddname(es.layName_[
i]);
134 rOut = es.rmaxVec[
i];
135 zHalf = es.thickLayers_[
i] / 2.;
138 Solid solid = ns.
addSolid(ddname, Tube(ddname, rIn, rOut, zHalf, 0., 360._deg));
146 if (I == 2 || I == 28 || I == 13 || I == 23) {
152 es.zlead1_ = zpos + zHalf;
155 es.zlead2_ = zpos + zHalf;
158 if (I == 10 || I == 20) {
161 double outalbx, outalby, shiftR, outalbx2, outalby2, shiftR2;
163 absz =
int(es.abs1stx.size());
165 absz =
int(es.abs2ndx.size());
166 int cutabsx = -1, cutabsy = -1;
168 string dd_tmp_name_b(
"esalgo:" + es.layName_[
i] +
"Lcut");
169 string dd_tmp_name_c(
"esalgo:" + es.layName_[
i] +
"tmpb");
170 string dd_tmp_name_d(
"esalgo:" + es.layName_[
i] +
"LinPb");
172 string dd_tmp_name_e(
"esalgo:" + es.layName_[
i] +
"LinAl");
173 string dd_tmp_name_f(
"esalgo:" + es.layName_[
i] +
"LOutAl");
175 ostringstream tmp_Alname_fin;
176 tmp_Alname_fin << es.layName_[
i] <<
"LtmpAl" << absz - 1;
177 string dd_Alname_fin(
"esalgo:" + tmp_Alname_fin.str());
179 string dd_Alname_f(es.layName_[
i] +
"LOutAl");
180 string dd_Alname_g(es.layName_[
i] +
"LOutAl2");
181 string dd_Alname_h(es.layName_[
i] +
"LOutAltmp");
182 string dd_Alname_i(es.layName_[
i] +
"LOutAltmp2");
183 string dd_Alname_j(es.layName_[
i] +
"LOutAltmp3");
184 string dd_Alname_k(es.layName_[
i] +
"LOutAltmp4");
185 string dd_Alname_l(es.layName_[
i] +
"LOutAltmp5");
186 string dd_Alname_m(es.layName_[
i] +
"LOutAltmp6");
189 dd_Alname_f, Tube(dd_Alname_f, es.rMax_Abs_Al_ - 20_cm, es.rMax_Abs_Al_, zHalf - 0.1_mm, 0., 90._deg));
191 outalbx = es.absAlX_X_ * 0.1;
192 outalby = es.rMax_Abs_Al_ + 0.1_mm - es.absAlX_subtr1_Yshift_;
193 shiftR = es.absAlX_subtr1_Yshift_;
195 outalbx = es.absAlY_X_ * 0.1;
196 outalby = es.rMax_Abs_Al_ + 0.1_mm - es.absAlY_subtr1_Yshift_;
197 shiftR = es.absAlY_subtr1_Xshift_;
199 Solid OutAltmp = ns.
addSolid(dd_Alname_h, Box(dd_Alname_h, outalbx / 2 + 0.1_mm, outalby / 2 + 0.1_mm, zHalf));
202 SubtractionSolid(dd_Alname_j, Out_Al, OutAltmp, Position(outalbx / 2, outalby / 2 + shiftR, 0)));
203 outalby2 = es.absAlX_Y_ * 0.1;
204 outalbx2 = es.rMax_Abs_Al_ + 0.1_mm - es.absAlX_subtr1_Xshift_;
205 shiftR2 = es.absAlX_subtr1_Xshift_;
207 outalby2 = es.absAlY_Y_ * 0.1;
208 outalbx2 = es.rMax_Abs_Al_ + 0.1_mm - es.absAlY_subtr1_Xshift_;
209 shiftR2 = es.absAlY_subtr1_Xshift_;
212 ns.
addSolid(dd_Alname_i, Box(dd_Alname_i, outalbx2 / 2 + 0.1_mm, outalby2 / 2 + 0.1_mm, zHalf));
215 SubtractionSolid(dd_Alname_k, Out_Altmp3, OutAltmp2, Position(outalbx2 / 2 + shiftR2, outalby2 / 2, 0)));
217 ns.
addSolid(dd_Alname_l, UnionSolid(dd_Alname_l, Out_Altmp4, Out_Altmp4, ns.
rotation(
"esalgo:RABS90")));
219 ns.
addSolid(dd_Alname_m, UnionSolid(dd_Alname_m, Out_Altmp5, Out_Altmp4, ns.
rotation(
"esalgo:RABS180B")));
221 ns.
addSolid(dd_Alname_g, UnionSolid(dd_Alname_g, Out_Altmp6, Out_Altmp4, ns.
rotation(
"esalgo:R180")));
226 for (
int L = 0;
L < absz; ++
L) {
228 ostringstream tmp_name_b, tmp_name_b2, tmp_FAl_name_c, tmp_FAl_name_d1, tmp_FAl_name_d2, tmp_FAl_name_d3,
230 tmp_name_b << es.layName_[
i] <<
"L" << K;
231 tmp_name_b2 << es.layName_[
i] <<
"Lb2" << K;
234 tmp_FAl_name_c << es.layName_[
i] <<
"LOutAl2";
236 tmp_FAl_name_c << es.layName_[
i] <<
"LtmpAl" << K - 1;
238 tmp_FAl_name_d1 << es.layName_[
i] <<
"LtmpAl" << K <<
"_1";
239 tmp_FAl_name_d2 << es.layName_[
i] <<
"LtmpAl" << K <<
"_2";
240 tmp_FAl_name_d3 << es.layName_[
i] <<
"LtmpAl" << K <<
"_3";
241 tmp_FAl_name_d << es.layName_[
i] <<
"LtmpAl" << K;
243 string dd_tmp_name_b(tmp_name_b.str());
244 string dd_tmp_name_b2(tmp_name_b2.str());
245 string dd_FAl_name_c(tmp_FAl_name_c.str());
246 string dd_FAl_name_d1(tmp_FAl_name_d1.str());
247 string dd_FAl_name_d2(tmp_FAl_name_d2.str());
248 string dd_FAl_name_d3(tmp_FAl_name_d3.str());
249 string dd_FAl_name_d(tmp_FAl_name_d.str());
252 bdx =
abs(es.abs1stx[K]) / 2;
254 bdx =
abs(es.abs1stx[K] - es.abs1stx[K - 1]) / 2;
256 if (es.abs1stx[K] < rIn + 30_cm) {
257 bdy = es.abs1sty[K] / 2 - 30_cm;
263 bdx =
abs(es.abs2ndx[K]) / 2;
265 bdx =
abs(es.abs2ndx[K] - es.abs2ndx[K - 1]) / 2;
269 if ((es.abs2ndx[K] < rIn + 30_cm) && I == 20) {
270 bdy = es.abs2ndy[K] / 2 - 30_cm;
274 Solid solid_b = Box(dd_tmp_name_b, bdx, bdy, zHalf);
275 Solid solid_b2 = Box(dd_tmp_name_b2, bdx + 0.1_mm, bdy + 0.1_mm, zHalf);
277 sdx = es.abs1stx[K] - bdx;
279 if (es.abs1stx[K] < rIn + 30_cm)
280 sdy = es.abs1sty[K] - bdy;
283 sdx = es.abs2ndx[K] - bdx;
286 if ((es.abs2ndx[K] < rIn + 30_cm) && I == 20)
287 sdy = es.abs2ndy[K] - bdy;
291 layerFinOutAl.placeVolume(layer, 1, Position(sdx, sdy, 0));
292 layerFinOutAl.placeVolume(layer, 2, Position(-sdx, sdy, 0));
294 Solid solid_c = ns.
solid(dd_FAl_name_c);
295 Solid solid_d1 = UnionSolid(dd_FAl_name_d1, solid_c, solid_b2, Position(sdx, sdy, 0));
297 ns.
addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d1, solid_b2, Position(-sdx, -sdy, 0)));
299 if (((es.abs1stx[K] < rIn + 30_cm) && I == 10) || ((es.abs2ndx[K] < rIn + 30_cm) && I == 20)) {
300 layerFinOutAl.placeVolume(layer, 3, Position(sdx, -sdy, 0));
301 layerFinOutAl.placeVolume(layer, 4, Position(-sdx, -sdy, 0));
303 Solid solid_c = ns.
solid(dd_FAl_name_c);
304 Solid solid_d1 = UnionSolid(dd_FAl_name_d1, solid_c, solid_b2, Position(sdx, sdy, 0));
306 ns.
addSolid(dd_FAl_name_d2, UnionSolid(dd_FAl_name_d2, solid_d1, solid_b2, Position(sdx, -sdy, 0)));
307 Solid solid_d3 = UnionSolid(dd_FAl_name_d3, solid_d2, solid_b2, Position(-sdx, sdy, 0));
309 ns.
addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d3, solid_b2, Position(-sdx, -sdy, 0)));
313 bdx = es.abs1stx[cutabsx];
315 bdx = es.abs2ndx[cutabsy];
318 Solid solidcut = Box(dd_tmp_name_b, bdx, bdy, zHalf);
319 Solid iner = Tube(dd_tmp_name_c, 0, es.In_rad_Abs_Pb, zHalf + 0.1_mm, 0., 360._deg);
320 Solid
final = SubtractionSolid(dd_tmp_name_d, solidcut, iner);
323 parentVolume.placeVolume(layer, 1, Position(0, 0, zpos));
325 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);
327 parentVolume.placeVolume(layerAl, 1, Position(0, 0, zpos));
328 parentVolume.placeVolume(layerFinOutAl, 1, Position(0, 0, zpos));
330 parentVolume.placeVolume(layer, 1, Position(0., 0., zpos));
337 double xpos(0), ypos(0), zpos(0), sdx(0), sdy(0), sdz(0);
338 double prev_length_(0), ladder_new_length_(0), ladd_shift_(0), ladder_length(0);
339 int enb(0), swed_scopy_glob(0);
340 double sdxe[50] = {0}, sdye[50] = {0}, sdze[50] = {0};
341 double sdxe2[50] = {0}, sdye2[50] = {0}, sdze2[50] = {0}, sdxe3[50] = {0}, sdye3[50] = {0}, sdze3[50] = {0};
343 for (
int M = 0; M <
int(es.types_l5_.size() + es.types_l4_.size()); M++) {
345 double boxax(0), boxay(0), boxaz(0);
346 int ladd_not_plain(0), ladd_subtr_no(0), ladd_upper(0), ladd_side(0);
348 Solid solid_lfront = Trap(
"esalgo:LDRFRNT",
349 es.LdrFrnt_Length / 2,
353 (es.ladder_thick) / 2,
354 (es.ladder_thick) / 2,
357 (es.ladder_thick - es.ceramic_length *
sin(es.wedge_angle * 2)) / 2,
358 (es.ladder_thick - es.ceramic_length *
sin(es.wedge_angle * 2)) / 2,
361 Solid solid_lbck = Trap(
"esalgo:LDRBCK",
362 es.LdrBck_Length / 2,
366 (es.box_thick /
cos(es.wedge_angle * 2) + 0.02_mm) / 2,
367 (es.box_thick /
cos(es.wedge_angle * 2) + 0.02_mm) / 2,
370 (es.ladder_thick - es.wedge_back_thick) / 2,
371 (es.ladder_thick - es.wedge_back_thick) / 2,
374 Solid solid_lfhalf = Trap(
"esalgo:LDRFHALF",
375 es.LdrFrnt_Length / 2,
378 (es.ladder_width / 2) / 2,
379 (es.ladder_thick) / 2,
380 (es.ladder_thick) / 2,
382 (es.ladder_width / 2) / 2,
383 (es.ladder_thick - es.ceramic_length *
sin(es.wedge_angle * 2)) / 2,
384 (es.ladder_thick - es.ceramic_length *
sin(es.wedge_angle * 2)) / 2,
387 Solid solid_lbhalf = Trap(
"esalgo:LDRBHALF",
388 es.LdrBck_Length / 2,
391 (es.ladder_width / 2) / 2,
392 (es.box_thick /
cos(es.wedge_angle * 2) + 0.02_mm) / 2,
393 (es.box_thick /
cos(es.wedge_angle * 2) + 0.02_mm) / 2,
395 (es.ladder_width / 2) / 2,
396 (es.ladder_thick - es.wedge_back_thick) / 2,
397 (es.ladder_thick - es.wedge_back_thick) / 2,
400 Solid solid_lfhtrunc =
401 Trap(
"esalgo:LDRFHTR",
402 (es.LdrFrnt_Length - es.waf_active) / 2,
405 (es.ladder_width / 2) / 2,
406 (es.ladder_thick) / 2,
407 (es.ladder_thick) / 2,
409 (es.ladder_width / 2) / 2,
410 (es.ladder_thick - (es.ceramic_length - es.waf_active) *
sin(es.wedge_angle * 2)) / 2,
411 (es.ladder_thick - (es.ceramic_length - es.waf_active) *
sin(es.wedge_angle * 2)) / 2,
416 if (M <
int(es.types_l5_.size())) {
417 for (
int i = 0;
i <= 1;
i++) {
418 for (
int j = 0;
j <= 3;
j++) {
419 if (es.ladd_l5_map_[(
i +
j * 2 + M * 10)] != 1) {
429 string ddname(
"esalgo:" + es.ladPfx_[0] + es.types_l5_[M]);
430 ladder_length = es.micromodule_length + 4 * es.waf_active + 0.1_mm;
432 if (ladd_not_plain) {
434 ostringstream tmp_name_5b, tmp_name_5c, tmp_name_5d;
439 ostringstream tmp_name_5b, tmp_name_5c, tmp_name_5d;
440 string dd_tmp_name_5a(
"esalgo:" + es.ladPfx_[2]);
441 tmp_name_5b << es.ladPfx_[3] << enb;
442 string dd_tmp_name_5b(
"esalgo:" + tmp_name_5b.str());
443 tmp_name_5c << es.ladPfx_[4] << enb;
444 string dd_tmp_name_5c(
"esalgo:" + tmp_name_5c.str());
445 tmp_name_5d << es.ladPfx_[5] << enb;
446 string dd_tmp_name_5d(
"esalgo:" + tmp_name_5d.str());
448 string dd_tmp_name_5e(
"esalgo:" + es.ladPfx_[6]);
450 boxay = ladder_length - es.LdrFrnt_Length - es.LdrBck_Length;
451 boxax = es.ladder_width;
452 boxaz = es.ladder_thick;
454 Solid solid_5a = Box(dd_tmp_name_5a, boxax / 2, boxay / 2, boxaz / 2.);
456 sdxe[enb] = es.ladder_width / 4;
457 sdye[enb] = -boxay / 2 - es.LdrFrnt_Length / 2;
458 sdze[enb] = -es.ladder_thick / 2. + es.LdrFrnt_Offset;
460 sdxe[enb] = -es.ladder_width / 4;
463 UnionSolid(dd_tmp_name_5b,
466 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdxe[enb], sdye[enb], sdze[enb])));
469 sdxe2[enb] = -es.ladder_width / 4;
470 sdye2[enb] = -boxay / 2 - es.LdrFrnt_Length / 2 + es.waf_active / 2;
471 sdze2[enb] = -es.ladder_thick / 2. + es.LdrFrnt_Offset + (es.waf_active *
sin(es.wedge_angle * 2)) / 4;
473 sdxe2[enb] = es.ladder_width / 4;
476 UnionSolid(dd_tmp_name_5c,
479 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
482 sdye3[enb] = boxay / 2 + es.LdrBck_Length / 2;
483 sdze3[enb] = -es.ladder_thick / 2. + es.LdrBck_Offset;
488 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdxe3[enb], sdye3[enb], sdze3[enb])));
492 string ddname2(
"esalgo:" + es.ladPfx_[1] + es.types_l5_[M]);
498 string dd_tmp_name_5pa(
"esalgo:" + es.ladPfx_[2] +
"5p");
499 string dd_tmp_name_5pb(
"esalgo:" + es.ladPfx_[3] +
"5p");
501 boxay = ladder_length - es.LdrFrnt_Length - es.LdrBck_Length;
502 boxax = es.ladder_width;
503 boxaz = es.ladder_thick;
505 Solid solid_5pa = Box(dd_tmp_name_5pa, boxax / 2, boxay / 2, boxaz / 2.);
507 sdy = -boxay / 2 - es.LdrFrnt_Length / 2;
508 sdz = -es.ladder_thick / 2. + es.LdrFrnt_Offset;
510 Solid solid_5pb = UnionSolid(dd_tmp_name_5pb,
513 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdx, sdy, sdz)));
516 sdy = boxay / 2 + es.LdrBck_Length / 2;
517 sdz = -es.ladder_thick / 2. + es.LdrBck_Offset;
519 Solid solid = UnionSolid(
520 ddname, solid_5pb, solid_lbck, Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdx, sdy, sdz)));
523 string ddname2(
"esalgo:" + es.ladPfx_[1] + es.types_l5_[M]);
531 if (M >=
int(es.types_l5_.size())) {
532 int d = M - es.types_l5_.size();
534 for (
int i = 0;
i <= 1;
i++) {
535 for (
int j = 0;
j <= 3;
j++) {
536 if (es.ladd_l4_map_[(
i +
j * 2 + (M - es.types_l5_.size()) * 8)] != 1) {
546 string ddname(
"esalgo:" + es.ladPfx_[0] + es.types_l4_[d]);
547 ladder_length = es.micromodule_length + 3 * es.waf_active + 0.1_mm;
549 if (ladd_not_plain) {
550 ostringstream tmp_name_b, tmp_name_c, tmp_name_d;
554 string dd_tmp_name_a(
"esalgo:" + es.ladPfx_[7]);
555 tmp_name_b << es.ladPfx_[8] << enb;
556 string dd_tmp_name_b(
"esalgo:" + tmp_name_b.str());
557 tmp_name_c << es.ladPfx_[9] << enb;
558 string dd_tmp_name_c(
"esalgo:" + tmp_name_c.str());
559 tmp_name_d << es.ladPfx_[10] << enb;
560 string dd_tmp_name_d(
"esalgo:" + tmp_name_d.str());
561 string dd_tmp_name_e(
"esalgo:" + es.ladPfx_[11]);
563 boxay = ladder_length - es.LdrFrnt_Length - es.LdrBck_Length;
564 boxax = es.ladder_width;
565 boxaz = es.ladder_thick;
566 Solid solid_a = Box(dd_tmp_name_a, boxax / 2, boxay / 2, boxaz / 2.);
569 sdye[enb] = -boxay / 2 - es.LdrFrnt_Length / 2;
570 sdze[enb] = -es.ladder_thick / 2. + es.LdrFrnt_Offset;
572 UnionSolid(dd_tmp_name_b,
575 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdxe[enb], sdye[enb], sdze[enb])));
578 sdxe2[enb] = es.ladder_width / 4;
579 sdye2[enb] = boxay / 2 + es.LdrBck_Length / 2;
580 sdze2[enb] = -es.ladder_thick / 2. + es.LdrBck_Offset;
582 sdxe2[enb] = -es.ladder_width / 4;
587 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
591 string ddname2(
"esalgo:" + es.ladPfx_[1] + es.types_l4_[d]);
597 if (ladd_subtr_no > 1) {
600 string dd_tmp_name_a(
"esalgo:" + es.ladPfx_[7]);
601 tmp_name_b << es.ladPfx_[8] << enb;
602 string dd_tmp_name_b(
"esalgo:" + tmp_name_b.str());
603 tmp_name_c << es.ladPfx_[9] << enb;
604 string dd_tmp_name_c(
"esalgo:" + tmp_name_c.str());
605 tmp_name_d << es.ladPfx_[10] << enb;
606 string dd_tmp_name_d(
"esalgo:" + tmp_name_d.str());
607 string dd_tmp_name_e(
"esalgo:" + es.ladPfx_[11]);
609 boxay = ladder_length - es.LdrFrnt_Length - es.LdrBck_Length;
610 boxax = es.ladder_width;
611 boxaz = es.ladder_thick;
613 Solid solid_a = Box(dd_tmp_name_a, boxax / 2, boxay / 2, boxaz / 2.);
615 sdxe[enb] = es.ladder_width / 4;
616 sdye[enb] = -boxay / 2 - es.LdrFrnt_Length / 2;
617 sdze[enb] = -es.ladder_thick / 2. + es.LdrFrnt_Offset;
619 sdxe[enb] = -es.ladder_width / 4;
622 UnionSolid(dd_tmp_name_b,
625 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdxe[enb], sdye[enb], sdze[enb])));
628 sdye2[enb] = boxay / 2 + es.LdrBck_Length / 2;
629 sdze2[enb] = -es.ladder_thick / 2. + es.LdrBck_Offset;
635 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
639 string ddname2(
"esalgo:" + es.ladPfx_[1] + es.types_l4_[d]);
644 string dd_tmp_name_a(
"esalgo:" + es.ladPfx_[7]);
645 tmp_name_b << es.ladPfx_[8] << enb;
646 string dd_tmp_name_b(
"esalgo:" + tmp_name_b.str());
647 tmp_name_c << es.ladPfx_[9] << enb;
648 string dd_tmp_name_c(
"esalgo:" + tmp_name_c.str());
649 tmp_name_d << es.ladPfx_[10] << enb;
650 string dd_tmp_name_d(
"esalgo:" + tmp_name_d.str());
651 string dd_tmp_name_e(
"esalgo:" + es.ladPfx_[11]);
653 boxay = ladder_length - es.LdrFrnt_Length - es.LdrBck_Length;
654 boxax = es.ladder_width;
655 boxaz = es.ladder_thick;
656 Solid solid_a = Box(dd_tmp_name_a, boxax / 2, boxay / 2, boxaz / 2.);
658 sdxe[enb] = es.ladder_width / 4;
659 sdye[enb] = -boxay / 2 - es.LdrFrnt_Length / 2;
660 sdze[enb] = -es.ladder_thick / 2. + es.LdrFrnt_Offset;
662 sdxe[enb] = -es.ladder_width / 4;
665 UnionSolid(dd_tmp_name_b,
668 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdxe[enb], sdye[enb], sdze[enb])));
671 sdxe2[enb] = -es.ladder_width / 4;
672 sdye2[enb] = -boxay / 2 - es.LdrFrnt_Length / 2 + es.waf_active / 2;
673 sdze2[enb] = -es.ladder_thick / 2. + es.LdrFrnt_Offset + (es.waf_active *
sin(es.wedge_angle * 2)) / 4;
675 sdxe2[enb] = es.ladder_width / 4;
678 UnionSolid(dd_tmp_name_c,
681 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
684 sdye3[enb] = boxay / 2 + es.LdrBck_Length / 2;
685 sdze3[enb] = -es.ladder_thick / 2. + es.LdrBck_Offset;
690 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdxe3[enb], sdye3[enb], sdze3[enb])));
694 string ddname2(
"esalgo:" + es.ladPfx_[1] + es.types_l4_[d]);
701 string dd_tmp_name_pa(
"esalgo:" + es.ladPfx_[2] +
"p");
702 string dd_tmp_name_pb(
"esalgo:" + es.ladPfx_[3] +
"p");
704 boxay = ladder_length - es.LdrFrnt_Length - es.LdrBck_Length;
705 boxax = es.ladder_width;
706 boxaz = es.ladder_thick;
708 Solid solid_pa = Box(dd_tmp_name_pa, boxax / 2, boxay / 2, boxaz / 2.);
710 sdy = -boxay / 2 - es.LdrFrnt_Length / 2;
711 sdz = -es.ladder_thick / 2. + es.LdrFrnt_Offset;
713 Solid solid_pb = UnionSolid(dd_tmp_name_pb,
716 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdx, sdy, sdz)));
719 sdy = boxay / 2 + es.LdrBck_Length / 2;
720 sdz = -es.ladder_thick / 2. + es.LdrBck_Offset;
721 Solid solid = UnionSolid(
722 ddname, solid_pb, solid_lbck, Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(sdx, sdy, sdz)));
725 string ddname2(
"esalgo:" + es.ladPfx_[1] + es.types_l4_[d]);
733 if (M <
int(es.types_l5_.size())) {
734 string ddname(
"esalgo:" + es.ladPfx_[0] + es.types_l5_[M]);
735 string ddname2(
"esalgo:" + es.ladPfx_[1] + es.types_l5_[M]);
736 for (
int i = 0;
i <= 1;
i++) {
737 for (
int j = 0;
j <= 4;
j++) {
738 xpos = (
i * 2 - 1) * es.waf_intra_col_sep / 2.;
739 ypos = -ladder_length / 2. + 0.05_mm - (es.LdrFrnt_Length - es.LdrBck_Length) / 2 + es.wedge_length / 2. +
741 zpos = -es.ladder_thick / 2. + 0.005_mm + es.wedge_offset;
742 if (es.ladd_l5_map_[(
i +
j * 2 + M * 10)] == 1) {
744 ns.
volume(ddname).placeVolume(swedLog,
745 scopy + 1000 * swed_scopy_glob,
746 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(xpos, ypos, zpos)));
747 ns.
volume(ddname2).placeVolume(swedLog,
748 scopy + 1000 * swed_scopy_glob + 100,
749 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(xpos, ypos, zpos)));
751 ypos = ypos + es.ywedge_ceramic_diff;
752 zpos = -es.ladder_thick / 2. + 0.005_mm + es.zwedge_ceramic_diff;
753 ns.
volume(ddname).placeVolume(sfbxLog,
754 scopy + 1000 * swed_scopy_glob,
755 Transform3D(ns.
rotation(
"esalgo:RM1298"), Position(xpos, ypos, zpos)));
757 ns.
volume(ddname2).placeVolume(sfbyLog,
758 scopy + 1000 * swed_scopy_glob,
759 Transform3D(ns.
rotation(
"esalgo:RM1300A"), Position(xpos, ypos, zpos)));
764 int d = M - es.types_l5_.size();
765 string ddname(
"esalgo:" + es.ladPfx_[0] + es.types_l4_[d]);
766 string ddname2(
"esalgo:" + es.ladPfx_[1] + es.types_l4_[d]);
767 for (
int i = 0;
i <= 1;
i++) {
768 for (
int j = 0;
j <= 3;
j++) {
769 xpos = (
i * 2 - 1) * es.waf_intra_col_sep / 2.;
770 ypos = -ladder_length / 2. + 0.05_mm - (es.LdrFrnt_Length - es.LdrBck_Length) / 2 + es.wedge_length / 2. +
772 zpos = -es.ladder_thick / 2. + 0.005_mm + es.wedge_offset;
773 if (es.ladd_l4_map_[(
i +
j * 2 + (M - es.types_l5_.size()) * 8)] == 1) {
775 ns.
volume(ddname).placeVolume(swedLog,
776 scopy + 1000 * swed_scopy_glob,
777 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(xpos, ypos, zpos)));
778 ns.
volume(ddname2).placeVolume(swedLog,
779 scopy + 1000 * swed_scopy_glob + 100,
780 Transform3D(ns.
rotation(
"esalgo:RM1299"), Position(xpos, ypos, zpos)));
782 ypos = ypos + es.ywedge_ceramic_diff;
783 zpos = -es.ladder_thick / 2. + 0.005_mm + es.zwedge_ceramic_diff;
784 ns.
volume(ddname).placeVolume(sfbxLog,
785 scopy + 1000 * swed_scopy_glob,
786 Transform3D(ns.
rotation(
"esalgo:RM1298"), Position(xpos, ypos, zpos)));
788 ns.
volume(ddname2).placeVolume(sfbyLog,
789 scopy + 1000 * swed_scopy_glob,
790 Transform3D(ns.
rotation(
"esalgo:RM1300A"), Position(xpos, ypos, zpos)));
800 int icopy[100] = {0};
802 for (
int I = -9;
I <= 9; ++
I) {
805 for (
int K = 0; K < es.noLaddInCol_[J]; K++) {
808 ladder_new_length_ = es.micromodule_length + 3 * es.waf_active;
809 ladd_shift_ = 4 * es.waf_active;
812 type = es.typeOfLaddRow0[J];
814 type = es.typeOfLaddRow1[J];
816 type = es.typeOfLaddRow2[J];
818 type = es.typeOfLaddRow3[J];
820 for (
const auto&
i : es.types_l5_)
822 ladder_new_length_ = es.micromodule_length + 4 * es.waf_active;
823 ladd_shift_ = 5 * es.waf_active;
828 for (
int t = 0;
t <
int(es.types_l5_.size());
t++)
829 if (type == es.types_l5_[
t]) {
831 if (
I < 0 && es.asym_ladd_[
t] == 1) {
833 type = es.types_l5_[
j];
836 for (
int t = 0;
t <
int(es.types_l4_.size());
t++)
837 if (type == es.types_l4_[
t]) {
838 j =
t + es.types_l5_.size();
839 if (
I < 0 && es.asym_ladd_[(
t + es.types_l5_.size())] == 1) {
841 type = es.types_l4_[j - es.types_l5_.size()];
845 xpos =
I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
847 xpos = xpos + es.dee_separation;
849 xpos = xpos - es.dee_separation;
852 ypos = (sz -
int(es.startOfFirstLadd_[J])) * es.waf_active - ladder_new_length_ / 2. +
853 (es.LdrFrnt_Length - es.LdrBck_Length) / 2 + es.micromodule_length + 0.05_cm - prev_length_;
855 prev_length_ += ladd_shift_;
857 zpos = es.zlead1_ + es.ladder_thick / 2. + 0.01_mm;
860 string ddname(
"esalgo:" + es.ladPfx_[0] + type);
861 sfLog.placeVolume(ns.
volume(ddname), icopy[
j], Position(xpos, ypos, zpos));
863 string ddname2(
"esalgo:" + es.ladPfx_[1] + type);
864 xpos =
I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
868 Transform3D(ns.
rotation(
"esalgo:R270"), Position(ypos, -xpos, zpos - es.zlead1_ + es.zlead2_)));
871 for (
int t = 0;
t <
int(es.types_l5_.size());
t++)
872 if (type == es.types_l5_[
t]) {
874 if (es.asym_ladd_[
t] == 2 && !changed) {
878 if (es.asym_ladd_[
t] == 1 && !changed) {
882 type = es.types_l5_[
j];
884 for (
int t = 0;
t <
int(es.types_l4_.size());
t++)
885 if (type == es.types_l4_[
t]) {
886 j =
t + es.types_l5_.size();
887 if (es.asym_ladd_[(
t + es.types_l5_.size())] == 2 && !changed) {
891 if (es.asym_ladd_[(
t + es.types_l5_.size())] == 1 && !changed) {
895 type = es.types_l4_[j - es.types_l5_.size()];
901 xpos = xpos + es.dee_separation;
903 xpos = xpos - es.dee_separation;
905 string ddname3(
"esalgo:" + es.ladPfx_[0] + type);
907 ns.
volume(ddname3), icopy[
j], Transform3D(ns.
rotation(
"esalgo:R180"), Position(xpos, -ypos, zpos)));
909 string ddname4(
"esalgo:" + es.ladPfx_[1] + type);
911 xpos =
I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
916 Transform3D(ns.
rotation(
"esalgo:R090"), Position(-ypos, -xpos, zpos - es.zlead1_ + es.zlead2_)));
922 double xpos(0), ypos(0);
928 for (
size_t i = 0;
i < 32; ++
i) {
929 xpos = -es.waf_active / 2. +
i * es.waf_active / 32. + es.waf_active / 64.;
930 sfwxLog.placeVolume(sfsxLog,
i + 1, Position(xpos, 0., 0.));
932 ypos = -es.waf_active / 2. +
i * es.waf_active / 32. + es.waf_active / 64.;
933 sfwyLog.placeVolume(sfsyLog,
i + 1, Position(0., ypos, 0.));
dd4hep::Volume volume(const std::string &name, bool exc=true) const
dd4hep::Volume addVolumeNS(dd4hep::Volume vol) const
Sin< T >::type sin(const T &t)
dd4hep::Volume addVolume(dd4hep::Volume vol) const
Add rotation matrix to current namespace.
dd4hep::Solid solid(const std::string &name) const
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
dd4hep::Material material(const std::string &name) const
const std::complex< double > I
Namespace of DDCMS conversion namespace.
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
const dd4hep::Rotation3D & rotation(const std::string &name) const
static std::atomic< unsigned int > counter
std::vector< double > vecDble(const std::string &nam) const
Shortcut to access vector<double> arguments.
double dble(const std::string &nam) const
Shortcut to access double arguments.
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e, dd4hep::SensitiveDetector &)
std::vector< std::string > vecStr(const std::string &nam) const
Shortcut to access vector<string> arguments.
#define DECLARE_DDCMS_DETELEMENT(name, func)
std::string parentName() const
Access value of rParent child node.
std::string str(const std::string &nam) const
Shortcut to access string arguments.