CMS 3D CMS Logo

DDHGCalHEAlgo.cc
Go to the documentation of this file.
1 // File: DDHGCalHEAlgo.cc
3 // Description: Geometry factory class for HGCal (Mix)
5 
13 #include "CLHEP/Units/GlobalPhysicalConstants.h"
14 #include "CLHEP/Units/GlobalSystemOfUnits.h"
15 
16 //#define EDM_ML_DEBUG
17 
19 #ifdef EDM_ML_DEBUG
20  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Creating an instance";
21 #endif
22 }
23 
25 
27  const DDVectorArguments & vArgs,
28  const DDMapArguments & ,
29  const DDStringArguments & sArgs,
30  const DDStringVectorArguments &vsArgs) {
31 
32  wafers_ = vsArgs["WaferNames"];
33 #ifdef EDM_ML_DEBUG
34  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << wafers_.size()
35  << " wafers";
36  for (unsigned int i=0; i<wafers_.size(); ++i)
37  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << "] " << wafers_[i];
38 #endif
39  materials_ = vsArgs["MaterialNames"];
40  names_ = vsArgs["VolumeNames"];
41  thick_ = vArgs["Thickness"];
42  for (unsigned int i=0; i<materials_.size(); ++i) {
43  copyNumber_.emplace_back(1);
44  }
45 #ifdef EDM_ML_DEBUG
46  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << materials_.size()
47  << " types of volumes";
48  for (unsigned int i=0; i<names_.size(); ++i)
49  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << names_[i]
50  << " of thickness " << thick_[i]
51  << " filled with " << materials_[i]
52  << " first copy number " << copyNumber_[i];
53 #endif
54  layers_ = dbl_to_int(vArgs["Layers"]);
55  layerThick_ = vArgs["LayerThick"];
56  rMixLayer_ = vArgs["LayerRmix"];
57 #ifdef EDM_ML_DEBUG
58  edm::LogVerbatim("HGCalGeom") << "There are " << layers_.size() << " blocks";
59  for (unsigned int i=0; i<layers_.size(); ++i)
60  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] of thickness "
61  << layerThick_[i] << " Rmid " <<rMixLayer_[i]
62  << " with " << layers_[i] << " layers";
63 #endif
64  layerType_ = dbl_to_int(vArgs["LayerType"]);
65  layerSense_ = dbl_to_int(vArgs["LayerSense"]);
66  firstLayer_ = (int)(nArgs["FirstLayer"]);
67  if (firstLayer_ > 0) {
68  for (unsigned int i=0; i<layerType_.size(); ++i) {
69  if (layerSense_[i] != 0) {
70  int ii = layerType_[i];
71  copyNumber_[ii] = firstLayer_;
72 #ifdef EDM_ML_DEBUG
73  edm::LogVerbatim("HGCalGeom") << "First copy number for layer type "
74  << i << ":" << ii << " with "
75  << materials_[ii] << " changed to "
76  << copyNumber_[ii];
77 #endif
78  break;
79  }
80  }
81  }
82 #ifdef EDM_ML_DEBUG
83  edm::LogVerbatim("HGCalGeom") << "There are " << layerType_.size()
84  << " layers" ;
85  for (unsigned int i=0; i<layerType_.size(); ++i)
86  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type "
87  << layerType_[i] << " sensitive class "
88  << layerSense_[i];
89 #endif
90  materialsTop_ = vsArgs["TopMaterialNames"];
91  namesTop_ = vsArgs["TopVolumeNames"];
92  layerThickTop_= vArgs["TopLayerThickness"];
93  layerTypeTop_ = dbl_to_int(vArgs["TopLayerType"]);
94  for (unsigned int i=0; i<materialsTop_.size(); ++i) {
95  copyNumberTop_.emplace_back(1);
96  }
97 #ifdef EDM_ML_DEBUG
98  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << materialsTop_.size()
99  << " types of volumes in the top part";
100  for (unsigned int i=0; i<materialsTop_.size(); ++i)
101  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << namesTop_[i]
102  << " of thickness " << layerThickTop_[i]
103  << " filled with " << materialsTop_[i]
104  << " first copy number " <<copyNumberTop_[i];
105  edm::LogVerbatim("HGCalGeom") << "There are " << layerTypeTop_.size()
106  << " layers in the top part" ;
107  for (unsigned int i=0; i<layerTypeTop_.size(); ++i)
108  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type "
109  << layerTypeTop_[i];
110 #endif
111  materialsBot_ = vsArgs["BottomMaterialNames"];
112  namesBot_ = vsArgs["BottomVolumeNames"];
113  layerTypeBot_ = dbl_to_int(vArgs["BottomLayerType"]);
114  layerSenseBot_= dbl_to_int(vArgs["BottomLayerSense"]);
115  layerThickBot_= vArgs["BottomLayerThickness"];
116  for (unsigned int i=0; i<materialsBot_.size(); ++i) {
117  copyNumberBot_.emplace_back(1);
118  }
119 #ifdef EDM_ML_DEBUG
120  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << materialsBot_.size()
121  << " types of volumes in the bottom part";
122  for (unsigned int i=0; i<materialsBot_.size(); ++i)
123  edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << namesBot_[i]
124  << " of thickness " << layerThickBot_[i]
125  << " filled with " << materialsBot_[i]
126  << " first copy number " <<copyNumberBot_[i];
127  edm::LogVerbatim("HGCalGeom") << "There are " << layerTypeBot_.size()
128  << " layers in the top part" ;
129  for (unsigned int i=0; i<layerTypeBot_.size(); ++i)
130  edm::LogVerbatim("HGCalGeom") << "Layer [" << i << "] with material type "
131  << layerTypeBot_[i] << " sensitive class "
132  << layerSenseBot_[i];
133 #endif
134  zMinBlock_ = nArgs["zMinBlock"];
135  rad100to200_ = vArgs["rad100to200"];
136  rad200to300_ = vArgs["rad200to300"];
137  zMinRadPar_ = nArgs["zMinForRadPar"];
138  choiceType_ = (int)(nArgs["choiceType"]);
139  nCutRadPar_ = (int)(nArgs["nCornerCut"]);
140  fracAreaMin_ = nArgs["fracAreaMin"];
141  waferSize_ = nArgs["waferSize"];
142  waferSepar_ = nArgs["SensorSeparation"];
143  sectors_ = (int)(nArgs["Sectors"]);
144 #ifdef EDM_ML_DEBUG
145  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: zStart " << zMinBlock_
146  << " radius for wafer type separation uses "
147  << rad100to200_.size() << " parameters; zmin "
148  << zMinRadPar_ << " cutoff " << choiceType_
149  << ":" << nCutRadPar_ << ":" << fracAreaMin_
150  << " wafer width " << waferSize_
151  << " separations " << waferSepar_
152  << " sectors " << sectors_;
153  for (unsigned int k=0; k<rad100to200_.size(); ++k)
154  edm::LogVerbatim("HGCalGeom") << "[" << k << "] 100-200 " <<rad100to200_[k]
155  << " 200-300 " << rad200to300_[k];
156 #endif
157  slopeB_ = vArgs["SlopeBottom"];
158  zFrontB_ = vArgs["ZFrontBottom"];
159  rMinFront_ = vArgs["RMinFront"];
160  slopeT_ = vArgs["SlopeTop"];
161  zFrontT_ = vArgs["ZFrontTop"];
162  rMaxFront_ = vArgs["RMaxFront"];
163 #ifdef EDM_ML_DEBUG
164  for (unsigned int i=0; i<slopeB_.size(); ++i)
165  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFrontB_[i]
166  << " Rmin " << rMinFront_[i] << " Slope "
167  << slopeB_[i];
168  for (unsigned int i=0; i<slopeT_.size(); ++i)
169  edm::LogVerbatim("HGCalGeom") << "Block [" << i << "] Zmin " << zFrontT_[i]
170  << " Rmax " << rMaxFront_[i] << " Slope "
171  << slopeT_[i];
172 #endif
174 #ifdef EDM_ML_DEBUG
175  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: NameSpace " << nameSpace_;
176 #endif
177 
178  waferType_ = std::make_unique<HGCalWaferType>(rad100to200_, rad200to300_,
182 }
183 
185 // DDHGCalHEAlgo methods...
187 
189 
190 #ifdef EDM_ML_DEBUG
191  edm::LogVerbatim("HGCalGeom") << "==>> Constructing DDHGCalHEAlgo...";
192  copies_.clear();
193 #endif
194  constructLayers (parent(), cpv);
195 #ifdef EDM_ML_DEBUG
196  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << copies_.size()
197  << " different wafer copy numbers";
198  int k(0);
199  for (std::unordered_set<int>::const_iterator itr=copies_.begin();
200  itr != copies_.end(); ++itr,++k) {
201  edm::LogVerbatim("HGCalGeom") << "Copy [" << k << "] : " << (*itr);
202  }
203  copies_.clear();
204  edm::LogVerbatim("HGCalGeom") << "<<== End of DDHGCalHEAlgo construction...";
205 #endif
206 }
207 
209  DDCompactView& cpv) {
210 
211 #ifdef EDM_ML_DEBUG
212  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: \t\tInside Layers";
213 #endif
214  double zi(zMinBlock_);
215  int laymin(0);
216  const double tol(0.01);
217  for (unsigned int i=0; i<layers_.size(); i++) {
218  double zo = zi + layerThick_[i];
220  int laymax = laymin+layers_[i];
221  double zz = zi;
222  double thickTot(0);
223  std::vector<double> pgonZ(2), pgonRin(2), pgonRout(2);
224  for (int ly=laymin; ly<laymax; ++ly) {
225  int ii = layerType_[ly];
226  int copy = copyNumber_[ii];
227  double hthick = 0.5*thick_[ii];
229  zz += hthick;
230  thickTot += thick_[ii];
231 
232  std::string name = names_[ii]+std::to_string(copy);
233 #ifdef EDM_ML_DEBUG
234  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":"
235  << ii << " Front " << zi << ", " << routF
236  << " Back " << zo << ", " << rinB
237  << " superlayer thickness "
238  << layerThick_[i];
239 #endif
240  DDName matName(DDSplit(materials_[ii]).first,
241  DDSplit(materials_[ii]).second);
242  DDMaterial matter(matName);
243  DDLogicalPart glog;
244  if (layerSense_[ly] == 0) {
245  double alpha = CLHEP::pi/sectors_;
246  double rmax = routF*cos(alpha) - tol;
247  pgonZ[0] =-hthick; pgonZ[1] = hthick;
248  pgonRin[0] = rinB; pgonRin[1] = rinB;
249  pgonRout[0] = rmax; pgonRout[1] = rmax;
251  sectors_,-alpha,CLHEP::twopi,
252  pgonZ, pgonRin, pgonRout);
253  glog = DDLogicalPart(solid.ddname(), matter, solid);
254 #ifdef EDM_ML_DEBUG
255  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
256  << " polyhedra of " << sectors_
257  << " sectors covering "
258  << -alpha/CLHEP::deg << ":"
259  << (-alpha+CLHEP::twopi)/CLHEP::deg
260  << " with " << pgonZ.size()<<" sections";
261  for (unsigned int k=0; k<pgonZ.size(); ++k)
262  edm::LogVerbatim("HGCalGeom") << "[" << k << "] z " << pgonZ[k]
263  << " R " << pgonRin[k] << ":"
264  << pgonRout[k];
265 #endif
266  } else {
268  hthick, rinB, routF, 0.0,
269  CLHEP::twopi);
270  glog = DDLogicalPart(solid.ddname(), matter, solid);
271 #ifdef EDM_ML_DEBUG
272  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
273  << " Tubs made of " << matName
274  << " of dimensions " << rinB
275  << ", " << routF << ", " << hthick
276  << ", 0.0, " << CLHEP::twopi/CLHEP::deg;
277  edm::LogVerbatim("HGCalGeom") << "Position in: " << glog.name()
278  << " number " << copy;
279 #endif
280  positionMix(glog, name, copy, thick_[ii], matter, rinB, rMixLayer_[i],
281  routF, zz, cpv);
282  }
283  DDTranslation r1(0,0,zz);
284  DDRotation rot;
285  cpv.position(glog, module, copy, r1, rot);
286  ++copyNumber_[ii];
287 #ifdef EDM_ML_DEBUG
288  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog.name()
289  << " number " << copy
290  << " positioned in " << module.name()
291  << " at " << r1 << " with " << rot;
292 #endif
293  zz += hthick;
294  } // End of loop over layers in a block
295  zi = zo;
296  laymin = laymax;
297  if (std::abs(thickTot-layerThick_[i]) < 0.00001) {
298  } else if (thickTot > layerThick_[i]) {
299  edm::LogError("HGCalGeom") << "Thickness of the partition "
300  << layerThick_[i] << " is smaller than "
301  << thickTot << ": thickness of all its "
302  << "components **** ERROR ****";
303  } else if (thickTot < layerThick_[i]) {
304  edm::LogWarning("HGCalGeom") << "Thickness of the partition "
305  << layerThick_[i] << " does not match with "
306  << thickTot << " of the components";
307  }
308  } // End of loop over blocks
309 }
310 
312  const std::string& nameM, int copyM,
313  double thick, const DDMaterial& matter,
314  double rin, double rmid, double rout,
315  double zz, DDCompactView& cpv) {
316 
317  DDLogicalPart glog1;
318  DDTranslation tran;
319  DDRotation rot;
320  for (unsigned int ly=0; ly<layerTypeTop_.size(); ++ly) {
321  int ii = layerTypeTop_[ly];
322  copyNumberTop_[ii] = copyM;
323  }
324  for (unsigned int ly=0; ly<layerTypeBot_.size(); ++ly) {
325  int ii = layerTypeBot_[ly];
326  copyNumberBot_[ii] = copyM;
327  }
328  double hthick = 0.5*thick;
329  // Make the top part first
330  std::string name = nameM+"Top";
332  hthick, rmid, rout, 0.0,
333  CLHEP::twopi);
334  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
335 #ifdef EDM_ML_DEBUG
336  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
337  << " Tubs made of " << matter.name()
338  << " of dimensions " << rmid << ", " << rout
339  << ", " << hthick << ", 0.0, "
340  << CLHEP::twopi/CLHEP::deg;
341 #endif
342  cpv.position(glog1, glog, 1, tran, rot);
343 #ifdef EDM_ML_DEBUG
344  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog1.name()
345  << " number 1 positioned in " << glog.name()
346  << " at " << tran << " with " << rot;
347 #endif
348  double thickTot(0), zpos(-hthick);
349  for (unsigned int ly=0; ly<layerTypeTop_.size(); ++ly) {
350  int ii = layerTypeTop_[ly];
351  int copy = copyNumberTop_[ii];
352  double hthickl = 0.5*layerThickTop_[ii];
353  thickTot += layerThickTop_[ii];
354  name = namesTop_[ii]+std::to_string(copy);
355 #ifdef EDM_ML_DEBUG
356  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii
357  << " R " << rmid << ":" << rout << " Thick "
358  << layerThickTop_[ii];
359 #endif
360  DDName matName(DDSplit(materialsTop_[ii]).first,
362  DDMaterial matter1(matName);
363  solid = DDSolidFactory::tubs(DDName(name,nameSpace_), hthickl, rmid, rout,
364  0.0, CLHEP::twopi);
365  DDLogicalPart glog2 = DDLogicalPart(solid.ddname(), matter1, solid);
366 #ifdef EDM_ML_DEBUG
367  double eta1 = -log(tan(0.5*atan(rmid/zz)));
368  double eta2 = -log(tan(0.5*atan(rout/zz)));
369  edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << zz << ":"
370  << rmid << ":" << rout << " eta " << eta1
371  << ":" << eta2;
372  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
373  << " Tubs made of " << matName
374  << " of dimensions " << rmid << ", " << rout
375  << ", " << hthickl <<", 0.0, "
376  << CLHEP::twopi/CLHEP::deg;
377 #endif
378  zpos += hthickl;
379  DDTranslation r1(0,0,zpos);
380  cpv.position(glog2, glog1, copy, r1, rot);
381 #ifdef EDM_ML_DEBUG
382  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Position " << glog2.name()
383  << " number " << copy << " in "
384  << glog1.name() << " at " << r1
385  << " with " << rot;
386 #endif
387  ++copyNumberTop_[ii];
388  zpos += hthickl;
389  }
390  if (std::abs(thickTot-thick) < 0.00001) {
391  } else if (thickTot > thick) {
392  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick
393  << " is smaller than " << thickTot
394  << ": thickness of all its components in "
395  << "the top part **** ERROR ****";
396  } else if (thickTot < thick) {
397  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick
398  << " does not match with " << thickTot
399  << " of the components in top part";
400  }
401 
402  // Make the bottom part next
403  name = nameM+"Bottom";
404  solid = DDSolidFactory::tubs(DDName(name, nameSpace_),
405  hthick, rin, rmid, 0.0, CLHEP::twopi);
406  glog1 = DDLogicalPart(solid.ddname(), matter, solid);
407 #ifdef EDM_ML_DEBUG
408  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
409  << " Tubs made of " << matter.name()
410  << " of dimensions " << rin << ", " << rmid
411  << ", " << hthick << ", 0.0, "
412  << CLHEP::twopi/CLHEP::deg;
413 #endif
414  cpv.position(glog1, glog, 1, tran, rot);
415 #ifdef EDM_ML_DEBUG
416  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog1.name()
417  << " number 1 positioned in " << glog.name()
418  << " at " << tran << " with " << rot;
419 #endif
420  thickTot = 0;
421  zpos =-hthick;
422  for (unsigned int ly=0; ly<layerTypeBot_.size(); ++ly) {
423  int ii = layerTypeBot_[ly];
424  int copy = copyNumberBot_[ii];
425  double hthickl = 0.5*layerThickBot_[ii];
426  thickTot += layerThickBot_[ii];
427  name = namesBot_[ii]+std::to_string(copy);
428 #ifdef EDM_ML_DEBUG
429  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii
430  << " R " << rin << ":" << rmid << " Thick "
431  << layerThickBot_[ii];
432 #endif
433  DDName matName(DDSplit(materialsBot_[ii]).first,
435  DDMaterial matter1(matName);
436  solid = DDSolidFactory::tubs(DDName(name,nameSpace_), hthickl, rin, rmid,
437  0.0, CLHEP::twopi);
438  DDLogicalPart glog2 = DDLogicalPart(solid.ddname(), matter1, solid);
439 #ifdef EDM_ML_DEBUG
440  double eta1 = -log(tan(0.5*atan(rin/zz)));
441  double eta2 = -log(tan(0.5*atan(rmid/zz)));
442  edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << zz << ":"
443  << rin << ":" << rmid << " eta " << eta1
444  << ":" << eta2;
445  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name()
446  << " Tubs made of " << matName
447  << " of dimensions " << rin << ", " << rmid
448  << ", " << hthickl <<", 0.0, "
449  << CLHEP::twopi/CLHEP::deg;
450 #endif
451  zpos += hthickl;
452  DDTranslation r1(0,0,zpos);
453  cpv.position(glog2, glog1, copy, r1, rot);
454 #ifdef EDM_ML_DEBUG
455  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Position " << glog2.name()
456  << " number " << copy << " in "
457  << glog1.name() << " at " << r1
458  << " with " << rot;
459 #endif
460  if (layerSenseBot_[ly] != 0)
461  positionSensitive(glog2,rin,rmid,zz+zpos,layerSenseBot_[ly],cpv);
462  zpos += hthickl;
463  ++copyNumberBot_[ii];
464  }
465  if (std::abs(thickTot-thick) < 0.00001) {
466  } else if (thickTot > thick) {
467  edm::LogError("HGCalGeom") << "Thickness of the partition " << thick
468  << " is smaller than " << thickTot
469  << ": thickness of all its components in "
470  << "the top part **** ERROR ****";
471  } else if (thickTot < thick) {
472  edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick
473  << " does not match with " << thickTot
474  << " of the components in top part";
475  }
476 }
477 
478 void DDHGCalHEAlgo::positionSensitive(const DDLogicalPart& glog, double rin,
479  double rout, double zpos, int layertype,
480  DDCompactView& cpv) {
481  static const double sqrt3 = std::sqrt(3.0);
482  double r = 0.5*(waferSize_ + waferSepar_);
483  double R = 2.0*r/sqrt3;
484  double dy = 0.75*R;
485  int N = (int)(0.5*rout/r) + 2;
486  double xc[6], yc[6];
487 #ifdef EDM_ML_DEBUG
488  int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0), nin(0);
489  std::vector<int> ntype(6,0);
490  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << glog.ddname()
491  << " rout " << rout << " N " << N
492  << " for maximum u, v";
493 #endif
494  for (int u = -N; u <= N; ++u) {
495  int iu = std::abs(u);
496  for (int v = -N; v <= N; ++v) {
497  int iv = std::abs(v);
498  int nr = 2*v;
499  int nc =-2*u+v;
500  double xpos = nc*r;
501  double ypos = nr*dy;
502  xc[0] = xpos+r; yc[0] = ypos+0.5*R;
503  xc[1] = xpos; yc[1] = ypos+R;
504  xc[2] = xpos-r; yc[2] = ypos+0.5*R;
505  xc[3] = xpos-r; yc[3] = ypos-0.5*R;
506  xc[4] = xpos; yc[4] = ypos-R;
507  xc[5] = xpos+r; yc[5] = ypos-0.5*R;
508  bool cornerOne(false), cornerAll(true);
509  for (int k=0; k<6; ++k) {
510  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
511  if (rpos >= rin && rpos <= rout) cornerOne = true;
512  else cornerAll = false;
513  }
514 #ifdef EDM_ML_DEBUG
515  ++ntot;
516 #endif
517  if (cornerOne) {
518  int type = waferType_->getType(xpos,ypos,zpos);
519  int copy = type*1000000 + iv*100 + iu;
520  if (u < 0) copy += 10000;
521  if (v < 0) copy += 100000;
522 #ifdef EDM_ML_DEBUG
523  if (iu > ium) ium = iu;
524  if (iv > ivm) ivm = iv;
525  kount++;
526  if (copies_.count(copy) == 0) copies_.insert(copy);
527 #endif
528  if (cornerAll) {
529 #ifdef EDM_ML_DEBUG
530  if (iu > iumAll) iumAll = iu;
531  if (iv > ivmAll) ivmAll = iv;
532  ++nin;
533 #endif
534  DDTranslation tran(xpos, ypos, 0.0);
536  if (layertype > 1) type += 3;
538  DDSplit(wafers_[type]).second);
539  cpv.position(name, glog.ddname(), copy, tran, rotation);
540 #ifdef EDM_ML_DEBUG
541  ++ntype[type];
542  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << name
543  << " number " << copy
544  << " positioned in " << glog.ddname()
545  << " at " << tran
546  << " with " << rotation;
547 #endif
548  }
549  }
550  }
551  }
552 #ifdef EDM_ML_DEBUG
553  edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Maximum # of u " << ium
554  << ":" << iumAll << " # of v " << ivm << ":"
555  << ivmAll << " and " << nin << ":" << kount
556  << ":" << ntot << " wafers (" << ntype[0]
557  << ":" << ntype[1] << ":" << ntype[2] << ":"
558  << ntype[3] << ":" << ntype[4] << ":"
559  << ntype[5] << ") for " << glog.ddname()
560  << " R " << rin << ":" << rout;
561 #endif
562 }
std::vector< double > rMixLayer_
Definition: DDHGCalHEAlgo.h:52
type
Definition: HCALResponse.h:21
std::vector< int > layerTypeTop_
Definition: DDHGCalHEAlgo.h:59
float alpha
Definition: AMPTWrapper.h:95
std::vector< double > layerThickBot_
Definition: DDHGCalHEAlgo.h:63
const N & name() const
Definition: DDBase.h:74
void positionMix(const DDLogicalPart &glog, const std::string &name, int copy, double thick, const DDMaterial &matter, double rin, double rmid, double routF, double zz, DDCompactView &cpv)
double zMinBlock_
Definition: DDHGCalHEAlgo.h:68
def copy(args, dbName)
std::vector< double > slopeB_
Definition: DDHGCalHEAlgo.h:78
std::vector< std::string > materials_
Definition: DDHGCalHEAlgo.h:46
static double radius(double z, std::vector< double > const &zFront, std::vector< double > const &rFront, std::vector< double > const &slope)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:43
std::string nameSpace_
Definition: DDHGCalHEAlgo.h:84
std::vector< double > zFrontB_
Definition: DDHGCalHEAlgo.h:79
void execute(DDCompactView &cpv) override
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
static std::string & ns()
std::vector< double > thick_
Definition: DDHGCalHEAlgo.h:48
std::vector< std::string > namesTop_
Definition: DDHGCalHEAlgo.h:57
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
double zMinRadPar_
Definition: DDHGCalHEAlgo.h:71
~DDHGCalHEAlgo() override
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
int nin
const Double_t pi
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
U second(std::pair< T, U > const &p)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::unique_ptr< HGCalWaferType > waferType_
Definition: DDHGCalHEAlgo.h:43
std::vector< int > layerSense_
Definition: DDHGCalHEAlgo.h:54
std::vector< int > copyNumberBot_
Definition: DDHGCalHEAlgo.h:65
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< std::string > materialsBot_
Definition: DDHGCalHEAlgo.h:61
std::vector< double > slopeT_
Definition: DDHGCalHEAlgo.h:81
void constructLayers(const DDLogicalPart &, DDCompactView &cpv)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:865
std::vector< int > layers_
Definition: DDHGCalHEAlgo.h:50
std::vector< double > rMinFront_
Definition: DDHGCalHEAlgo.h:80
std::vector< double > rad100to200_
Definition: DDHGCalHEAlgo.h:69
ii
Definition: cuy.py:590
int k[5][pyjets_maxn]
std::vector< double > zFrontT_
Definition: DDHGCalHEAlgo.h:82
#define N
Definition: blowfish.cc:9
std::vector< double > layerThickTop_
Definition: DDHGCalHEAlgo.h:58
std::unordered_set< int > copies_
Definition: DDHGCalHEAlgo.h:85
std::vector< int > copyNumber_
Definition: DDHGCalHEAlgo.h:49
double waferSepar_
Definition: DDHGCalHEAlgo.h:76
std::vector< int > layerType_
Definition: DDHGCalHEAlgo.h:53
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< std::string > materialsTop_
Definition: DDHGCalHEAlgo.h:56
std::vector< int > copyNumberTop_
Definition: DDHGCalHEAlgo.h:60
void positionSensitive(const DDLogicalPart &glog, double rin, double rout, double zpos, int layertype, DDCompactView &cpv)
std::vector< int > layerSenseBot_
Definition: DDHGCalHEAlgo.h:66
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::vector< std::string > wafers_
Definition: DDHGCalHEAlgo.h:45
Definition: vlib.h:208
double fracAreaMin_
Definition: DDHGCalHEAlgo.h:74
std::vector< std::string > namesBot_
Definition: DDHGCalHEAlgo.h:62
std::vector< double > layerThick_
Definition: DDHGCalHEAlgo.h:51
static DDSolid polyhedra(const DDName &name, int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polyhedra (refere to Geant3 or Geant4 documentation)
Definition: DDSolid.cc:730
std::vector< std::string > names_
Definition: DDHGCalHEAlgo.h:47
std::vector< int > layerTypeBot_
Definition: DDHGCalHEAlgo.h:64
std::vector< double > rMaxFront_
Definition: DDHGCalHEAlgo.h:83
double waferSize_
Definition: DDHGCalHEAlgo.h:75
std::vector< double > rad200to300_
Definition: DDHGCalHEAlgo.h:70
const N & ddname() const
Definition: DDBase.h:76