CMS 3D CMS Logo

Functions | Variables
DDEcalPreshowerNewAlgo.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_DDEcalPreshowerNewAlgo)
 

Variables

static constexpr float const & k_half = 0.5
 
static constexpr float const & k_one32nd = 0.03125
 
static constexpr float const & k_one64th = 0.015625
 

Function Documentation

◆ algorithm()

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

Definition at line 82 of file DDEcalPreshowerNewAlgo.cc.

82  {
83  BenchmarkGrd counter("DDEcalPreshowerNewAlgo");
84  cms::DDNamespace ns(ctxt, e, true);
86 
87  Volume parentVolume = ns.volume(args.parentName());
88  Volume swedLog = ns.volume("esalgo:SWED");
89  Volume sfLog = ns.volume("esalgo:SF");
90  Volume sfbxLog = ns.volume("esalgo:SFBX");
91  Volume sfbyLog = ns.volume("esalgo:SFBY");
92 
93  EcalPreshower es;
94  es.asymLadd = args.vecFloat("ASYMETRIC_LADDER");
95  es.typesL5 = args.vecStr("TYPES_OF_LADD_L5");
96  es.typesL4 = args.vecStr("TYPES_OF_LADD_L4");
97  es.laddL5map = args.vecFloat("LADD_L5_MAP");
98  es.laddL4map = args.vecFloat("LADD_L4_MAP");
99  es.noLaddInCol = args.vecFloat("NUMB_OF_LADD_IN_COL");
100  es.startOfFirstLadd = args.vecFloat("START_OF_1ST_LADD");
101  es.typeOfLaddRow0 = args.vecStr("TYPE_OF_LADD_1");
102  es.typeOfLaddRow1 = args.vecStr("TYPE_OF_LADD_2");
103  es.typeOfLaddRow2 = args.vecStr("TYPE_OF_LADD_3");
104  es.typeOfLaddRow3 = args.vecStr("TYPE_OF_LADD_4");
105  es.thickLayers = args.vecFloat("Layers");
106  es.thickness = args.dble("PRESH_Z_TOTAL");
107  es.materials = args.vecStr("LayMat");
108  es.layName = args.vecStr("LayName");
109  es.rmaxVec = args.vecFloat("R_MAX"); // inner radii
110  es.rminVec = args.vecFloat("R_MIN"); // outer radii
111  es.waf_intra_col_sep = args.dble("waf_intra_col_sep");
112  es.waf_inter_col_sep = args.dble("waf_inter_col_sep");
113  es.waf_active = args.dble("waf_active");
114  es.wedge_length = args.dble("wedge_length");
115  es.wedge_offset = args.dble("wedge_offset");
116  es.zwedge_ceramic_diff = args.dble("zwedge_ceramic_diff");
117  es.ywedge_ceramic_diff = args.dble("ywedge_ceramic_diff");
118  es.ceramic_length = args.dble("ceramic_length");
119  es.wedge_angle = args.dble("wedge_angle");
120  es.wedge_back_thick = args.dble("wedge_back_thick");
121  es.ladder_thick = args.dble("ladder_thick");
122  es.ladder_width = args.dble("ladder_width");
123  es.micromodule_length = args.dble("micromodule_length");
124  es.box_thick = args.dble("box_thick");
125  es.abs1stx = args.vecFloat("1ST_ABSX");
126  es.abs1sty = args.vecFloat("1ST_ABSY");
127  es.abs2ndx = args.vecFloat("2ND_ABSX");
128  es.abs2ndy = args.vecFloat("2ND_ABSY");
129  es.ladPfx = args.vecStr("LadPrefix");
130  es.laddMaterial = args.str("LadderMaterial");
131  es.ldrFrnt_Length = args.dble("LdrFrnt_Length");
132  es.ldrFrnt_Offset = args.dble("LdrFrnt_Offset");
133  es.ldrBck_Length = args.dble("LdrBck_Length");
134  es.ldrBck_Offset = args.dble("LdrBck_Offset");
135  es.dee_separation = args.dble("dee_sep");
136  es.in_rad_Abs_Al = args.dble("R_MIN_Abs_Al");
137  es.in_rad_Abs_Pb = args.dble("R_MIN_Abs_Pb");
138  es.rMax_Abs_Al = args.dble("R_MAX_Abs_Al");
139  es.absAlX_X = args.dble("AbsAlX_X");
140  es.absAlX_Y = args.dble("AbsAlX_Y");
141  es.absAlX_subtr1_Xshift = args.dble("AbsAlX_subtr1_Xshift");
142  es.absAlX_subtr1_Yshift = args.dble("AbsAlX_subtr1_Yshift");
143  es.absAlY_X = args.dble("AbsAlY_X");
144  es.absAlY_Y = args.dble("AbsAlY_Y");
145  es.absAlY_subtr1_Xshift = args.dble("AbsAlY_subtr1_Xshift");
146  es.absAlY_subtr1_Yshift = args.dble("AbsAlY_subtr1_Yshift");
147 
148  // create all the tube-like layers of the preshower
149  {
150  double zpos = -es.thickness * k_half, sdx(0), sdy(0), bdx(0), bdy(0);
151 
152  for (size_t i = 0; i < es.thickLayers.size(); ++i) {
153  int I = int(i) + 1; // FOTRAN I (offset +1)
154 
155  float rIn(0), rOut(0), zHalf(0);
156 
157  // create the name
158  const string& ddname("esalgo:" + es.layName[i]); // namespace:name
159 
160  // cone dimensions
161  rIn = es.rminVec[i];
162  rOut = es.rmaxVec[i];
163  zHalf = es.thickLayers[i] * k_half;
164 
165  // create a logical part representing a single layer in the preshower
166  Solid solid = ns.addSolid(ddname, Tube(ddname, rIn, rOut, zHalf, 0., 360._deg));
167  Volume layer = ns.addVolume(Volume(ddname, solid, ns.material(es.materials[i])));
168 
169  // position the logical part w.r.t. the parent volume
170  zpos += zHalf;
171 
172  // create a logical part representing a single layer in the preshower
173  // skip layers with detectors, front and rear window
174  if (I == 2 || I == 28 || I == 13 || I == 23) {
175  zpos += zHalf;
176  continue;
177  }
178 
179  if (I == 12) {
180  es.zlead1 = zpos + zHalf;
181  }
182  if (I == 22) {
183  es.zlead2 = zpos + zHalf;
184  }
185 
186  if (I == 10 || I == 20) { // New lead shape
187 
188  int absz = 0;
189  double outalbx, outalby, shiftR, outalbx2, outalby2, shiftR2;
190 
191  absz = int(es.abs1stx.size());
192  if (I == 20)
193  absz = int(es.abs2ndx.size());
194  int cutabsx = -1;
195  int cutabsy = -1;
196 
197  const string& dd_tmp_name_b("esalgo:" + es.layName[i] + "Lcut");
198  const string& dd_tmp_name_c("esalgo:" + es.layName[i] + "tmpb");
199  const string& dd_tmp_name_d("esalgo:" + es.layName[i] + "LinPb");
200  const string& dd_tmp_name_e("esalgo:" + es.layName[i] + "LinAl");
201  const string& dd_tmp_name_f("esalgo:" + es.layName[i] + "LOutAl");
202 
203  const string& dd_Alname_f("esalgo:" + es.layName[i] + "LOutAl");
204  const string& dd_Alname_g("esalgo:" + es.layName[i] + "LOutAl2");
205  const string& dd_Alname_h("esalgo:" + es.layName[i] + "LOutAltmp");
206  const string& dd_Alname_i("esalgo:" + es.layName[i] + "LOutAltmp2");
207  const string& dd_Alname_j("esalgo:" + es.layName[i] + "LOutAltmp3");
208  const string& dd_Alname_k("esalgo:" + es.layName[i] + "LOutAltmp4");
209  const string& dd_Alname_l("esalgo:" + es.layName[i] + "LOutAltmp5");
210  const string& dd_Alname_m("esalgo:" + es.layName[i] + "LOutAltmp6");
211 
212  Solid outAl =
213  ns.addSolid(dd_Alname_f, Tube(dd_Alname_f, es.rMax_Abs_Al - 70_cm, es.rMax_Abs_Al, zHalf, 0., 90._deg));
214 
215  outalbx = es.absAlX_X * 0.1;
216  outalby = es.rMax_Abs_Al + 0.1_mm - es.absAlX_subtr1_Yshift;
217  shiftR = es.absAlX_subtr1_Yshift;
218  if (I == 20) {
219  outalbx = es.absAlY_X * 0.1;
220  outalby = es.rMax_Abs_Al + 0.1_mm - es.absAlY_subtr1_Yshift;
221  shiftR = es.absAlY_subtr1_Xshift;
222  }
223  Solid outAltmp = ns.addSolid(
224  dd_Alname_h, Box(dd_Alname_h, outalbx * k_half + 0.1_mm, outalby * k_half + 0.1_mm, zHalf + 0.1_mm));
225  Solid outAltmp3 = ns.addSolid(
226  dd_Alname_j,
227  SubtractionSolid(dd_Alname_j, outAl, outAltmp, Position(outalbx * k_half, outalby * k_half + shiftR, 0)));
228 
229  outalby2 = es.absAlX_Y * 0.1;
230  outalbx2 = es.rMax_Abs_Al + 0.1_mm - es.absAlX_subtr1_Xshift;
231  shiftR2 = es.absAlX_subtr1_Xshift;
232  if (I == 20) {
233  outalby2 = es.absAlY_Y * 0.1;
234  outalbx2 = es.rMax_Abs_Al + 0.1_mm - es.absAlY_subtr1_Xshift;
235  shiftR2 = es.absAlY_subtr1_Xshift;
236  }
237  Solid outAltmp2 = ns.addSolid(
238  dd_Alname_i, Box(dd_Alname_i, outalbx2 * k_half + 0.1_mm, outalby2 * k_half + 0.1_mm, zHalf + 0.1_mm));
239  Solid outAltmp4 = ns.addSolid(
240  dd_Alname_k,
241  SubtractionSolid(
242  dd_Alname_k, outAltmp3, outAltmp2, Position(outalbx2 * k_half + shiftR2, outalby2 * k_half, 0)));
243  Solid outAltmp5 =
244  ns.addSolid(dd_Alname_l, UnionSolid(dd_Alname_l, outAltmp4, outAltmp4, ns.rotation("esalgo:RABS90")));
245  Solid outAltmp6 =
246  ns.addSolid(dd_Alname_m, UnionSolid(dd_Alname_m, outAltmp5, outAltmp4, ns.rotation("esalgo:RABS180B")));
247  Solid outAl2 =
248  ns.addSolid(dd_Alname_g, UnionSolid(dd_Alname_g, outAltmp6, outAltmp4, ns.rotation("esalgo:R180")));
249 
250  Solid outAlCut = Box(65_cm, 60_cm - 0.1_mm, zHalf + 0.2_mm);
251  Solid outAlFin = SubtractionSolid(outAl2, outAlCut);
252 
253  Volume layerFinOutAl = Volume(dd_tmp_name_f, outAlFin, ns.material(es.materials[i - 1]));
254 
255  for (int L = 0; L < absz; ++L) {
256  int K = L;
257  ostringstream tmp_name_b, tmp_name_b2, tmp_FAl_name_c, tmp_FAl_name_d1, tmp_FAl_name_d2, tmp_FAl_name_d3,
258  tmp_FAl_name_d;
259  tmp_name_b << es.layName[i] << "L" << K;
260  tmp_name_b2 << es.layName[i] << "Lb2" << K;
261 
262  if (L == 0)
263  tmp_FAl_name_c << es.layName[i] << "LOutAl2";
264  if (L > 0)
265  tmp_FAl_name_c << es.layName[i] << "LtmpAl" << K - 1;
266 
267  tmp_FAl_name_d1 << es.layName[i] << "LtmpAl" << K << "_1";
268  tmp_FAl_name_d2 << es.layName[i] << "LtmpAl" << K << "_2";
269  tmp_FAl_name_d3 << es.layName[i] << "LtmpAl" << K << "_3";
270  tmp_FAl_name_d << es.layName[i] << "LtmpAl" << K;
271 
272  const string& dd_tmp_name_b("esalgo:" + tmp_name_b.str());
273  const string& dd_tmp_name_b2("esalgo:" + tmp_name_b2.str());
274  const string& dd_FAl_name_c("esalgo:" + tmp_FAl_name_c.str());
275  const string& dd_FAl_name_d1("esalgo:" + tmp_FAl_name_d1.str());
276  const string& dd_FAl_name_d2("esalgo:" + tmp_FAl_name_d2.str());
277  const string& dd_FAl_name_d3("esalgo:" + tmp_FAl_name_d3.str());
278  const string& dd_FAl_name_d("esalgo:" + tmp_FAl_name_d.str());
279 
280  if (L == 0)
281  bdx = abs(es.abs1stx[K]) * k_half;
282  if (L > 0)
283  bdx = abs(es.abs1stx[K] - es.abs1stx[K - 1]) * k_half;
284  bdy = es.abs1sty[K];
285  if (es.abs1stx[K] < rIn + 30_cm) {
286  bdy = es.abs1sty[K] * k_half - 30_cm;
287  cutabsx = K;
288  }
289 
290  if (I == 20) {
291  if (L == 0)
292  bdx = abs(es.abs2ndx[K]) * k_half;
293  if (L > 0)
294  bdx = abs(es.abs2ndx[K] - es.abs2ndx[K - 1]) * k_half;
295  bdy = es.abs2ndy[K];
296  }
297 
298  if ((es.abs2ndx[K] < rIn + 30_cm) && I == 20) {
299  bdy = es.abs2ndy[K] * k_half - 30_cm;
300  cutabsy = K;
301  }
302 
303  Solid solid_b = Box(dd_tmp_name_b, bdx, bdy, zHalf);
304  Solid solid_b2 = Box(dd_tmp_name_b2, bdx + 0.1_mm, bdy + 0.1_mm, zHalf);
305 
306  sdx = es.abs1stx[K] - bdx;
307  sdy = 0;
308  if (es.abs1stx[K] < rIn + 30_cm)
309  sdy = es.abs1sty[K] - bdy;
310 
311  if (I == 20) {
312  sdx = es.abs2ndx[K] - bdx;
313  sdy = 0;
314  }
315  if ((es.abs2ndx[K] < rIn + 30_cm) && I == 20)
316  sdy = es.abs2ndy[K] - bdy;
317 
318  Volume layer = Volume(dd_tmp_name_b, solid_b, ns.material(es.materials[i]));
319 
320  layerFinOutAl.placeVolume(layer, 1, Position(sdx, sdy, 0));
321  layerFinOutAl.placeVolume(layer, 2, Position(-sdx, sdy, 0));
322 
323  Solid solid_c = ns.solid(dd_FAl_name_c);
324  Solid solid_d1 =
325  ns.addSolid(dd_FAl_name_d1, UnionSolid(dd_FAl_name_d1, solid_c, solid_b2, Position(sdx, sdy, 0)));
326  Solid solid_d2 =
327  ns.addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d1, solid_b2, Position(-sdx, -sdy, 0)));
328 
329  if (((es.abs1stx[K] < rIn + 30_cm) && I == 10) || ((es.abs2ndx[K] < rIn + 30_cm) && I == 20)) {
330  layerFinOutAl.placeVolume(layer, 3, Position(sdx, -sdy, 0));
331  layerFinOutAl.placeVolume(layer, 4, Position(-sdx, -sdy, 0));
332 
333  Solid solid_c = ns.solid(dd_FAl_name_c);
334  Solid solid_d1 = UnionSolid(dd_FAl_name_d1, solid_c, solid_b2, Position(sdx, sdy, 0));
335  ns.addSolid(dd_FAl_name_d2, UnionSolid(dd_FAl_name_d2, solid_d1, solid_b2, Position(sdx, -sdy, 0)));
336  Solid solid_d3 = UnionSolid(dd_FAl_name_d3, solid_d2, solid_b2, Position(-sdx, sdy, 0));
337  ns.addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d3, solid_b2, Position(-sdx, -sdy, 0)));
338  }
339  }
340 
341  bdx = es.abs1stx[cutabsx];
342  if (I == 20)
343  bdx = es.abs2ndx[cutabsy];
344  bdy = 2 * 30_cm;
345 
346  Solid solidcut = Box(dd_tmp_name_b, bdx, bdy, zHalf);
347  Solid iner = Tube(dd_tmp_name_c, 0, es.in_rad_Abs_Pb, zHalf + 0.1_mm, 0., 360._deg);
348  Solid final = SubtractionSolid(dd_tmp_name_d, solidcut, iner);
349 
350  Volume blayer = Volume(dd_tmp_name_d, final, ns.material(es.materials[i]));
351  parentVolume.placeVolume(blayer, 1, Position(0, 0, zpos));
352 
353  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);
354  Volume layerAl = Volume(dd_tmp_name_e, iner_Al, ns.material(es.materials[i - 1]));
355  parentVolume.placeVolume(layerAl, 1, Position(0, 0, zpos));
356  parentVolume.placeVolume(layerFinOutAl, 1, Position(0, 0, zpos));
357  } else {
358  parentVolume.placeVolume(layer, 1, Position(0., 0., zpos));
359  }
360  zpos += zHalf;
361  }
362  }
363  // create and place the ladders
364  {
365  double xpos(0.), ypos(0.), zpos(0.); //, sdx(0.), sdy(0.), sdz(0.);
366  float prev_length(0.), ladder_new_length(0.);
367  float ladd_shift(0.);
368  float ladder_length(0.);
369  int swed_scopy_glob(0);
370 
371  for (int M = 0; M < int(es.typesL5.size() + es.typesL4.size()); M++) {
372  int scopy(0);
373  int ladd_not_plain(0), ladd_subtr_no(0), ladd_upper(0);
374 
375  // Creation of ladders with 5 micromodules length
376 
377  if (M < int(es.typesL5.size())) {
378  for (int i = 0; i <= 1; i++) {
379  for (int j = 0; j <= 3; j++) {
380  if (es.laddL5map[(i + j * 2 + M * 10)] != 1) {
381  ladd_not_plain = 1;
382  ladd_subtr_no++;
383  if (j > 1)
384  ladd_upper = 1;
385  }
386  }
387  }
388 
389  const string& ddname("esalgo:" + es.ladPfx[0] + es.typesL5[M]);
390  ladder_length = es.micromodule_length + 4 * es.waf_active + 0.1_mm;
391 
392  if (ladd_not_plain) {
393  if (!ladd_upper) {
394  ns.addAssembly(ddname);
395  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL5[M]);
396  }
397  } // end of not plain ladder shape
398  else {
399  ns.addAssembly(ddname);
400  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL5[M]);
401  }
402  }
403 
404  // Creation of ladders with 4 micromodules length
405 
406  if (M >= int(es.typesL5.size())) {
407  int d = M - es.typesL5.size();
408 
409  for (int i = 0; i <= 1; i++) {
410  for (int j = 0; j <= 3; j++) {
411  if (es.laddL4map[(i + j * 2 + (M - es.typesL5.size()) * 8)] != 1) {
412  ladd_not_plain = 1;
413  ladd_subtr_no++;
414  if (j > 1)
415  ladd_upper = 1;
416  }
417  }
418  }
419 
420  const string& ddname("esalgo:" + es.ladPfx[0] + es.typesL4[d]);
421  ladder_length = es.micromodule_length + 3 * es.waf_active + 0.1_mm;
422 
423  if (ladd_not_plain) {
424  if (ladd_upper) {
425  ns.addAssembly(ddname);
426  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL4[d]);
427 
428  } // upper
429  else {
430  if (ladd_subtr_no > 1) {
431  ns.addAssembly(ddname);
432  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL4[d]);
433  } else {
434  ns.addAssembly(ddname);
435  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL4[d]);
436  }
437  }
438  } // end of not plain ladder shape
439  else {
440  ns.addAssembly(ddname);
441  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL4[d]);
442  }
443  }
444 
445  // insert SWED, SFBX and SFBY into ladders
446  swed_scopy_glob++;
447  if (M < int(es.typesL5.size())) {
448  const string& ddname("esalgo:" + es.ladPfx[0] + es.typesL5[M]);
449  const string& ddname2("esalgo:" + es.ladPfx[1] + es.typesL5[M]);
450  for (int i = 0; i <= 1; i++) {
451  for (int j = 0; j <= 4; j++) {
452  xpos = (i * 2 - 1) * es.waf_intra_col_sep * k_half;
453  ypos = -ladder_length * k_half + 0.05_mm - (es.ldrFrnt_Length - es.ldrBck_Length) * k_half +
454  es.wedge_length * k_half + j * es.waf_active;
455  zpos = -es.ladder_thick * k_half + 0.005_mm + es.wedge_offset;
456  if (es.laddL5map[(i + j * 2 + M * 10)] == 1) {
457  scopy++;
458  ns.assembly(ddname).placeVolume(swedLog,
459  scopy + 1000 * swed_scopy_glob,
460  Transform3D(ns.rotation("esalgo:RM1299"), Position(xpos, ypos, zpos)));
461  ns.assembly(ddname2).placeVolume(swedLog,
462  scopy + 1000 * swed_scopy_glob + 100,
463  Transform3D(ns.rotation("esalgo:RM1299"), Position(xpos, ypos, zpos)));
464 
465  ypos = ypos + es.ywedge_ceramic_diff;
466  zpos = -es.ladder_thick * k_half + 0.005_mm + es.zwedge_ceramic_diff;
467  ns.assembly(ddname).placeVolume(sfbxLog,
468  scopy + 1000 * swed_scopy_glob,
469  Transform3D(ns.rotation("esalgo:RM1298"), Position(xpos, ypos, zpos)));
470  ns.assembly(ddname2).placeVolume(sfbyLog,
471  scopy + 1000 * swed_scopy_glob,
472  Transform3D(ns.rotation("esalgo:RM1300A"), Position(xpos, ypos, zpos)));
473  }
474  }
475  }
476  } else {
477  int d = M - es.typesL5.size();
478  const string& ddname("esalgo:" + es.ladPfx[0] + es.typesL4[d]);
479  const string& ddname2("esalgo:" + es.ladPfx[1] + es.typesL4[d]);
480  for (int i = 0; i <= 1; i++) {
481  for (int j = 0; j <= 3; j++) {
482  xpos = (i * 2 - 1) * es.waf_intra_col_sep * k_half;
483  ypos = -ladder_length * k_half + 0.05_mm - (es.ldrFrnt_Length - es.ldrBck_Length) * k_half +
484  es.wedge_length * k_half + j * es.waf_active;
485  zpos = -es.ladder_thick * k_half + 0.005_mm + es.wedge_offset;
486  if (es.laddL4map[(i + j * 2 + (M - es.typesL5.size()) * 8)] == 1) {
487  scopy++;
488  ns.assembly(ddname).placeVolume(swedLog,
489  scopy + 1000 * swed_scopy_glob,
490  Transform3D(ns.rotation("esalgo:RM1299"), Position(xpos, ypos, zpos)));
491  ns.assembly(ddname2).placeVolume(swedLog,
492  scopy + 1000 * swed_scopy_glob + 100,
493  Transform3D(ns.rotation("esalgo:RM1299"), Position(xpos, ypos, zpos)));
494 
495  ypos = ypos + es.ywedge_ceramic_diff;
496  zpos = -es.ladder_thick * k_half + 0.005_mm + es.zwedge_ceramic_diff;
497  ns.assembly(ddname).placeVolume(sfbxLog,
498  scopy + 1000 * swed_scopy_glob,
499  Transform3D(ns.rotation("esalgo:RM1298"), Position(xpos, ypos, zpos)));
500  ns.assembly(ddname2).placeVolume(sfbyLog,
501  scopy + 1000 * swed_scopy_glob,
502  Transform3D(ns.rotation("esalgo:RM1300A"), Position(xpos, ypos, zpos)));
503  }
504  }
505  }
506  }
507  }
508 
509  // Positioning of ladders
510  int icopy[100] = {0};
511  constexpr int sz = 20;
512 
513  for (int I = -9; I <= 9; ++I) {
514  prev_length = 0;
515  int J = abs(I);
516  for (int K = 0; K < es.noLaddInCol[J]; K++) {
517  string type;
518 
519  ladder_new_length = es.micromodule_length + 3. * es.waf_active;
520  ladd_shift = 4. * es.waf_active;
521 
522  if (K == 0)
523  type = es.typeOfLaddRow0[J];
524  if (K == 1)
525  type = es.typeOfLaddRow1[J];
526  if (K == 2)
527  type = es.typeOfLaddRow2[J];
528  if (K == 3)
529  type = es.typeOfLaddRow3[J];
530 
531  for (const auto& i : es.typesL5)
532  if (type == i) {
533  ladder_new_length = es.micromodule_length + 4. * es.waf_active;
534  ladd_shift = 5. * es.waf_active;
535  }
536 
537  int j = 0;
538 
539  for (int t = 0; t < int(es.typesL5.size()); t++)
540  if (type == es.typesL5[t]) {
541  j = t;
542  if (I < 0 && es.asymLadd[t] == 1) {
543  j = j + 1;
544  type = es.typesL5[j];
545  }
546  }
547  for (int t = 0; t < int(es.typesL4.size()); t++)
548  if (type == es.typesL4[t]) {
549  j = t + es.typesL5.size();
550  if (I < 0 && es.asymLadd[(t + es.typesL5.size())] == 1) {
551  j = j + 1;
552  type = es.typesL4[j - es.typesL5.size()];
553  }
554  }
555 
556  xpos = I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
557  if (I > 0)
558  xpos = xpos + es.dee_separation;
559  if (I < 0)
560  xpos = xpos - es.dee_separation;
561 
562  ypos = (sz - int(es.startOfFirstLadd[J])) * es.waf_active - ladder_new_length * k_half +
563  (es.ldrFrnt_Length - es.ldrBck_Length) * k_half + es.micromodule_length + 0.05_cm - prev_length;
564 
565  prev_length += ladd_shift;
566 
567  zpos = es.zlead1 + es.ladder_thick * k_half + 0.01_mm;
568  icopy[j] += 1;
569 
570  sfLog.placeVolume(ns.assembly("esalgo:" + es.ladPfx[0] + type), icopy[j], Position(xpos, ypos, zpos));
571 
572  xpos = I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
573 
574  sfLog.placeVolume(ns.assembly("esalgo:" + es.ladPfx[1] + type),
575  icopy[j],
576  Transform3D(ns.rotation("esalgo:R270"), Position(ypos, -xpos, zpos - es.zlead1 + es.zlead2)));
577 
578  int changed = 0;
579  for (int t = 0; t < int(es.typesL5.size()); t++)
580  if (type == es.typesL5[t]) {
581  j = t;
582  if (es.asymLadd[t] == 2 && !changed) {
583  j = j - 1;
584  changed = 1;
585  }
586  if (es.asymLadd[t] == 1 && !changed) {
587  j = j + 1;
588  changed = 1;
589  }
590  type = es.typesL5[j];
591  }
592  for (int t = 0; t < int(es.typesL4.size()); t++)
593  if (type == es.typesL4[t]) {
594  j = t + es.typesL5.size();
595  if (es.asymLadd[(t + es.typesL5.size())] == 2 && !changed) {
596  j = j - 1;
597  changed = 1;
598  }
599  if (es.asymLadd[(t + es.typesL5.size())] == 1 && !changed) {
600  j = j + 1;
601  changed = 1;
602  }
603  type = es.typesL4[j - es.typesL5.size()];
604  }
605 
606  icopy[j] += 1;
607 
608  if (I > 0)
609  xpos = xpos + es.dee_separation;
610  if (I < 0)
611  xpos = xpos - es.dee_separation;
612 
613  sfLog.placeVolume(ns.assembly("esalgo:" + es.ladPfx[0] + type),
614  icopy[j],
615  Transform3D(ns.rotation("esalgo:R180"), Position(xpos, -ypos, zpos)));
616 
617  xpos = I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
618 
619  sfLog.placeVolume(
620  ns.assembly("esalgo:" + es.ladPfx[1] + type),
621  icopy[j],
622  Transform3D(ns.rotation("esalgo:R090"), Position(-ypos, -xpos, zpos - es.zlead1 + es.zlead2)));
623  }
624  }
625  }
626  // place the slicon strips in active silicon wafers
627  {
628  float xpos(0), ypos(0);
629  Volume sfwxLog = ns.volume("esalgo:SFWX");
630  Volume sfwyLog = ns.volume("esalgo:SFWY");
631  Volume sfsxLog = ns.volume("esalgo:SFSX");
632  Volume sfsyLog = ns.volume("esalgo:SFSY");
633 
634  for (size_t i = 0; i < 32; ++i) {
635  xpos = -es.waf_active * k_half + i * es.waf_active * k_one32nd + es.waf_active * k_one64th;
636  sfwxLog.placeVolume(sfsxLog, i + 1, Position(xpos, 0., 0.));
637 
638  ypos = -es.waf_active * k_half + i * es.waf_active * k_one32nd + es.waf_active * k_one64th;
639  sfwyLog.placeVolume(sfsyLog, i + 1, Position(0., ypos, 0.));
640  }
641  }
642  return 1;
643 }

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

