1 #include "DD4hep/DetFactoryHelper.h"
6 #include "DD4hep/Shapes.h"
21 vector<string> materials;
22 vector<string> layName;
23 vector<string> ladPfx;
24 vector<string> typesL5;
25 vector<string> typesL4;
26 vector<string> typeOfLaddRow0;
27 vector<string> typeOfLaddRow1;
28 vector<string> typeOfLaddRow2;
29 vector<string> typeOfLaddRow3;
31 vector<double> thickLayers;
32 vector<double> abs1stx;
33 vector<double> abs1sty;
34 vector<double> abs2ndx;
35 vector<double> abs2ndy;
36 vector<double> asymLadd;
37 vector<double> rminVec;
38 vector<double> rmaxVec;
39 vector<double> noLaddInCol;
40 vector<double> startOfFirstLadd;
41 vector<double> laddL5map;
42 vector<double> laddL4map;
48 double waf_intra_col_sep;
49 double waf_inter_col_sep;
53 double zwedge_ceramic_diff;
54 double ywedge_ceramic_diff;
57 double dee_separation;
62 double micromodule_length;
65 double absAlX_subtr1_Xshift;
66 double absAlX_subtr1_Yshift;
70 double absAlY_subtr1_Xshift;
71 double absAlY_subtr1_Yshift;
73 double ldrFrnt_Length;
74 double ldrFrnt_Offset;
76 double ceramic_length;
77 double wedge_back_thick;
93 es.asymLadd =
args.vecDble(
"ASYMETRIC_LADDER");
94 es.typesL5 =
args.vecStr(
"TYPES_OF_LADD_L5");
95 es.typesL4 =
args.vecStr(
"TYPES_OF_LADD_L4");
96 es.laddL5map =
args.vecDble(
"LADD_L5_MAP");
97 es.laddL4map =
args.vecDble(
"LADD_L4_MAP");
98 es.noLaddInCol =
args.vecDble(
"NUMB_OF_LADD_IN_COL");
99 es.startOfFirstLadd =
args.vecDble(
"START_OF_1ST_LADD");
100 es.typeOfLaddRow0 =
args.vecStr(
"TYPE_OF_LADD_1");
101 es.typeOfLaddRow1 =
args.vecStr(
"TYPE_OF_LADD_2");
102 es.typeOfLaddRow2 =
args.vecStr(
"TYPE_OF_LADD_3");
103 es.typeOfLaddRow3 =
args.vecStr(
"TYPE_OF_LADD_4");
104 es.thickLayers =
args.vecDble(
"Layers");
105 es.thickness =
args.dble(
"PRESH_Z_TOTAL");
106 es.materials =
args.vecStr(
"LayMat");
107 es.layName =
args.vecStr(
"LayName");
108 es.rmaxVec =
args.vecDble(
"R_MAX");
109 es.rminVec =
args.vecDble(
"R_MIN");
110 es.waf_intra_col_sep =
args.dble(
"waf_intra_col_sep");
111 es.waf_inter_col_sep =
args.dble(
"waf_inter_col_sep");
112 es.waf_active =
args.dble(
"waf_active");
113 es.wedge_length =
args.dble(
"wedge_length");
114 es.wedge_offset =
args.dble(
"wedge_offset");
115 es.zwedge_ceramic_diff =
args.dble(
"zwedge_ceramic_diff");
116 es.ywedge_ceramic_diff =
args.dble(
"ywedge_ceramic_diff");
117 es.ceramic_length =
args.dble(
"ceramic_length");
118 es.wedge_angle =
args.dble(
"wedge_angle");
119 es.wedge_back_thick =
args.dble(
"wedge_back_thick");
120 es.ladder_thick =
args.dble(
"ladder_thick");
121 es.ladder_width =
args.dble(
"ladder_width");
122 es.micromodule_length =
args.dble(
"micromodule_length");
123 es.box_thick =
args.dble(
"box_thick");
124 es.abs1stx =
args.vecDble(
"1ST_ABSX");
125 es.abs1sty =
args.vecDble(
"1ST_ABSY");
126 es.abs2ndx =
args.vecDble(
"2ND_ABSX");
127 es.abs2ndy =
args.vecDble(
"2ND_ABSY");
128 es.ladPfx =
args.vecStr(
"LadPrefix");
129 es.laddMaterial =
args.str(
"LadderMaterial");
130 es.ldrFrnt_Length =
args.dble(
"LdrFrnt_Length");
131 es.ldrFrnt_Offset =
args.dble(
"LdrFrnt_Offset");
132 es.ldrBck_Length =
args.dble(
"LdrBck_Length");
133 es.ldrBck_Offset =
args.dble(
"LdrBck_Offset");
134 es.dee_separation =
args.dble(
"dee_sep");
135 es.in_rad_Abs_Al =
args.dble(
"R_MIN_Abs_Al");
136 es.in_rad_Abs_Pb =
args.dble(
"R_MIN_Abs_Pb");
137 es.rMax_Abs_Al =
args.dble(
"R_MAX_Abs_Al");
138 es.absAlX_X =
args.dble(
"AbsAlX_X");
139 es.absAlX_Y =
args.dble(
"AbsAlX_Y");
140 es.absAlX_subtr1_Xshift =
args.dble(
"AbsAlX_subtr1_Xshift");
141 es.absAlX_subtr1_Yshift =
args.dble(
"AbsAlX_subtr1_Yshift");
142 es.absAlY_X =
args.dble(
"AbsAlY_X");
143 es.absAlY_Y =
args.dble(
"AbsAlY_Y");
144 es.absAlY_subtr1_Xshift =
args.dble(
"AbsAlY_subtr1_Xshift");
145 es.absAlY_subtr1_Yshift =
args.dble(
"AbsAlY_subtr1_Yshift");
149 double zpos = -es.thickness / 2., sdx(0), sdy(0), bdx(0), bdy(0);
151 for (
size_t i = 0;
i < es.thickLayers.size(); ++
i) {
154 double rIn(0), rOut(0), zHalf(0);
157 const string& ddname(
"esalgo:" + es.layName[
i]);
161 rOut = es.rmaxVec[
i];
162 zHalf = es.thickLayers[
i] / 2.;
168 if (
I == 2 ||
I == 28 ||
I == 13 ||
I == 23) {
173 Solid solid = ns.
addSolid(ddname, Tube(ddname, rIn, rOut, zHalf, 0., 360._deg));
181 es.zlead1 = zpos + zHalf;
184 es.zlead2 = zpos + zHalf;
187 if (
I == 10 ||
I == 20) {
190 double outalbx, outalby, shiftR, outalbx2, outalby2, shiftR2;
192 absz =
int(es.abs1stx.size());
194 absz =
int(es.abs2ndx.size());
198 const string& dd_tmp_name_b(
"esalgo:" + es.layName[
i] +
"Lcut");
199 const string& dd_tmp_name_c(
"esalgo:" + es.layName[
i] +
"tmpb");
200 const string& dd_tmp_name_d(
"esalgo:" + es.layName[
i] +
"LinPb");
201 const string& dd_tmp_name_e(
"esalgo:" + es.layName[
i] +
"LinAl");
202 const string& dd_tmp_name_f(
"esalgo:" + es.layName[
i] +
"LOutAlVol");
203 ostringstream tmp_Alname_fin;
204 tmp_Alname_fin << es.layName[
i] <<
"LtmpAl" << absz - 1;
205 string dd_Alname_fin(
"esalgo:" + tmp_Alname_fin.str());
207 const string& dd_Alname_f(
"esalgo:" + es.layName[
i] +
"LOutAl");
208 const string& dd_Alname_g(
"esalgo:" + es.layName[
i] +
"LOutAl2");
209 const string& dd_Alname_h(
"esalgo:" + es.layName[
i] +
"LOutAltmp");
210 const string& dd_Alname_i(
"esalgo:" + es.layName[
i] +
"LOutAltmp2");
211 const string& dd_Alname_j(
"esalgo:" + es.layName[
i] +
"LOutAltmp3");
212 const string& dd_Alname_k(
"esalgo:" + es.layName[
i] +
"LOutAltmp4");
213 const string& dd_Alname_l(
"esalgo:" + es.layName[
i] +
"LOutAltmp5");
214 const string& dd_Alname_m(
"esalgo:" + es.layName[
i] +
"LOutAltmp6");
217 Solid outAl = ns.
addSolid(dd_Alname_f,
219 es.rMax_Abs_Al - 20 * dd4hep::cm,
221 zHalf - 0.1 * dd4hep::mm,
230 outalbx = es.absAlX_X * 0.1;
231 outalby = es.rMax_Abs_Al + 0.1 * dd4hep::mm - es.absAlX_subtr1_Yshift;
232 shiftR = es.absAlX_subtr1_Yshift;
234 outalbx = es.absAlY_X * 0.1;
235 outalby = es.rMax_Abs_Al + 0.1 * dd4hep::mm - es.absAlY_subtr1_Yshift;
236 shiftR = es.absAlY_subtr1_Xshift;
238 Solid outAltmp = ns.
addSolid(dd_Alname_h,
240 outalbx / 2. + 0.1 * dd4hep::mm,
241 outalby / 2. + 0.1 * dd4hep::mm,
242 zHalf + 0.1 * dd4hep::mm));
245 SubtractionSolid(dd_Alname_j, outAl, outAltmp,
Position(outalbx / 2., outalby / 2. + shiftR, 0)));
250 edm::LogVerbatim(
"SFGeomX") << dd_Alname_j <<
" Subtraction " << outAl.name() <<
":" << outAltmp.name()
256 outalby2 = es.absAlX_Y * 0.1;
257 outalbx2 = es.rMax_Abs_Al + 0.1 * dd4hep::mm - es.absAlX_subtr1_Xshift;
258 shiftR2 = es.absAlX_subtr1_Xshift;
260 outalby2 = es.absAlY_Y * 0.1;
261 outalbx2 = es.rMax_Abs_Al + 0.1 * dd4hep::mm - es.absAlY_subtr1_Xshift;
262 shiftR2 = es.absAlY_subtr1_Xshift;
266 Box(dd_Alname_i, outalbx2 / 2. + 0.1 * dd4hep::mm, outalby2 / 2. + 0.1 * dd4hep::mm, zHalf));
270 dd_Alname_k, outAltmp3, outAltmp2,
Position(outalbx2 / 2. + shiftR2, outalby2 / 2., 0)));
272 ns.
addSolid(dd_Alname_l, UnionSolid(dd_Alname_l, outAltmp4, outAltmp4, ns.
rotation(
"esalgo:RABS90")));
274 ns.
addSolid(dd_Alname_m, UnionSolid(dd_Alname_m, outAltmp5, outAltmp4, ns.
rotation(
"esalgo:RABS180B")));
275 ns.
addSolid(dd_Alname_g, UnionSolid(dd_Alname_g, outAltmp6, outAltmp4, ns.
rotation(
"esalgo:R180")));
281 edm::LogVerbatim(
"SFGeomX") << dd_Alname_k <<
" Subtraction " << outAltmp3.name() <<
":" << outAltmp2.name()
284 edm::LogVerbatim(
"SFGeomX") << dd_Alname_l <<
" Union " << outAltmp4.name() <<
":" << outAltmp4.name()
285 <<
" at (0,0,0) rotation esalgo:RABS90";
286 edm::LogVerbatim(
"SFGeomX") << dd_Alname_m <<
" Union " << outAltmp5.name() <<
":" << outAltmp4.name()
287 <<
" at (0,0,0) rotation esalgo:RABS180B";
288 edm::LogVerbatim(
"SFGeomX") << dd_Alname_g <<
" Union " << outAltmp6.name() <<
":" << outAltmp4.name()
289 <<
" at (0,0,0) rotation esalgo:R180";
292 Solid Outer_Al = ns.
solid(dd_Alname_fin);
296 for (
int L = 0;
L < absz; ++
L) {
298 ostringstream tmp_name_b, tmp_name_b2, tmp_FAl_name_c, tmp_FAl_name_d1, tmp_FAl_name_d2, tmp_FAl_name_d3,
300 tmp_name_b << es.layName[
i] <<
"L" << K;
301 tmp_name_b2 << es.layName[
i] <<
"Lb2" << K;
304 tmp_FAl_name_c << es.layName[
i] <<
"LOutAl2";
306 tmp_FAl_name_c << es.layName[
i] <<
"LtmpAl" << K - 1;
308 tmp_FAl_name_d1 << es.layName[
i] <<
"LtmpAl" << K <<
"_1";
309 tmp_FAl_name_d2 << es.layName[
i] <<
"LtmpAl" << K <<
"_2";
310 tmp_FAl_name_d3 << es.layName[
i] <<
"LtmpAl" << K <<
"_3";
311 tmp_FAl_name_d << es.layName[
i] <<
"LtmpAl" << K;
313 const string& dd_tmp_name_b(
"esalgo:" + tmp_name_b.str());
314 const string& dd_tmp_name_b2(
"esalgo:" + tmp_name_b2.str());
315 const string& dd_FAl_name_c(
"esalgo:" + tmp_FAl_name_c.str());
316 const string& dd_FAl_name_d1(
"esalgo:" + tmp_FAl_name_d1.str());
317 const string& dd_FAl_name_d2(
"esalgo:" + tmp_FAl_name_d2.str());
318 const string& dd_FAl_name_d3(
"esalgo:" + tmp_FAl_name_d3.str());
319 const string& dd_FAl_name_d(
"esalgo:" + tmp_FAl_name_d.str());
322 bdx =
abs(es.abs1stx[K]) / 2.;
324 bdx =
abs(es.abs1stx[K] - es.abs1stx[K - 1]) / 2.;
326 if (es.abs1stx[K] < rIn + 30 * dd4hep::cm) {
327 bdy = es.abs1sty[K] / 2. - 30 * dd4hep::cm;
333 bdx =
abs(es.abs2ndx[K]) / 2.;
335 bdx =
abs(es.abs2ndx[K] - es.abs2ndx[K - 1]) / 2.;
339 if ((es.abs2ndx[K] < rIn + 30 * dd4hep::cm) &&
I == 20) {
340 bdy = es.abs2ndy[K] / 2. - 30 * dd4hep::cm;
343 sdx = es.abs1stx[K] - bdx;
345 if (es.abs1stx[K] < rIn + 30 * dd4hep::cm)
346 sdy = es.abs1sty[K] - bdy;
349 sdx = es.abs2ndx[K] - bdx;
352 if ((es.abs2ndx[K] < rIn + 30 * dd4hep::cm) &&
I == 20)
353 sdy = es.abs2ndy[K] - bdy;
356 Solid solid_b = Box(dd_tmp_name_b, bdx, bdy, zHalf);
360 layerFinOutAl.placeVolume(layerb, 1,
Position(sdx, sdy, 0));
361 layerFinOutAl.placeVolume(layerb, 2,
Position(-sdx, sdy, 0));
365 edm::LogVerbatim(
"SFGeom") << layerb.name() <<
" copy 1 in " << layerFinOutAl.name() <<
" at ("
367 edm::LogVerbatim(
"SFGeom") << layerb.name() <<
" copy 2 in " << layerFinOutAl.name() <<
" at ("
372 Solid solid_b2 = ns.
addSolid(dd_tmp_name_b2,
373 Box(dd_tmp_name_b2, bdx + 0.1 * dd4hep::mm, bdy + 0.1 * dd4hep::mm, zHalf));
374 Solid solid_c = ns.
solid(dd_FAl_name_c);
375 ns.
addSolid(dd_FAl_name_d1, UnionSolid(dd_FAl_name_d1, solid_c, solid_b2,
Position(sdx, sdy, 0)));
380 << dd_FAl_name_d1 <<
" Union " << solid_c.name() <<
":" << solid_b2.name() <<
" at ("
384 if (((es.abs1stx[K] < rIn + 30 * dd4hep::cm) &&
I == 10) ||
385 ((es.abs2ndx[K] < rIn + 30 * dd4hep::cm) &&
I == 20)) {
389 layerFinOutAl.placeVolume(layerb, 3,
Position(sdx, -sdy, 0));
390 layerFinOutAl.placeVolume(layerb, 4,
Position(-sdx, -sdy, 0));
392 edm::LogVerbatim(
"SFGeom") << layerb.name() <<
" copy 3 in " << layerFinOutAl.name() <<
" at ("
395 << layerb.name() <<
" copy 4 in " << layerFinOutAl.name() <<
" at (" << -
cms::convert2mm(sdx) <<
","
400 const Solid& solid_d1 = ns.
solid(dd_FAl_name_d1);
401 const Solid& solid_b2 = ns.
solid(dd_tmp_name_b2);
403 ns.
addSolid(dd_FAl_name_d2, UnionSolid(dd_FAl_name_d2, solid_d1, solid_b2,
Position(sdx, -sdy, 0)));
404 Solid solid_d3 = UnionSolid(dd_FAl_name_d3, solid_d2, solid_b2,
Position(-sdx, sdy, 0));
405 ns.
addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d3, solid_b2,
Position(-sdx, -sdy, 0)));
408 << dd_FAl_name_d2 <<
" Union " << solid_d1.name() <<
":" << solid_b2.name() <<
" at ("
411 << dd_FAl_name_d3 <<
" Union " << solid_d2.name() <<
":" << solid_b2.name() <<
" at ("
414 << dd_FAl_name_d <<
" Union " << solid_d3.name() <<
":" << solid_b2.name() <<
" at ("
418 }
else if (
step == 0) {
419 const Solid& solid_d1 = ns.
solid(dd_FAl_name_d1);
420 const Solid& solid_b2 = ns.
solid(dd_tmp_name_b2);
421 ns.
addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d1, solid_b2,
Position(-sdx, -sdy, 0)));
425 bdx = es.abs1stx[cutabsx];
427 bdx = es.abs2ndx[cutabsy];
428 bdy = 2 * 30 * dd4hep::cm;
431 Solid solidcut = Box(dd_tmp_name_b, bdx, bdy, zHalf);
432 Solid iner = Tube(dd_tmp_name_c, 0, es.in_rad_Abs_Pb, zHalf + 0.1 * dd4hep::mm, 0., 360._deg);
433 Solid
final = SubtractionSolid(dd_tmp_name_d, solidcut, iner);
439 edm::LogVerbatim(
"SFGeomX") << dd_tmp_name_d <<
" Subtraction " << solidcut.name() <<
":" << iner.name()
440 <<
" at (0,0,0) no rotation";
444 parentVolume.placeVolume(blayer, 1,
Position(0, 0, zpos));
446 edm::LogVerbatim(
"SFGeom") << blayer.name() <<
" copy 1 in " << parentVolume.name() <<
" at (0,0,"
451 Tube(dd_tmp_name_e, es.in_rad_Abs_Al, es.in_rad_Abs_Pb - 0.01 * dd4hep::mm, zHalf, 0., 360._deg);
458 parentVolume.placeVolume(layerAl, 1,
Position(0, 0, zpos));
460 parentVolume.placeVolume(layerFinOutAl, 1,
Position(0, 0, zpos));
462 edm::LogVerbatim(
"SFGeom") << layerAl.name() <<
" copy 1 in " << parentVolume.name() <<
" at (0,0,"
464 edm::LogVerbatim(
"SFGeom") << layerFinOutAl.name() <<
" copy 1 in " << parentVolume.name() <<
" at (0,0,"
481 double xpos(0.), ypos(0.), zpos(0.);
482 double prev_length(0.), ladder_new_length(0.);
483 double ladd_shift(0.);
484 double ladder_length(0.);
485 int swed_scopy_glob(0);
487 for (
int M = 0; M <
int(es.typesL5.size() + es.typesL4.size()); M++) {
489 int ladd_not_plain(0), ladd_subtr_no(0), ladd_upper(0);
493 if (M <
int(es.typesL5.size())) {
494 for (
int i = 0;
i <= 1;
i++) {
495 for (
int j = 0;
j <= 3;
j++) {
496 if (es.laddL5map[(
i +
j * 2 + M * 10)] != 1) {
506 <<
":" << ladd_upper <<
":" << ladd_subtr_no <<
":" << ladd_not_plain <<
" Index "
507 << M <<
":" << es.typesL5.size();
509 const string& ddname(
"esalgo:" + es.ladPfx[0] + es.typesL5[M]);
510 ladder_length = es.micromodule_length + 4 * es.waf_active + 0.1 * dd4hep::mm;
512 if (ladd_not_plain) {
515 ns.
addAssembly(
"esalgo:" + es.ladPfx[1] + es.typesL5[M]);
520 ns.
addAssembly(
"esalgo:" + es.ladPfx[1] + es.typesL5[M]);
526 if (M >=
int(es.typesL5.size())) {
527 int d = M - es.typesL5.size();
529 for (
int i = 0;
i <= 1;
i++) {
530 for (
int j = 0;
j <= 3;
j++) {
531 if (es.laddL4map[(
i +
j * 2 + (M - es.typesL5.size()) * 8)] != 1) {
541 <<
":" << ladd_upper <<
":" << ladd_subtr_no <<
":" << ladd_not_plain <<
" Index "
542 << M <<
":" << es.typesL5.size();
544 const string& ddname(
"esalgo:" + es.ladPfx[0] + es.typesL4[
d]);
545 ladder_length = es.micromodule_length + 3 * es.waf_active + 0.1 * dd4hep::mm;
547 if (ladd_not_plain) {
550 ns.
addAssembly(
"esalgo:" + es.ladPfx[1] + es.typesL4[
d]);
553 if (ladd_subtr_no > 1) {
555 ns.
addAssembly(
"esalgo:" + es.ladPfx[1] + es.typesL4[
d]);
558 ns.
addAssembly(
"esalgo:" + es.ladPfx[1] + es.typesL4[
d]);
564 ns.
addAssembly(
"esalgo:" + es.ladPfx[1] + es.typesL4[
d]);
570 if (M <
int(es.typesL5.size())) {
571 const string& ddname(
"esalgo:" + es.ladPfx[0] + es.typesL5[M]);
572 const string& ddname2(
"esalgo:" + es.ladPfx[1] + es.typesL5[M]);
573 for (
int i = 0;
i <= 1;
i++) {
574 for (
int j = 0;
j <= 4;
j++) {
575 xpos = (
i * 2 - 1) * es.waf_intra_col_sep / 2.;
576 ypos = -ladder_length / 2. + 0.05 * dd4hep::mm - (es.ldrFrnt_Length - es.ldrBck_Length) / 2. +
577 es.wedge_length / 2. +
j * es.waf_active;
578 zpos = -es.ladder_thick / 2. + 0.005 * dd4hep::mm + es.wedge_offset;
579 if (es.laddL5map[(
i +
j * 2 + M * 10)] == 1) {
581 ns.
assembly(ddname).placeVolume(swedLog,
582 scopy + 1000 * swed_scopy_glob,
584 ns.
assembly(ddname2).placeVolume(swedLog,
585 scopy + 1000 * swed_scopy_glob + 100,
588 edm::LogVerbatim(
"SFGeom") << swedLog.name() <<
" copy " << (scopy + 1000 * swed_scopy_glob) <<
" in "
591 edm::LogVerbatim(
"SFGeom") << swedLog.name() <<
" copy " << (scopy + 1000 * swed_scopy_glob + 100)
594 <<
") rotation esalgo:RM1299";
597 ypos = ypos + es.ywedge_ceramic_diff;
598 zpos = -es.ladder_thick / 2. + 0.005 * dd4hep::mm + es.zwedge_ceramic_diff;
599 ns.
assembly(ddname).placeVolume(sfbxLog,
600 scopy + 1000 * swed_scopy_glob,
602 ns.
assembly(ddname2).placeVolume(sfbyLog,
603 scopy + 1000 * swed_scopy_glob,
606 edm::LogVerbatim(
"SFGeom") << sfbxLog.name() <<
" copy " << (scopy + 1000 * swed_scopy_glob) <<
" in "
609 edm::LogVerbatim(
"SFGeom") << sfbyLog.name() <<
" copy " << (scopy + 1000 * swed_scopy_glob) <<
" in "
617 int d = M - es.typesL5.size();
618 const string& ddname(
"esalgo:" + es.ladPfx[0] + es.typesL4[
d]);
619 const string& ddname2(
"esalgo:" + es.ladPfx[1] + es.typesL4[
d]);
620 for (
int i = 0;
i <= 1;
i++) {
621 for (
int j = 0;
j <= 3;
j++) {
622 xpos = (
i * 2 - 1) * es.waf_intra_col_sep / 2.;
623 ypos = -ladder_length / 2. + 0.05 * dd4hep::mm - (es.ldrFrnt_Length - es.ldrBck_Length) / 2. +
624 es.wedge_length / 2. +
j * es.waf_active;
625 zpos = -es.ladder_thick / 2. + 0.005 * dd4hep::mm + es.wedge_offset;
626 if (es.laddL4map[(
i +
j * 2 + (M - es.typesL5.size()) * 8)] == 1) {
628 ns.
assembly(ddname).placeVolume(swedLog,
629 scopy + 1000 * swed_scopy_glob,
631 ns.
assembly(ddname2).placeVolume(swedLog,
632 scopy + 1000 * swed_scopy_glob + 100,
635 edm::LogVerbatim(
"SFGeom") << swedLog.name() <<
" copy " << (scopy + 1000 * swed_scopy_glob) <<
" in "
638 edm::LogVerbatim(
"SFGeom") << swedLog.name() <<
" copy " << (scopy + 1000 * swed_scopy_glob + 100)
641 <<
") rotation esalgo:RM1299";
644 ypos = ypos + es.ywedge_ceramic_diff;
645 zpos = -es.ladder_thick / 2. + 0.005 * dd4hep::mm + es.zwedge_ceramic_diff;
646 ns.
assembly(ddname).placeVolume(sfbxLog,
647 scopy + 1000 * swed_scopy_glob,
649 ns.
assembly(ddname2).placeVolume(sfbyLog,
650 scopy + 1000 * swed_scopy_glob,
653 edm::LogVerbatim(
"SFGeom") << sfbxLog.name() <<
" copy " << (scopy + 1000 * swed_scopy_glob) <<
" in "
656 edm::LogVerbatim(
"SFGeom") << sfbyLog.name() <<
" copy " << (scopy + 1000 * swed_scopy_glob) <<
" in "
667 int icopy[100] = {0};
668 constexpr
int sz = 20;
670 for (
int I = -9;
I <= 9; ++
I) {
673 for (
int K = 0; K < es.noLaddInCol[J]; K++) {
676 ladder_new_length = es.micromodule_length + 3. * es.waf_active;
677 ladd_shift = 4. * es.waf_active;
680 type = es.typeOfLaddRow0[J];
682 type = es.typeOfLaddRow1[J];
684 type = es.typeOfLaddRow2[J];
686 type = es.typeOfLaddRow3[J];
688 for (
const auto&
i : es.typesL5)
690 ladder_new_length = es.micromodule_length + 4. * es.waf_active;
691 ladd_shift = 5. * es.waf_active;
696 for (
int t = 0;
t <
int(es.typesL5.size());
t++)
697 if (
type == es.typesL5[
t]) {
699 if (
I < 0 && es.asymLadd[
t] == 1) {
701 type = es.typesL5[
j];
704 for (
int t = 0;
t <
int(es.typesL4.size());
t++)
705 if (
type == es.typesL4[
t]) {
706 j =
t + es.typesL5.size();
707 if (
I < 0 && es.asymLadd[(
t + es.typesL5.size())] == 1) {
709 type = es.typesL4[
j - es.typesL5.size()];
713 xpos =
I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
715 xpos = xpos + es.dee_separation;
717 xpos = xpos - es.dee_separation;
719 ypos = (sz -
int(es.startOfFirstLadd[J])) * es.waf_active - ladder_new_length / 2. +
720 (es.ldrFrnt_Length - es.ldrBck_Length) / 2. + es.micromodule_length + 0.05 * dd4hep::cm - prev_length;
722 prev_length += ladd_shift;
724 zpos = es.zlead1 + es.ladder_thick / 2. + 0.01 * dd4hep::mm;
727 sfLog.placeVolume(ns.
assembly(
"esalgo:" + es.ladPfx[0] +
type), icopy[
j],
Position(xpos, ypos, zpos));
734 xpos =
I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
735 sfLog.placeVolume(ns.
assembly(
"esalgo:" + es.ladPfx[1] +
type),
737 Transform3D(ns.
rotation(
"esalgo:R270"),
Position(ypos, -xpos, zpos - es.zlead1 + es.zlead2)));
741 <<
"," <<
cms::convert2mm(zpos - es.zlead1 + es.zlead2) <<
") rotation esalgo:R270";
745 for (
int t = 0;
t <
int(es.typesL5.size());
t++)
746 if (
type == es.typesL5[
t]) {
748 if (es.asymLadd[
t] == 2 && !changed) {
752 if (es.asymLadd[
t] == 1 && !changed) {
756 type = es.typesL5[
j];
758 for (
int t = 0;
t <
int(es.typesL4.size());
t++)
759 if (
type == es.typesL4[
t]) {
760 j =
t + es.typesL5.size();
761 if (es.asymLadd[(
t + es.typesL5.size())] == 2 && !changed) {
765 if (es.asymLadd[(
t + es.typesL5.size())] == 1 && !changed) {
769 type = es.typesL4[
j - es.typesL5.size()];
775 xpos = xpos + es.dee_separation;
777 xpos = xpos - es.dee_separation;
779 sfLog.placeVolume(ns.
assembly(
"esalgo:" + es.ladPfx[0] +
type),
788 xpos =
I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
793 Transform3D(ns.
rotation(
"esalgo:R090"),
Position(-ypos, -xpos, zpos - es.zlead1 + es.zlead2)));
797 <<
"," <<
cms::convert2mm(zpos - es.zlead1 + es.zlead2) <<
") rotation esalgo:R090";
804 double xpos(0), ypos(0);
810 for (
size_t i = 0;
i < 32; ++
i) {
811 xpos = -es.waf_active / 2. +
i * es.waf_active / 32. + es.waf_active / 64.;
812 sfwxLog.placeVolume(sfsxLog,
i + 1,
Position(xpos, 0., 0.));
814 edm::LogVerbatim(
"SFGeom") << sfsxLog.name() <<
" copy " << (
i + 1) <<
" in " << sfwxLog.name() <<
" at ("
818 ypos = -es.waf_active / 2. +
i * es.waf_active / 32. + es.waf_active / 64.;
819 sfwyLog.placeVolume(sfsyLog,
i + 1,
Position(0., ypos, 0.));
821 edm::LogVerbatim(
"SFGeom") << sfsyLog.name() <<
" copy " << (
i + 1) <<
" in " << sfwyLog.name() <<
" at (0,"