CMS 3D CMS Logo

Functions
DDEcalPreshowerAlgo.cc File Reference
#include "DD4hep/DetFactoryHelper.h"
#include "DetectorDescription/DDCMS/interface/DDPlugins.h"
#include "DetectorDescription/DDCMS/interface/BenchmarkGrd.h"
#include "DataFormats/Math/interface/CMSUnits.h"
#include "DD4hep/Shapes.h"
#include <string>
#include <vector>

Go to the source code of this file.

Functions

static long algorithm (dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e)
 
 DD4HEP_OPEN_PLUGIN (dd4hep, ddcms_det_element_DDCMS_ecal_DDEcalPreshowerAlgo)
 

Function Documentation

◆ algorithm()

static long algorithm ( dd4hep::Detector &  ,
cms::DDParsingContext ctxt,
xml_h  e 
)
static

Definition at line 78 of file DDEcalPreshowerAlgo.cc.

78  {
79  BenchmarkGrd counter("DDEcalPreshowerAlgo");
80  cms::DDNamespace ns(ctxt, e, true);
82 
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");
88 
89  EcalPreshower es;
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"); // inner radii
106  es.rminVec = args.vecDble("R_MIN"); // outer radii
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");
143 
144  // create all the tube-like layers of the preshower
145  {
146  double zpos = -es.thickness / 2., sdx(0), sdy(0), bdx(0), bdy(0);
147 
148  for (size_t i = 0; i < es.thickLayers.size(); ++i) {
149  int I = int(i) + 1; // FOTRAN I (offset +1)
150 
151  double rIn(0), rOut(0), zHalf(0);
152 
153  // create the name
154  const string& ddname("esalgo:" + es.layName[i]); // namespace:name
155 
156  // cone dimensions
157  rIn = es.rminVec[i];
158  rOut = es.rmaxVec[i];
159  zHalf = es.thickLayers[i] / 2.;
160 
161  // create a logical part representing a single layer in the preshower
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])));
164 
165  // position the logical part w.r.t. the parent volume
166  zpos += zHalf;
167 
168  // create a logical part representing a single layer in the preshower
169  // skip layers with detectors, front and rear window
170  if (I == 2 || I == 28 || I == 13 || I == 23) {
171  zpos += zHalf;
172  continue;
173  }
174 
175  if (I == 12) {
176  es.zlead1 = zpos + zHalf;
177  }
178  if (I == 22) {
179  es.zlead2 = zpos + zHalf;
180  }
181 
182  if (I == 10 || I == 20) { // New lead shape
183 
184  int absz = 0;
185  double outalbx, outalby, shiftR, outalbx2, outalby2, shiftR2;
186 
187  absz = int(es.abs1stx.size());
188  if (I == 20)
189  absz = int(es.abs2ndx.size());
190  int cutabsx = -1;
191  int cutabsy = -1;
192 
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");
198 
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");
207 
208  Solid outAl =
209  ns.addSolid(dd_Alname_f, Tube(dd_Alname_f, es.rMax_Abs_Al - 70_cm, es.rMax_Abs_Al, zHalf, 0., 90._deg));
210 
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;
214  if (I == 20) {
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;
218  }
219  Solid outAltmp =
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(
222  dd_Alname_j,
223  SubtractionSolid(dd_Alname_j, outAl, outAltmp, Position(outalbx / 2., outalby / 2. + shiftR, 0)));
224 
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;
228  if (I == 20) {
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;
232  }
233  Solid outAltmp2 =
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(
236  dd_Alname_k,
237  SubtractionSolid(dd_Alname_k, outAltmp3, outAltmp2, Position(outalbx2 / 2. + shiftR2, outalby2 / 2., 0)));
238  Solid outAltmp5 =
239  ns.addSolid(dd_Alname_l, UnionSolid(dd_Alname_l, outAltmp4, outAltmp4, ns.rotation("esalgo:RABS90")));
240  Solid outAltmp6 =
241  ns.addSolid(dd_Alname_m, UnionSolid(dd_Alname_m, outAltmp5, outAltmp4, ns.rotation("esalgo:RABS180B")));
242  Solid outAl2 =
243  ns.addSolid(dd_Alname_g, UnionSolid(dd_Alname_g, outAltmp6, outAltmp4, ns.rotation("esalgo:R180")));
244 
245  Solid outAlCut = Box(65_cm, 60_cm - 0.1_mm, zHalf + 0.2_mm);
246  Solid outAlFin = SubtractionSolid(outAl2, outAlCut);
247 
248  Volume layerFinOutAl = Volume(dd_tmp_name_f, outAlFin, ns.material(es.materials[i - 1]));
249 
250  for (int L = 0; L < absz; ++L) {
251  int K = 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,
253  tmp_FAl_name_d;
254  tmp_name_b << es.layName[i] << "L" << K;
255  tmp_name_b2 << es.layName[i] << "Lb2" << K;
256 
257  if (L == 0)
258  tmp_FAl_name_c << es.layName[i] << "LOutAl2";
259  if (L > 0)
260  tmp_FAl_name_c << es.layName[i] << "LtmpAl" << K - 1;
261 
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;
266 
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());
274 
275  if (L == 0)
276  bdx = abs(es.abs1stx[K]) / 2.;
277  if (L > 0)
278  bdx = abs(es.abs1stx[K] - es.abs1stx[K - 1]) / 2.;
279  bdy = es.abs1sty[K];
280  if (es.abs1stx[K] < rIn + 30_cm) {
281  bdy = es.abs1sty[K] / 2. - 30_cm;
282  cutabsx = K;
283  }
284 
285  if (I == 20) {
286  if (L == 0)
287  bdx = abs(es.abs2ndx[K]) / 2.;
288  if (L > 0)
289  bdx = abs(es.abs2ndx[K] - es.abs2ndx[K - 1]) / 2.;
290  bdy = es.abs2ndy[K];
291  }
292 
293  if ((es.abs2ndx[K] < rIn + 30_cm) && I == 20) {
294  bdy = es.abs2ndy[K] / 2. - 30_cm;
295  cutabsy = K;
296  }
297 
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);
300 
301  sdx = es.abs1stx[K] - bdx;
302  sdy = 0;
303  if (es.abs1stx[K] < rIn + 30_cm)
304  sdy = es.abs1sty[K] - bdy;
305 
306  if (I == 20) {
307  sdx = es.abs2ndx[K] - bdx;
308  sdy = 0;
309  }
310  if ((es.abs2ndx[K] < rIn + 30_cm) && I == 20)
311  sdy = es.abs2ndy[K] - bdy;
312 
313  Volume layer = Volume(dd_tmp_name_b, solid_b, ns.material(es.materials[i]));
314 
315  layerFinOutAl.placeVolume(layer, 1, Position(sdx, sdy, 0));
316  layerFinOutAl.placeVolume(layer, 2, Position(-sdx, sdy, 0));
317 
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));
320  Solid solid_d2 =
321  ns.addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d1, solid_b2, Position(-sdx, -sdy, 0)));
322 
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));
326 
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)));
332  }
333  }
334 
335  bdx = es.abs1stx[cutabsx];
336  if (I == 20)
337  bdx = es.abs2ndx[cutabsy];
338  bdy = 2 * 30_cm;
339 
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);
343 
344  Volume blayer = Volume(dd_tmp_name_d, final, ns.material(es.materials[i]));
345  parentVolume.placeVolume(blayer, 1, Position(0, 0, zpos));
346 
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));
351  } else {
352  parentVolume.placeVolume(layer, 1, Position(0., 0., zpos));
353  }
354  zpos += zHalf;
355  }
356  }
357  // create and place the ladders
358  {
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};
366 
367  for (int M = 0; M < int(es.typesL5.size() + es.typesL4.size()); M++) {
368  int scopy(0);
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., // pDz
373  -es.wedge_angle, // pTheta
374  0, // pPhi
375  es.ladder_width / 2., // pDy1
376  (es.ladder_thick) / 2., // pDx1
377  (es.ladder_thick) / 2., // pDx2
378  0, // pAlp1
379  es.ladder_width / 2., // pDy2
380  (es.ladder_thick - es.ceramic_length * sin(es.wedge_angle * 2.)) / 2., // pDx3
381  (es.ladder_thick - es.ceramic_length * sin(es.wedge_angle * 2.)) / 2., // pDx4
382  0.);
383 
384  Solid solid_lbck = Trap("esalgo:LDRBCK",
385  es.ldrBck_Length / 2., // pDz
386  -es.wedge_angle, // pTheta
387  0, // pPhi
388  es.ladder_width / 2., // pDy1
389  (es.box_thick / cos(es.wedge_angle * 2) + 0.02_mm) / 2., // pDx1
390  (es.box_thick / cos(es.wedge_angle * 2) + 0.02_mm) / 2., // pDx2
391  0, // pAlp1
392  es.ladder_width / 2., // pDy2
393  (es.ladder_thick - es.wedge_back_thick) / 2., // pDx3
394  (es.ladder_thick - es.wedge_back_thick) / 2., // pDx4
395  0.);
396 
397  Solid solid_lfhalf = Trap("esalgo:LDRFHALF",
398  es.ldrFrnt_Length / 2., // pDz
399  -es.wedge_angle, // pTheta
400  0, // pPhi
401  (es.ladder_width / 2.) / 2., // pDy1
402  (es.ladder_thick) / 2., // pDx1
403  (es.ladder_thick) / 2., // pDx2
404  0, // pAlp1
405  (es.ladder_width / 2.) / 2., // pDy2
406  (es.ladder_thick - es.ceramic_length * sin(es.wedge_angle * 2.)) / 2., // pDx3
407  (es.ladder_thick - es.ceramic_length * sin(es.wedge_angle * 2.)) / 2., // pDx4
408  0.);
409 
410  Solid solid_lbhalf = Trap("esalgo:LDRBHALF",
411  es.ldrBck_Length / 2., // pDz
412  -es.wedge_angle, // pTheta
413  0, // pPhi
414  (es.ladder_width / 2.) / 2., // pDy1
415  (es.box_thick / cos(es.wedge_angle * 2.) + 0.02_mm) / 2., // pDx1
416  (es.box_thick / cos(es.wedge_angle * 2.) + 0.02_mm) / 2., // pDx2
417  0, // pAlp1
418  (es.ladder_width / 2.) / 2., // pDy2
419  (es.ladder_thick - es.wedge_back_thick) / 2., // pDx3
420  (es.ladder_thick - es.wedge_back_thick) / 2., // pDx4
421  0.);
422 
423  Solid solid_lfhtrunc =
424  Trap("esalgo:LDRFHTR",
425  (es.ldrFrnt_Length - es.waf_active) / 2., // pDz
426  -es.wedge_angle, // pTheta
427  0, // pPhi
428  (es.ladder_width / 2.) / 2., // pDy1
429  (es.ladder_thick) / 2., // pDx1
430  (es.ladder_thick) / 2., // pDx2
431  0, // pAlp1
432  (es.ladder_width / 2.) / 2., // pDy2
433  (es.ladder_thick - (es.ceramic_length - es.waf_active) * sin(es.wedge_angle * 2)) / 2., // pDx3
434  (es.ladder_thick - (es.ceramic_length - es.waf_active) * sin(es.wedge_angle * 2)) / 2., // pDx4
435  0.);
436 
437  // Creation of ladders with 5 micromodules length
438 
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) {
443  ladd_not_plain = 1;
444  ladd_subtr_no++;
445  if (j > 1)
446  ladd_upper = 1;
447  }
448  }
449  }
450 
451  const string& ddname("esalgo:" + es.ladPfx[0] + es.typesL5[M]);
452  ladder_length = es.micromodule_length + 4 * es.waf_active + 0.1_mm;
453 
454  if (ladd_not_plain) {
455  if (!ladd_upper) {
456  enb++;
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));
460 
461  boxay = ladder_length - es.ldrFrnt_Length - es.ldrBck_Length;
462  boxax = es.ladder_width;
463  boxaz = es.ladder_thick;
464 
465  Solid solid_5a = Box(dd_tmp_name_5a, boxax / 2., boxay / 2., boxaz / 2.);
466  if (ladd_side == 0)
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;
470  if (ladd_side == 1)
471  sdxe[enb] = -es.ladder_width / 4.;
472 
473  Solid solid_5b =
474  UnionSolid(dd_tmp_name_5b,
475  solid_5a,
476  solid_lfhalf,
477  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdxe[enb], sdye[enb], sdze[enb])));
478 
479  if (ladd_side == 0)
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.;
483  if (ladd_side == 1)
484  sdxe2[enb] = es.ladder_width / 4.;
485 
486  Solid solid_5c =
487  UnionSolid(dd_tmp_name_5c,
488  solid_5b,
489  solid_lfhtrunc,
490  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
491 
492  sdxe3[enb] = 0;
493  sdye3[enb] = boxay / 2. + es.ldrBck_Length / 2.;
494  sdze3[enb] = -es.ladder_thick / 2. + es.ldrBck_Offset;
495  Solid solid =
496  UnionSolid(ddname,
497  solid_5c,
498  solid_lbck,
499  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdxe3[enb], sdye3[enb], sdze3[enb])));
500 
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)));
503  }
504  } // end of not plain ladder shape
505  else {
506  const string& dd_tmp_name_5pa("esalgo:" + es.ladPfx[2] + "5p");
507  const string& dd_tmp_name_5pb("esalgo:" + es.ladPfx[3] + "5p");
508 
509  boxay = ladder_length - es.ldrFrnt_Length - es.ldrBck_Length;
510  boxax = es.ladder_width;
511  boxaz = es.ladder_thick;
512 
513  Solid solid_5pa = Box(dd_tmp_name_5pa, boxax / 2., boxay / 2., boxaz / 2.);
514  sdx = 0;
515  sdy = -boxay / 2. - es.ldrFrnt_Length / 2.;
516  sdz = -es.ladder_thick / 2. + es.ldrFrnt_Offset;
517 
518  Solid solid_5pb = UnionSolid(dd_tmp_name_5pb,
519  solid_5pa,
520  solid_lfront,
521  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdx, sdy, sdz)));
522 
523  sdx = 0;
524  sdy = boxay / 2. + es.ldrBck_Length / 2.;
525  sdz = -es.ladder_thick / 2. + es.ldrBck_Offset;
526 
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)));
531  }
532  }
533 
534  // Creation of ladders with 4 micromodules length
535 
536  if (M >= int(es.typesL5.size())) {
537  int d = M - es.typesL5.size();
538 
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) {
542  ladd_not_plain = 1;
543  ladd_subtr_no++;
544  if (j > 1)
545  ladd_upper = 1;
546  }
547  }
548  }
549 
550  const string& ddname("esalgo:" + es.ladPfx[0] + es.typesL4[d]);
551  ladder_length = es.micromodule_length + 3 * es.waf_active + 0.1_mm;
552 
553  if (ladd_not_plain) {
554  if (ladd_upper) {
555  enb++;
556 
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));
559 
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.);
564 
565  sdxe[enb] = 0;
566  sdye[enb] = -boxay / 2. - es.ldrFrnt_Length / 2.;
567  sdze[enb] = -es.ladder_thick / 2. + es.ldrFrnt_Offset;
568  Solid solid_b =
569  UnionSolid(dd_tmp_name_b,
570  solid_a,
571  solid_lfront,
572  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdxe[enb], sdye[enb], sdze[enb])));
573 
574  if (ladd_side == 0)
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;
578  if (ladd_side == 1)
579  sdxe2[enb] = -es.ladder_width / 4.;
580  Solid solid =
581  UnionSolid(ddname,
582  solid_b,
583  solid_lbhalf,
584  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
585 
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)));
588 
589  } // upper
590  else {
591  if (ladd_subtr_no > 1) {
592  enb++;
593 
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));
596 
597  boxay = ladder_length - es.ldrFrnt_Length - es.ldrBck_Length;
598  boxax = es.ladder_width;
599  boxaz = es.ladder_thick;
600 
601  Solid solid_a = Box(dd_tmp_name_a, boxax / 2., boxay / 2., boxaz / 2.);
602  if (ladd_side == 0)
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;
606  if (ladd_side == 1)
607  sdxe[enb] = -es.ladder_width / 4.;
608 
609  Solid solid_b =
610  UnionSolid(dd_tmp_name_b,
611  solid_a,
612  solid_lfhalf,
613  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdxe[enb], sdye[enb], sdze[enb])));
614 
615  sdxe2[enb] = 0;
616  sdye2[enb] = boxay / 2. + es.ldrBck_Length / 2.;
617  sdze2[enb] = -es.ladder_thick / 2. + es.ldrBck_Offset;
618 
619  Solid solid =
620  UnionSolid(ddname,
621  solid_b,
622  solid_lbck,
623  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
624 
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)));
627  } else {
628  enb++;
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));
632 
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.);
637  if (ladd_side == 0)
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;
641  if (ladd_side == 1)
642  sdxe[enb] = -es.ladder_width / 4.;
643 
644  Solid solid_b =
645  UnionSolid(dd_tmp_name_b,
646  solid_a,
647  solid_lfhalf,
648  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdxe[enb], sdye[enb], sdze[enb])));
649 
650  if (ladd_side == 0)
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.;
654  if (ladd_side == 1)
655  sdxe2[enb] = es.ladder_width / 4.;
656 
657  Solid solid_c =
658  UnionSolid(dd_tmp_name_c,
659  solid_b,
660  solid_lfhtrunc,
661  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdxe2[enb], sdye2[enb], sdze2[enb])));
662 
663  sdxe3[enb] = 0;
664  sdye3[enb] = boxay / 2. + es.ldrBck_Length / 2.;
665  sdze3[enb] = -es.ladder_thick / 2. + es.ldrBck_Offset;
666  Solid solid =
667  UnionSolid(ddname,
668  solid_c,
669  solid_lbck,
670  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdxe3[enb], sdye3[enb], sdze3[enb])));
671 
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)));
674  }
675  }
676  } // end of not plain ladder shape
677  else {
678  const string& dd_tmp_name_pa("esalgo:" + es.ladPfx[2] + "p");
679  const string& dd_tmp_name_pb("esalgo:" + es.ladPfx[3] + "p");
680 
681  boxay = ladder_length - es.ldrFrnt_Length - es.ldrBck_Length;
682  boxax = es.ladder_width;
683  boxaz = es.ladder_thick;
684 
685  Solid solid_pa = Box(dd_tmp_name_pa, boxax / 2., boxay / 2., boxaz / 2.);
686  sdx = 0;
687  sdy = -boxay / 2. - es.ldrFrnt_Length / 2.;
688  sdz = -es.ladder_thick / 2. + es.ldrFrnt_Offset;
689 
690  Solid solid_pb = UnionSolid(dd_tmp_name_pb,
691  solid_pa,
692  solid_lfront,
693  Transform3D(ns.rotation("esalgo:RM1299"), Position(sdx, sdy, sdz)));
694 
695  sdx = 0;
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)));
702  }
703  }
704 
705  // insert SWED, SFBX and SFBY into ladders
706  swed_scopy_glob++;
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. +
714  j * es.waf_active;
715  zpos = -es.ladder_thick / 2. + 0.005_mm + es.wedge_offset;
716  if (es.laddL5map[(i + j * 2 + M * 10)] == 1) {
717  scopy++;
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)));
724 
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)));
733  }
734  }
735  }
736  } else {
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. +
744  j * es.waf_active;
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) {
747  scopy++;
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)));
754 
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)));
763  }
764  }
765  }
766  }
767  }
768 
769  // Positioning of ladders
770  int icopy[100] = {0};
771  constexpr int sz = 20;
772 
773  for (int I = -9; I <= 9; ++I) {
774  prev_length = 0;
775  int J = abs(I);
776  for (int K = 0; K < es.noLaddInCol[J]; K++) {
777  string type;
778 
779  ladder_new_length = es.micromodule_length + 3. * es.waf_active;
780  ladd_shift = 4. * es.waf_active;
781 
782  if (K == 0)
783  type = es.typeOfLaddRow0[J];
784  if (K == 1)
785  type = es.typeOfLaddRow1[J];
786  if (K == 2)
787  type = es.typeOfLaddRow2[J];
788  if (K == 3)
789  type = es.typeOfLaddRow3[J];
790 
791  for (const auto& i : es.typesL5)
792  if (type == i) {
793  ladder_new_length = es.micromodule_length + 4. * es.waf_active;
794  ladd_shift = 5. * es.waf_active;
795  }
796 
797  int j = 0;
798 
799  for (int t = 0; t < int(es.typesL5.size()); t++)
800  if (type == es.typesL5[t]) {
801  j = t;
802  if (I < 0 && es.asymLadd[t] == 1) {
803  j = j + 1;
804  type = es.typesL5[j];
805  }
806  }
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) {
811  j = j + 1;
812  type = es.typesL4[j - es.typesL5.size()];
813  }
814  }
815 
816  xpos = I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
817  if (I > 0)
818  xpos = xpos + es.dee_separation;
819  if (I < 0)
820  xpos = xpos - es.dee_separation;
821 
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;
824 
825  prev_length += ladd_shift;
826 
827  zpos = es.zlead1 + es.ladder_thick / 2. + 0.01_mm;
828  icopy[j] += 1;
829 
830  sfLog.placeVolume(ns.volume("esalgo:" + es.ladPfx[0] + type), icopy[j], Position(xpos, ypos, zpos));
831 
832  xpos = I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
833  sfLog.placeVolume(ns.volume("esalgo:" + es.ladPfx[1] + type),
834  icopy[j],
835  Transform3D(ns.rotation("esalgo:R270"), Position(ypos, -xpos, zpos - es.zlead1 + es.zlead2)));
836 
837  int changed = 0;
838  for (int t = 0; t < int(es.typesL5.size()); t++)
839  if (type == es.typesL5[t]) {
840  j = t;
841  if (es.asymLadd[t] == 2 && !changed) {
842  j = j - 1;
843  changed = 1;
844  }
845  if (es.asymLadd[t] == 1 && !changed) {
846  j = j + 1;
847  changed = 1;
848  }
849  type = es.typesL5[j];
850  }
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) {
855  j = j - 1;
856  changed = 1;
857  }
858  if (es.asymLadd[(t + es.typesL5.size())] == 1 && !changed) {
859  j = j + 1;
860  changed = 1;
861  }
862  type = es.typesL4[j - es.typesL5.size()];
863  }
864 
865  icopy[j] += 1;
866 
867  if (I > 0)
868  xpos = xpos + es.dee_separation;
869  if (I < 0)
870  xpos = xpos - es.dee_separation;
871 
872  sfLog.placeVolume(ns.volume("esalgo:" + es.ladPfx[0] + type),
873  icopy[j],
874  Transform3D(ns.rotation("esalgo:R180"), Position(xpos, -ypos, zpos)));
875 
876  xpos = I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
877 
878  sfLog.placeVolume(
879  ns.volume("esalgo:" + es.ladPfx[1] + type),
880  icopy[j],
881  Transform3D(ns.rotation("esalgo:R090"), Position(-ypos, -xpos, zpos - es.zlead1 + es.zlead2)));
882  }
883  }
884  }
885  // place the slicon strips in active silicon wafers
886  {
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");
892 
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.));
896 
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.));
899  }
900  }
901  return 1;
902 }

