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/angle_units.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 = ns.addSolid(
213  dd_Alname_f, Tube(dd_Alname_f, es.rMax_Abs_Al - 70 * dd4hep::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 * dd4hep::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 * dd4hep::mm - es.absAlY_subtr1_Yshift;
221  shiftR = es.absAlY_subtr1_Xshift;
222  }
223  Solid outAltmp = ns.addSolid(dd_Alname_h,
224  Box(dd_Alname_h,
225  outalbx * k_half + 0.1 * dd4hep::mm,
226  outalby * k_half + 0.1 * dd4hep::mm,
227  zHalf + 0.1 * dd4hep::mm));
228  Solid outAltmp3 = ns.addSolid(
229  dd_Alname_j,
230  SubtractionSolid(dd_Alname_j, outAl, outAltmp, Position(outalbx * k_half, outalby * k_half + shiftR, 0)));
231 
232  outalby2 = es.absAlX_Y * 0.1;
233  outalbx2 = es.rMax_Abs_Al + 0.1 * dd4hep::mm - es.absAlX_subtr1_Xshift;
234  shiftR2 = es.absAlX_subtr1_Xshift;
235  if (I == 20) {
236  outalby2 = es.absAlY_Y * 0.1;
237  outalbx2 = es.rMax_Abs_Al + 0.1 * dd4hep::mm - es.absAlY_subtr1_Xshift;
238  shiftR2 = es.absAlY_subtr1_Xshift;
239  }
240  Solid outAltmp2 = ns.addSolid(dd_Alname_i,
241  Box(dd_Alname_i,
242  outalbx2 * k_half + 0.1 * dd4hep::mm,
243  outalby2 * k_half + 0.1 * dd4hep::mm,
244  zHalf + 0.1 * dd4hep::mm));
245  Solid outAltmp4 = ns.addSolid(
246  dd_Alname_k,
247  SubtractionSolid(
248  dd_Alname_k, outAltmp3, outAltmp2, Position(outalbx2 * k_half + shiftR2, outalby2 * k_half, 0)));
249  Solid outAltmp5 =
250  ns.addSolid(dd_Alname_l, UnionSolid(dd_Alname_l, outAltmp4, outAltmp4, ns.rotation("esalgo:RABS90")));
251  Solid outAltmp6 =
252  ns.addSolid(dd_Alname_m, UnionSolid(dd_Alname_m, outAltmp5, outAltmp4, ns.rotation("esalgo:RABS180B")));
253  Solid outAl2 =
254  ns.addSolid(dd_Alname_g, UnionSolid(dd_Alname_g, outAltmp6, outAltmp4, ns.rotation("esalgo:R180")));
255 
256  Solid outAlCut = Box(65 * dd4hep::cm, 60 * dd4hep::cm - 0.1 * dd4hep::mm, zHalf + 0.2 * dd4hep::mm);
257  Solid outAlFin = SubtractionSolid(outAl2, outAlCut);
258 
259  Volume layerFinOutAl = Volume(dd_tmp_name_f, outAlFin, ns.material(es.materials[i - 1]));
260 
261  for (int L = 0; L < absz; ++L) {
262  int K = L;
263  ostringstream tmp_name_b, tmp_name_b2, tmp_FAl_name_c, tmp_FAl_name_d1, tmp_FAl_name_d2, tmp_FAl_name_d3,
264  tmp_FAl_name_d;
265  tmp_name_b << es.layName[i] << "L" << K;
266  tmp_name_b2 << es.layName[i] << "Lb2" << K;
267 
268  if (L == 0)
269  tmp_FAl_name_c << es.layName[i] << "LOutAl2";
270  if (L > 0)
271  tmp_FAl_name_c << es.layName[i] << "LtmpAl" << K - 1;
272 
273  tmp_FAl_name_d1 << es.layName[i] << "LtmpAl" << K << "_1";
274  tmp_FAl_name_d2 << es.layName[i] << "LtmpAl" << K << "_2";
275  tmp_FAl_name_d3 << es.layName[i] << "LtmpAl" << K << "_3";
276  tmp_FAl_name_d << es.layName[i] << "LtmpAl" << K;
277 
278  const string& dd_tmp_name_b("esalgo:" + tmp_name_b.str());
279  const string& dd_tmp_name_b2("esalgo:" + tmp_name_b2.str());
280  const string& dd_FAl_name_c("esalgo:" + tmp_FAl_name_c.str());
281  const string& dd_FAl_name_d1("esalgo:" + tmp_FAl_name_d1.str());
282  const string& dd_FAl_name_d2("esalgo:" + tmp_FAl_name_d2.str());
283  const string& dd_FAl_name_d3("esalgo:" + tmp_FAl_name_d3.str());
284  const string& dd_FAl_name_d("esalgo:" + tmp_FAl_name_d.str());
285 
286  if (L == 0)
287  bdx = abs(es.abs1stx[K]) * k_half;
288  if (L > 0)
289  bdx = abs(es.abs1stx[K] - es.abs1stx[K - 1]) * k_half;
290  bdy = es.abs1sty[K];
291  if (es.abs1stx[K] < rIn + 30 * dd4hep::cm) {
292  bdy = es.abs1sty[K] * k_half - 30 * dd4hep::cm;
293  cutabsx = K;
294  }
295 
296  if (I == 20) {
297  if (L == 0)
298  bdx = abs(es.abs2ndx[K]) * k_half;
299  if (L > 0)
300  bdx = abs(es.abs2ndx[K] - es.abs2ndx[K - 1]) * k_half;
301  bdy = es.abs2ndy[K];
302  }
303 
304  if ((es.abs2ndx[K] < rIn + 30 * dd4hep::cm) && I == 20) {
305  bdy = es.abs2ndy[K] * k_half - 30 * dd4hep::cm;
306  cutabsy = K;
307  }
308 
309  Solid solid_b = Box(dd_tmp_name_b, bdx, bdy, zHalf);
310  Solid solid_b2 = Box(dd_tmp_name_b2, bdx + 0.1 * dd4hep::mm, bdy + 0.1 * dd4hep::mm, zHalf);
311 
312  sdx = es.abs1stx[K] - bdx;
313  sdy = 0;
314  if (es.abs1stx[K] < rIn + 30 * dd4hep::cm)
315  sdy = es.abs1sty[K] - bdy;
316 
317  if (I == 20) {
318  sdx = es.abs2ndx[K] - bdx;
319  sdy = 0;
320  }
321  if ((es.abs2ndx[K] < rIn + 30 * dd4hep::cm) && I == 20)
322  sdy = es.abs2ndy[K] - bdy;
323 
324  Volume layer = Volume(dd_tmp_name_b, solid_b, ns.material(es.materials[i]));
325 
326  layerFinOutAl.placeVolume(layer, 1, Position(sdx, sdy, 0));
327  layerFinOutAl.placeVolume(layer, 2, Position(-sdx, sdy, 0));
328 
329  Solid solid_c = ns.solid(dd_FAl_name_c);
330  Solid solid_d1 =
331  ns.addSolid(dd_FAl_name_d1, UnionSolid(dd_FAl_name_d1, solid_c, solid_b2, Position(sdx, sdy, 0)));
332  Solid solid_d2 =
333  ns.addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d1, solid_b2, Position(-sdx, -sdy, 0)));
334 
335  if (((es.abs1stx[K] < rIn + 30 * dd4hep::cm) && I == 10) ||
336  ((es.abs2ndx[K] < rIn + 30 * dd4hep::cm) && I == 20)) {
337  layerFinOutAl.placeVolume(layer, 3, Position(sdx, -sdy, 0));
338  layerFinOutAl.placeVolume(layer, 4, Position(-sdx, -sdy, 0));
339 
340  Solid solid_c = ns.solid(dd_FAl_name_c);
341  Solid solid_d1 = UnionSolid(dd_FAl_name_d1, solid_c, solid_b2, Position(sdx, sdy, 0));
342  ns.addSolid(dd_FAl_name_d2, UnionSolid(dd_FAl_name_d2, solid_d1, solid_b2, Position(sdx, -sdy, 0)));
343  Solid solid_d3 = UnionSolid(dd_FAl_name_d3, solid_d2, solid_b2, Position(-sdx, sdy, 0));
344  ns.addSolid(dd_FAl_name_d, UnionSolid(dd_FAl_name_d, solid_d3, solid_b2, Position(-sdx, -sdy, 0)));
345  }
346  }
347 
348  bdx = es.abs1stx[cutabsx];
349  if (I == 20)
350  bdx = es.abs2ndx[cutabsy];
351  bdy = 2 * 30 * dd4hep::cm;
352 
353  Solid solidcut = Box(dd_tmp_name_b, bdx, bdy, zHalf);
354  Solid iner = Tube(dd_tmp_name_c, 0, es.in_rad_Abs_Pb, zHalf + 0.1 * dd4hep::mm, 0., 360._deg);
355  Solid final = SubtractionSolid(dd_tmp_name_d, solidcut, iner);
356 
357  Volume blayer = Volume(dd_tmp_name_d, final, ns.material(es.materials[i]));
358  parentVolume.placeVolume(blayer, 1, Position(0, 0, zpos));
359 
360  Solid iner_Al =
361  Tube(dd_tmp_name_e, es.in_rad_Abs_Al, es.in_rad_Abs_Pb - 0.01 * dd4hep::mm, zHalf, 0., 360._deg);
362  Volume layerAl = Volume(dd_tmp_name_e, iner_Al, ns.material(es.materials[i - 1]));
363  parentVolume.placeVolume(layerAl, 1, Position(0, 0, zpos));
364  parentVolume.placeVolume(layerFinOutAl, 1, Position(0, 0, zpos));
365  } else {
366  parentVolume.placeVolume(layer, 1, Position(0., 0., zpos));
367  }
368  zpos += zHalf;
369  }
370  }
371  // create and place the ladders
372  {
373  double xpos(0.), ypos(0.), zpos(0.); //, sdx(0.), sdy(0.), sdz(0.);
374  float prev_length(0.), ladder_new_length(0.);
375  float ladd_shift(0.);
376  float ladder_length(0.);
377  int swed_scopy_glob(0);
378 
379  for (int M = 0; M < int(es.typesL5.size() + es.typesL4.size()); M++) {
380  int scopy(0);
381  int ladd_not_plain(0), ladd_subtr_no(0), ladd_upper(0);
382 
383  // Creation of ladders with 5 micromodules length
384 
385  if (M < int(es.typesL5.size())) {
386  for (int i = 0; i <= 1; i++) {
387  for (int j = 0; j <= 3; j++) {
388  if (es.laddL5map[(i + j * 2 + M * 10)] != 1) {
389  ladd_not_plain = 1;
390  ladd_subtr_no++;
391  if (j > 1)
392  ladd_upper = 1;
393  }
394  }
395  }
396 
397  const string& ddname("esalgo:" + es.ladPfx[0] + es.typesL5[M]);
398  ladder_length = es.micromodule_length + 4 * es.waf_active + 0.1 * dd4hep::mm;
399 
400  if (ladd_not_plain) {
401  if (!ladd_upper) {
402  ns.addAssembly(ddname);
403  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL5[M]);
404  }
405  } // end of not plain ladder shape
406  else {
407  ns.addAssembly(ddname);
408  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL5[M]);
409  }
410  }
411 
412  // Creation of ladders with 4 micromodules length
413 
414  if (M >= int(es.typesL5.size())) {
415  int d = M - es.typesL5.size();
416 
417  for (int i = 0; i <= 1; i++) {
418  for (int j = 0; j <= 3; j++) {
419  if (es.laddL4map[(i + j * 2 + (M - es.typesL5.size()) * 8)] != 1) {
420  ladd_not_plain = 1;
421  ladd_subtr_no++;
422  if (j > 1)
423  ladd_upper = 1;
424  }
425  }
426  }
427 
428  const string& ddname("esalgo:" + es.ladPfx[0] + es.typesL4[d]);
429  ladder_length = es.micromodule_length + 3 * es.waf_active + 0.1 * dd4hep::mm;
430 
431  if (ladd_not_plain) {
432  if (ladd_upper) {
433  ns.addAssembly(ddname);
434  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL4[d]);
435 
436  } // upper
437  else {
438  if (ladd_subtr_no > 1) {
439  ns.addAssembly(ddname);
440  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL4[d]);
441  } else {
442  ns.addAssembly(ddname);
443  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL4[d]);
444  }
445  }
446  } // end of not plain ladder shape
447  else {
448  ns.addAssembly(ddname);
449  ns.addAssembly("esalgo:" + es.ladPfx[1] + es.typesL4[d]);
450  }
451  }
452 
453  // insert SWED, SFBX and SFBY into ladders
454  swed_scopy_glob++;
455  if (M < int(es.typesL5.size())) {
456  const string& ddname("esalgo:" + es.ladPfx[0] + es.typesL5[M]);
457  const string& ddname2("esalgo:" + es.ladPfx[1] + es.typesL5[M]);
458  for (int i = 0; i <= 1; i++) {
459  for (int j = 0; j <= 4; j++) {
460  xpos = (i * 2 - 1) * es.waf_intra_col_sep * k_half;
461  ypos = -ladder_length * k_half + 0.05 * dd4hep::mm - (es.ldrFrnt_Length - es.ldrBck_Length) * k_half +
462  es.wedge_length * k_half + j * es.waf_active;
463  zpos = -es.ladder_thick * k_half + 0.005 * dd4hep::mm + es.wedge_offset;
464  if (es.laddL5map[(i + j * 2 + M * 10)] == 1) {
465  scopy++;
466  ns.assembly(ddname).placeVolume(swedLog,
467  scopy + 1000 * swed_scopy_glob,
468  Transform3D(ns.rotation("esalgo:RM1299"), Position(xpos, ypos, zpos)));
469  ns.assembly(ddname2).placeVolume(swedLog,
470  scopy + 1000 * swed_scopy_glob + 100,
471  Transform3D(ns.rotation("esalgo:RM1299"), Position(xpos, ypos, zpos)));
472 
473  ypos = ypos + es.ywedge_ceramic_diff;
474  zpos = -es.ladder_thick * k_half + 0.005 * dd4hep::mm + es.zwedge_ceramic_diff;
475  ns.assembly(ddname).placeVolume(sfbxLog,
476  scopy + 1000 * swed_scopy_glob,
477  Transform3D(ns.rotation("esalgo:RM1298"), Position(xpos, ypos, zpos)));
478  ns.assembly(ddname2).placeVolume(sfbyLog,
479  scopy + 1000 * swed_scopy_glob,
480  Transform3D(ns.rotation("esalgo:RM1300A"), Position(xpos, ypos, zpos)));
481  }
482  }
483  }
484  } else {
485  int d = M - es.typesL5.size();
486  const string& ddname("esalgo:" + es.ladPfx[0] + es.typesL4[d]);
487  const string& ddname2("esalgo:" + es.ladPfx[1] + es.typesL4[d]);
488  for (int i = 0; i <= 1; i++) {
489  for (int j = 0; j <= 3; j++) {
490  xpos = (i * 2 - 1) * es.waf_intra_col_sep * k_half;
491  ypos = -ladder_length * k_half + 0.05 * dd4hep::mm - (es.ldrFrnt_Length - es.ldrBck_Length) * k_half +
492  es.wedge_length * k_half + j * es.waf_active;
493  zpos = -es.ladder_thick * k_half + 0.005 * dd4hep::mm + es.wedge_offset;
494  if (es.laddL4map[(i + j * 2 + (M - es.typesL5.size()) * 8)] == 1) {
495  scopy++;
496  ns.assembly(ddname).placeVolume(swedLog,
497  scopy + 1000 * swed_scopy_glob,
498  Transform3D(ns.rotation("esalgo:RM1299"), Position(xpos, ypos, zpos)));
499  ns.assembly(ddname2).placeVolume(swedLog,
500  scopy + 1000 * swed_scopy_glob + 100,
501  Transform3D(ns.rotation("esalgo:RM1299"), Position(xpos, ypos, zpos)));
502 
503  ypos = ypos + es.ywedge_ceramic_diff;
504  zpos = -es.ladder_thick * k_half + 0.005 * dd4hep::mm + es.zwedge_ceramic_diff;
505  ns.assembly(ddname).placeVolume(sfbxLog,
506  scopy + 1000 * swed_scopy_glob,
507  Transform3D(ns.rotation("esalgo:RM1298"), Position(xpos, ypos, zpos)));
508  ns.assembly(ddname2).placeVolume(sfbyLog,
509  scopy + 1000 * swed_scopy_glob,
510  Transform3D(ns.rotation("esalgo:RM1300A"), Position(xpos, ypos, zpos)));
511  }
512  }
513  }
514  }
515  }
516 
517  // Positioning of ladders
518  int icopy[100] = {0};
519  constexpr int sz = 20;
520 
521  for (int I = -9; I <= 9; ++I) {
522  prev_length = 0;
523  int J = abs(I);
524  for (int K = 0; K < es.noLaddInCol[J]; K++) {
525  string type;
526 
527  ladder_new_length = es.micromodule_length + 3. * es.waf_active;
528  ladd_shift = 4. * es.waf_active;
529 
530  if (K == 0)
531  type = es.typeOfLaddRow0[J];
532  if (K == 1)
533  type = es.typeOfLaddRow1[J];
534  if (K == 2)
535  type = es.typeOfLaddRow2[J];
536  if (K == 3)
537  type = es.typeOfLaddRow3[J];
538 
539  for (const auto& i : es.typesL5)
540  if (type == i) {
541  ladder_new_length = es.micromodule_length + 4. * es.waf_active;
542  ladd_shift = 5. * es.waf_active;
543  }
544 
545  int j = 0;
546 
547  for (int t = 0; t < int(es.typesL5.size()); t++)
548  if (type == es.typesL5[t]) {
549  j = t;
550  if (I < 0 && es.asymLadd[t] == 1) {
551  j = j + 1;
552  type = es.typesL5[j];
553  }
554  }
555  for (int t = 0; t < int(es.typesL4.size()); t++)
556  if (type == es.typesL4[t]) {
557  j = t + es.typesL5.size();
558  if (I < 0 && es.asymLadd[(t + es.typesL5.size())] == 1) {
559  j = j + 1;
560  type = es.typesL4[j - es.typesL5.size()];
561  }
562  }
563 
564  xpos = I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
565  if (I > 0)
566  xpos = xpos + es.dee_separation;
567  if (I < 0)
568  xpos = xpos - es.dee_separation;
569 
570  ypos = (sz - int(es.startOfFirstLadd[J])) * es.waf_active - ladder_new_length * k_half +
571  (es.ldrFrnt_Length - es.ldrBck_Length) * k_half + es.micromodule_length + 0.05 * dd4hep::cm -
572  prev_length;
573 
574  prev_length += ladd_shift;
575 
576  zpos = es.zlead1 + es.ladder_thick * k_half + 0.01 * dd4hep::mm;
577  icopy[j] += 1;
578 
579  sfLog.placeVolume(ns.assembly("esalgo:" + es.ladPfx[0] + type), icopy[j], Position(xpos, ypos, zpos));
580 
581  xpos = I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
582 
583  sfLog.placeVolume(ns.assembly("esalgo:" + es.ladPfx[1] + type),
584  icopy[j],
585  Transform3D(ns.rotation("esalgo:R270"), Position(ypos, -xpos, zpos - es.zlead1 + es.zlead2)));
586 
587  int changed = 0;
588  for (int t = 0; t < int(es.typesL5.size()); t++)
589  if (type == es.typesL5[t]) {
590  j = t;
591  if (es.asymLadd[t] == 2 && !changed) {
592  j = j - 1;
593  changed = 1;
594  }
595  if (es.asymLadd[t] == 1 && !changed) {
596  j = j + 1;
597  changed = 1;
598  }
599  type = es.typesL5[j];
600  }
601  for (int t = 0; t < int(es.typesL4.size()); t++)
602  if (type == es.typesL4[t]) {
603  j = t + es.typesL5.size();
604  if (es.asymLadd[(t + es.typesL5.size())] == 2 && !changed) {
605  j = j - 1;
606  changed = 1;
607  }
608  if (es.asymLadd[(t + es.typesL5.size())] == 1 && !changed) {
609  j = j + 1;
610  changed = 1;
611  }
612  type = es.typesL4[j - es.typesL5.size()];
613  }
614 
615  icopy[j] += 1;
616 
617  if (I > 0)
618  xpos = xpos + es.dee_separation;
619  if (I < 0)
620  xpos = xpos - es.dee_separation;
621 
622  sfLog.placeVolume(ns.assembly("esalgo:" + es.ladPfx[0] + type),
623  icopy[j],
624  Transform3D(ns.rotation("esalgo:R180"), Position(xpos, -ypos, zpos)));
625 
626  xpos = I * (2 * es.waf_intra_col_sep + es.waf_inter_col_sep);
627 
628  sfLog.placeVolume(
629  ns.assembly("esalgo:" + es.ladPfx[1] + type),
630  icopy[j],
631  Transform3D(ns.rotation("esalgo:R090"), Position(-ypos, -xpos, zpos - es.zlead1 + es.zlead2)));
632  }
633  }
634  }
635  // place the slicon strips in active silicon wafers
636  {
637  float xpos(0), ypos(0);
638  Volume sfwxLog = ns.volume("esalgo:SFWX");
639  Volume sfwyLog = ns.volume("esalgo:SFWY");
640  Volume sfsxLog = ns.volume("esalgo:SFSX");
641  Volume sfsyLog = ns.volume("esalgo:SFSY");
642 
643  for (size_t i = 0; i < 32; ++i) {
644  xpos = -es.waf_active * k_half + i * es.waf_active * k_one32nd + es.waf_active * k_one64th;
645  sfwxLog.placeVolume(sfsxLog, i + 1, Position(xpos, 0., 0.));
646 
647  ypos = -es.waf_active * k_half + i * es.waf_active * k_one32nd + es.waf_active * k_one64th;
648  sfwyLog.placeVolume(sfsyLog, i + 1, Position(0., ypos, 0.));
649  }
650  }
651  return 1;
652 }

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, phase1PixelTopology::layer, 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 654 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
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:47
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
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:18
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