◆ DD4HEP_OPEN_PLUGIN()

DD4HEP_OPEN_PLUGIN ( dd4hep  ,
ddcms_det_element_DDCMS_ecal_DDEcalPreshowerNewAlgo   
)

Definition at line 645 of file DDEcalPreshowerNewAlgo.cc.

Variable Documentation

◆ k_half

constexpr float const& k_half = 0.5
staticconstexpr

Definition at line 15 of file DDEcalPreshowerNewAlgo.cc.

Referenced by algorithm().

◆ k_one32nd

constexpr float const& k_one32nd = 0.03125
staticconstexpr

Definition at line 16 of file DDEcalPreshowerNewAlgo.cc.

Referenced by algorithm().

◆ k_one64th

constexpr float const& k_one64th = 0.015625
staticconstexpr

Definition at line 17 of file DDEcalPreshowerNewAlgo.cc.

Referenced by algorithm().

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
Exhume::I
const std::complex< double > I
Definition: I.h:8
PixelTestBeamValidation_cfi.Position
Position
Definition: PixelTestBeamValidation_cfi.py:75
k_one64th
static constexpr float const & k_one64th
Definition: DDEcalPreshowerNewAlgo.cc:17
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
k_one32nd
static constexpr float const & k_one32nd
Definition: DDEcalPreshowerNewAlgo.cc:16
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
k_half
static constexpr float const & k_half
Definition: DDEcalPreshowerNewAlgo.cc:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37