References funct::abs(), cms::DDNamespace::addSolid(), cms::DDNamespace::addVolume(), cms::DDNamespace::addVolumeNS(), writedatasetfile::args, funct::cos(), counter, ztail::d, MillePedeFileConverter_cfg::e, EcalPreshower, Exhume::I, mps_fire::i, createfilelist::int, dqmiolumiharvest::j, dttmaxenums::L, cms::DDNamespace::material(), PixelTestBeamValidation_cfi::Position, cms::DDNamespace::rotation(), funct::sin(), cms::DDNamespace::solid(), submitPVValidationJobs::t, and cms::DDNamespace::volume().

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_ecal_DDEcalPreshowerAlgo   
)

Definition at line 904 of file DDEcalPreshowerAlgo.cc.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
dttmaxenums::L
Definition: DTTMax.h:29
mps_fire.i
i
Definition: mps_fire.py:428
cms::DDNamespace
Definition: DDNamespace.h:16
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Exhume::I
const std::complex< double > I
Definition: I.h:8
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:39
createfilelist.int
int
Definition: createfilelist.py:10
cms::DDAlgoArguments
Definition: DDAlgoArguments.h:28
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:17
EcalPreshower
Definition: EcalSubdetector.h:10
BenchmarkGrd
Definition: BenchmarkGrd.h:9
ztail.d
d
Definition: ztail.py:151
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37