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