CMS 3D CMS Logo

HGCalTBGeomParameters.cc
Go to the documentation of this file.
2 
5 
17 
18 #include <algorithm>
19 #include <sstream>
20 #include <unordered_set>
21 
22 //#define EDM_ML_DEBUG
23 using namespace geant_units::operators;
24 
25 const double tolerance = 0.001;
26 const double tolmin = 1.e-20;
27 
29 #ifdef EDM_ML_DEBUG
30  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters::HGCalTBGeomParameters "
31  << "constructor";
32 #endif
33 }
34 
36  HGCalTBParameters& php,
37  const std::string& sdTag1,
38  const DDCompactView* cpv,
39  const std::string& sdTag2,
40  const std::string& sdTag3,
42  DDFilteredView fv = _fv;
43  bool dodet(true);
44  std::map<int, HGCalTBGeomParameters::layerParameters> layers;
45  std::vector<HGCalTBParameters::hgtrform> trforms;
46  std::vector<bool> trformUse;
47 
48  while (dodet) {
49  const DDSolid& sol = fv.logicalPart().solid();
50  // Layers first
51  std::vector<int> copy = fv.copyNumbers();
52  int nsiz = static_cast<int>(copy.size());
53  int lay = (nsiz > 0) ? copy[nsiz - 1] : 0;
54  int zp = (nsiz > 2) ? copy[nsiz - 3] : -1;
55  if (zp != 1)
56  zp = -1;
57  if (lay == 0) {
58  throw cms::Exception("DDException") << "Funny layer # " << lay << " zp " << zp << " in " << nsiz << " components";
59  } else {
60  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
61  php.layer_.emplace_back(lay);
62  auto itr = layers.find(lay);
63  if (itr == layers.end()) {
64  double rin(0), rout(0);
66  if ((sol.shape() == DDSolidShape::ddpolyhedra_rz) || (sol.shape() == DDSolidShape::ddpolyhedra_rrz)) {
67  const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
68  const std::vector<double>& rmin = polyhedra.rMinVec();
69  const std::vector<double>& rmax = polyhedra.rMaxVec();
70  rin = 0.5 * HGCalTBParameters::k_ScaleFromDDD * (rmin[0] + rmin[1]);
71  rout = 0.5 * HGCalTBParameters::k_ScaleFromDDD * (rmax[0] + rmax[1]);
72  } else if (sol.shape() == DDSolidShape::ddtubs) {
73  const DDTubs& tube = static_cast<DDTubs>(sol);
76  }
77  HGCalTBGeomParameters::layerParameters laypar(rin, rout, zz);
78  layers[lay] = laypar;
79  }
80  DD3Vector x, y, z;
81  fv.rotation().GetComponents(x, y, z);
82  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
83  const CLHEP::HepRotation hr(rotation);
85  if (std::abs(xx) < tolerance)
86  xx = 0;
88  if (std::abs(yy) < tolerance)
89  yy = 0;
91  const CLHEP::Hep3Vector h3v(xx, yy, zz);
93  mytrf.zp = zp;
94  mytrf.lay = lay;
95  mytrf.sec = 0;
96  mytrf.subsec = 0;
97  mytrf.h3v = h3v;
98  mytrf.hr = hr;
99  trforms.emplace_back(mytrf);
100  trformUse.emplace_back(false);
101  }
102  dodet = fv.next();
103  }
104 
105  // Then wafers
106  // This assumes layers are build starting from 1 (which on 25 Jan 2016, they
107  // were) to ensure that new copy numbers are always added to the end of the
108  // list.
109  std::unordered_map<int32_t, int32_t> copies;
110  HGCalTBParameters::layer_map copiesInLayers(layers.size() + 1);
111  std::vector<int32_t> wafer2copy;
112  std::vector<HGCalTBGeomParameters::cellParameters> wafers;
113  std::string attribute = "Volume";
114  DDValue val1(attribute, sdTag2, 0.0);
115  DDSpecificsMatchesValueFilter filter1{val1};
116  DDFilteredView fv1(*cpv, filter1);
117  bool ok = fv1.firstChild();
118  if (!ok) {
119  throw cms::Exception("DDException") << "Attribute " << val1 << " not found but needed.";
120  } else {
121  dodet = true;
122  std::unordered_set<std::string> names;
123  while (dodet) {
124  const DDSolid& sol = fv1.logicalPart().solid();
125  const std::string& name = fv1.logicalPart().name().name();
126  std::vector<int> copy = fv1.copyNumbers();
127  int nsiz = static_cast<int>(copy.size());
128  int wafer = (nsiz > 0) ? copy[nsiz - 1] : 0;
129  int layer = (nsiz > 1) ? copy[nsiz - 2] : 0;
130  if (nsiz < 2) {
131  throw cms::Exception("DDException") << "Funny wafer # " << wafer << " in " << nsiz << " components";
132  } else if (layer > static_cast<int>(layers.size())) {
133  edm::LogWarning("HGCalGeom") << "Funny wafer # " << wafer << " Layer " << layer << ":" << layers.size()
134  << " among " << nsiz << " components";
135  } else {
136  auto itr = copies.find(wafer);
137  auto cpy = copiesInLayers[layer].find(wafer);
138  if (itr != copies.end() && cpy == copiesInLayers[layer].end()) {
139  copiesInLayers[layer][wafer] = itr->second;
140  }
141  if (itr == copies.end()) {
142  copies[wafer] = wafer2copy.size();
143  copiesInLayers[layer][wafer] = wafer2copy.size();
144  double xx = HGCalTBParameters::k_ScaleFromDDD * fv1.translation().X();
145  if (std::abs(xx) < tolerance)
146  xx = 0;
147  double yy = HGCalTBParameters::k_ScaleFromDDD * fv1.translation().Y();
148  if (std::abs(yy) < tolerance)
149  yy = 0;
150  wafer2copy.emplace_back(wafer);
152  HGCalTBGeomParameters::cellParameters cell(false, wafer, p);
153  wafers.emplace_back(cell);
154  if (names.count(name) == 0) {
155  std::vector<double> zv, rv;
157  const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
158  zv = polyhedra.zVec();
159  rv = polyhedra.rMaxVec();
160  } else {
161  const DDExtrudedPolygon& polygon = static_cast<DDExtrudedPolygon>(sol);
162  zv = polygon.zVec();
163  rv = polygon.xVec();
164  }
167  double dz = 0.5 * HGCalTBParameters::k_ScaleFromDDDToG4 * (zv[1] - zv[0]);
168 #ifdef EDM_ML_DEBUG
169  edm::LogVerbatim("HGCalGeom")
170  << "Mode " << mode << " R " << php.waferSize_ << ":" << php.waferR_ << " z " << dz;
171 #endif
173  mytr.lay = 1;
174  mytr.bl = php.waferR_;
175  mytr.tl = php.waferR_;
176  mytr.h = php.waferR_;
177  mytr.dz = dz;
178  mytr.alpha = 0.0;
179  mytr.cellSize = waferSize_;
180  php.fillModule(mytr, false);
181  names.insert(name);
182  }
183  }
184  }
185  dodet = fv1.next();
186  }
187  }
188 
189  // Finally the cells
190  std::map<int, int> wafertype;
191  std::map<int, HGCalTBGeomParameters::cellParameters> cellsf, cellsc;
192  DDValue val2(attribute, sdTag3, 0.0);
193  DDSpecificsMatchesValueFilter filter2{val2};
194  DDFilteredView fv2(*cpv, filter2);
195  ok = fv2.firstChild();
196  if (!ok) {
197  throw cms::Exception("DDException") << "Attribute " << val2 << " not found but needed.";
198  } else {
199  dodet = true;
200  while (dodet) {
201  const DDSolid& sol = fv2.logicalPart().solid();
202  const std::string& name = sol.name().name();
203  std::vector<int> copy = fv2.copyNumbers();
204  int nsiz = static_cast<int>(copy.size());
205  int cellx = (nsiz > 0) ? copy[nsiz - 1] : 0;
206  int wafer = (nsiz > 1) ? copy[nsiz - 2] : 0;
207  int cell = HGCalTypes::getUnpackedCell6(cellx);
209  if (type != 1 && type != 2) {
210  throw cms::Exception("DDException")
211  << "Funny cell # " << cell << " type " << type << " in " << nsiz << " components";
212  } else {
213  auto ktr = wafertype.find(wafer);
214  if (ktr == wafertype.end())
215  wafertype[wafer] = type;
216  bool newc(false);
217  std::map<int, HGCalTBGeomParameters::cellParameters>::iterator itr;
218  double cellsize = php.cellSize_[0];
219  if (type == 1) {
220  itr = cellsf.find(cell);
221  newc = (itr == cellsf.end());
222  } else {
223  itr = cellsc.find(cell);
224  newc = (itr == cellsc.end());
225  cellsize = php.cellSize_[1];
226  }
227  if (newc) {
228  bool half = (name.find("Half") != std::string::npos);
229  double xx = HGCalTBParameters::k_ScaleFromDDD * fv2.translation().X();
230  double yy = HGCalTBParameters::k_ScaleFromDDD * fv2.translation().Y();
231  if (half) {
232  math::XYZPointD p1(-2.0 * cellsize / 9.0, 0, 0);
233  math::XYZPointD p2 = fv2.rotation()(p1);
236 #ifdef EDM_ML_DEBUG
238  p2.SetX(0.0);
240  p2.SetZ(0.0);
241  edm::LogVerbatim("HGCalGeom") << "Wafer " << wafer << " Type " << type << " Cell " << cellx << " local "
242  << xx << ":" << yy << " new " << p1 << ":" << p2;
243 #endif
244  }
246  if (type == 1) {
247  cellsf[cell] = cp;
248  } else {
249  cellsc[cell] = cp;
250  }
251  }
252  }
253  dodet = fv2.next();
254  }
255  }
256 
258  layers, trforms, trformUse, copies, copiesInLayers, wafer2copy, wafers, wafertype, cellsf, cellsc, php);
259 }
260 
262  HGCalTBParameters& php,
263  const std::string& sdTag1,
264  const std::string& sdTag2,
265  const std::string& sdTag3,
267  const cms::DDFilter filter("Volume", sdTag1);
268  cms::DDFilteredView fv((*cpv), filter);
269  std::map<int, HGCalTBGeomParameters::layerParameters> layers;
270  std::vector<HGCalTBParameters::hgtrform> trforms;
271  std::vector<bool> trformUse;
272  std::vector<std::pair<int, int> > trused;
273 
274  while (fv.firstChild()) {
275  const std::vector<double>& pars = fv.parameters();
276  // Layers first
277  std::vector<int> copy = fv.copyNos();
278  int nsiz = static_cast<int>(copy.size());
279  int lay = (nsiz > 0) ? copy[0] : 0;
280  int zp = (nsiz > 2) ? copy[2] : -1;
281  if (zp != 1)
282  zp = -1;
283  if (lay == 0) {
284  throw cms::Exception("DDException") << "Funny layer # " << lay << " zp " << zp << " in " << nsiz << " components";
285  } else {
286  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
287  php.layer_.emplace_back(lay);
288  auto itr = layers.find(lay);
290  if (itr == layers.end()) {
291  double rin(0), rout(0);
292  if (dd4hep::isA<dd4hep::Polyhedra>(fv.solid())) {
293  rin = 0.5 * HGCalTBParameters::k_ScaleFromDD4hep * (pars[5] + pars[8]);
294  rout = 0.5 * HGCalTBParameters::k_ScaleFromDD4hep * (pars[6] + pars[9]);
295  } else if (dd4hep::isA<dd4hep::Tube>(fv.solid())) {
296  dd4hep::Tube tubeSeg(fv.solid());
297  rin = HGCalTBParameters::k_ScaleFromDD4hep * tubeSeg.rMin();
298  rout = HGCalTBParameters::k_ScaleFromDD4hep * tubeSeg.rMax();
299  }
300  HGCalTBGeomParameters::layerParameters laypar(rin, rout, zz);
301  layers[lay] = laypar;
302  }
303  std::pair<int, int> layz(lay, zp);
304  if (std::find(trused.begin(), trused.end(), layz) == trused.end()) {
305  trused.emplace_back(layz);
306  DD3Vector x, y, z;
307  fv.rotation().GetComponents(x, y, z);
308  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
309  const CLHEP::HepRotation hr(rotation);
311  if (std::abs(xx) < tolerance)
312  xx = 0;
314  if (std::abs(yy) < tolerance)
315  yy = 0;
317  const CLHEP::Hep3Vector h3v(xx, yy, zz);
319  mytrf.zp = zp;
320  mytrf.lay = lay;
321  mytrf.sec = 0;
322  mytrf.subsec = 0;
323  mytrf.h3v = h3v;
324  mytrf.hr = hr;
325  trforms.emplace_back(mytrf);
326  trformUse.emplace_back(false);
327  }
328  }
329  }
330 
331  // Then wafers
332  // This assumes layers are build starting from 1 (which on 25 Jan 2016, they
333  // were) to ensure that new copy numbers are always added to the end of the
334  // list.
335  std::unordered_map<int32_t, int32_t> copies;
336  HGCalTBParameters::layer_map copiesInLayers(layers.size() + 1);
337  std::vector<int32_t> wafer2copy;
338  std::vector<HGCalTBGeomParameters::cellParameters> wafers;
339  const cms::DDFilter filter1("Volume", sdTag2);
340  cms::DDFilteredView fv1((*cpv), filter1);
341  bool ok = fv1.firstChild();
342  if (!ok) {
343  throw cms::Exception("DDException") << "Attribute " << sdTag2 << " not found but needed.";
344  } else {
345  bool dodet = true;
346  std::unordered_set<std::string> names;
347  while (dodet) {
348  const std::string name = static_cast<std::string>(fv1.name());
349  std::vector<int> copy = fv1.copyNos();
350  int nsiz = static_cast<int>(copy.size());
351  int wafer = (nsiz > 0) ? copy[0] : 0;
352  int layer = (nsiz > 1) ? copy[1] : 0;
353  if (nsiz < 2) {
354  throw cms::Exception("DDException") << "Funny wafer # " << wafer << " in " << nsiz << " components";
355  } else if (layer > static_cast<int>(layers.size())) {
356  edm::LogWarning("HGCalGeom") << "Funny wafer # " << wafer << " Layer " << layer << ":" << layers.size()
357  << " among " << nsiz << " components";
358  } else {
359  auto itr = copies.find(wafer);
360  auto cpy = copiesInLayers[layer].find(wafer);
361  if (itr != copies.end() && cpy == copiesInLayers[layer].end()) {
362  copiesInLayers[layer][wafer] = itr->second;
363  }
364  if (itr == copies.end()) {
365  copies[wafer] = wafer2copy.size();
366  copiesInLayers[layer][wafer] = wafer2copy.size();
368  if (std::abs(xx) < tolerance)
369  xx = 0;
371  if (std::abs(yy) < tolerance)
372  yy = 0;
373  wafer2copy.emplace_back(wafer);
375  HGCalTBGeomParameters::cellParameters cell(false, wafer, p);
376  wafers.emplace_back(cell);
377  if (names.count(name) == 0) {
378  double zv[2], rv;
379  const std::vector<double>& pars = fv1.parameters();
381  zv[0] = pars[4];
382  zv[1] = pars[7];
383  rv = pars[6];
384  } else {
385  zv[0] = pars[3];
386  zv[1] = pars[9];
387  rv = pars[4];
388  }
391  double dz = 0.5 * HGCalTBParameters::k_ScaleFromDD4hepToG4 * (zv[1] - zv[0]);
392 #ifdef EDM_ML_DEBUG
393  edm::LogVerbatim("HGCalGeom")
394  << "Mode " << mode << " R " << php.waferSize_ << ":" << php.waferR_ << " z " << dz;
395 #endif
397  mytr.lay = 1;
398  mytr.bl = php.waferR_;
399  mytr.tl = php.waferR_;
400  mytr.h = php.waferR_;
401  mytr.dz = dz;
402  mytr.alpha = 0.0;
403  mytr.cellSize = waferSize_;
404  php.fillModule(mytr, false);
405  names.insert(name);
406  }
407  }
408  }
409  dodet = fv1.firstChild();
410  }
411  }
412 
413  // Finally the cells
414  std::map<int, int> wafertype;
415  std::map<int, HGCalTBGeomParameters::cellParameters> cellsf, cellsc;
416  const cms::DDFilter filter2("Volume", sdTag3);
417  cms::DDFilteredView fv2((*cpv), filter2);
418  ok = fv2.firstChild();
419  if (!ok) {
420  throw cms::Exception("DDException") << "Attribute " << sdTag3 << " not found but needed.";
421  } else {
422  bool dodet = true;
423  while (dodet) {
424  const std::string name = static_cast<std::string>(fv2.name());
425  std::vector<int> copy = fv2.copyNos();
426  int nsiz = static_cast<int>(copy.size());
427  int cellx = (nsiz > 0) ? copy[0] : 0;
428  int wafer = (nsiz > 1) ? copy[1] : 0;
429  int cell = HGCalTypes::getUnpackedCell6(cellx);
431  if (type != 1 && type != 2) {
432  throw cms::Exception("DDException")
433  << "Funny cell # " << cell << " type " << type << " in " << nsiz << " components";
434  } else {
435  auto ktr = wafertype.find(wafer);
436  if (ktr == wafertype.end())
437  wafertype[wafer] = type;
438  bool newc(false);
439  std::map<int, HGCalTBGeomParameters::cellParameters>::iterator itr;
440  double cellsize = php.cellSize_[0];
441  if (type == 1) {
442  itr = cellsf.find(cell);
443  newc = (itr == cellsf.end());
444  } else {
445  itr = cellsc.find(cell);
446  newc = (itr == cellsc.end());
447  cellsize = php.cellSize_[1];
448  }
449  if (newc) {
450  bool half = (name.find("Half") != std::string::npos);
453  if (half) {
454  math::XYZPointD p1(-2.0 * cellsize / 9.0, 0, 0);
455  math::XYZPointD p2 = fv2.rotation()(p1);
458 #ifdef EDM_ML_DEBUG
460  p2.SetX(0.0);
462  p2.SetZ(0.0);
463  edm::LogVerbatim("HGCalGeom") << "Wafer " << wafer << " Type " << type << " Cell " << cellx << " local "
464  << xx << ":" << yy << " new " << p1 << ":" << p2;
465 #endif
466  }
468  if (type == 1) {
469  cellsf[cell] = cp;
470  } else {
471  cellsc[cell] = cp;
472  }
473  }
474  }
475  dodet = fv2.firstChild();
476  }
477  }
478 
480  layers, trforms, trformUse, copies, copiesInLayers, wafer2copy, wafers, wafertype, cellsf, cellsc, php);
481 }
482 
483 void HGCalTBGeomParameters::loadGeometryHexagon(const std::map<int, HGCalTBGeomParameters::layerParameters>& layers,
484  std::vector<HGCalTBParameters::hgtrform>& trforms,
485  std::vector<bool>& trformUse,
486  const std::unordered_map<int32_t, int32_t>& copies,
487  const HGCalTBParameters::layer_map& copiesInLayers,
488  const std::vector<int32_t>& wafer2copy,
489  const std::vector<HGCalTBGeomParameters::cellParameters>& wafers,
490  const std::map<int, int>& wafertype,
491  const std::map<int, HGCalTBGeomParameters::cellParameters>& cellsf,
492  const std::map<int, HGCalTBGeomParameters::cellParameters>& cellsc,
493  HGCalTBParameters& php) {
494  if (((cellsf.size() + cellsc.size()) == 0) || (wafers.empty()) || (layers.empty())) {
495  throw cms::Exception("DDException") << "HGCalTBGeomParameters: mismatch between geometry and specpar: cells "
496  << cellsf.size() << ":" << cellsc.size() << " wafers " << wafers.size()
497  << " layers " << layers.size();
498  }
499 
500  for (unsigned int i = 0; i < layers.size(); ++i) {
501  for (auto& layer : layers) {
502  if (layer.first == static_cast<int>(i + php.firstLayer_)) {
503  php.layerIndex_.emplace_back(i);
504  php.rMinLayHex_.emplace_back(layer.second.rmin);
505  php.rMaxLayHex_.emplace_back(layer.second.rmax);
506  php.zLayerHex_.emplace_back(layer.second.zpos);
507  break;
508  }
509  }
510  }
511 
512  for (unsigned int i = 0; i < php.layer_.size(); ++i) {
513  for (unsigned int i1 = 0; i1 < trforms.size(); ++i1) {
514  if (!trformUse[i1] && php.layerGroup_[trforms[i1].lay - 1] == static_cast<int>(i + 1)) {
515  trforms[i1].h3v *= static_cast<double>(HGCalTBParameters::k_ScaleFromDDD);
516  trforms[i1].lay = (i + 1);
517  trformUse[i1] = true;
518  php.fillTrForm(trforms[i1]);
519  int nz(1);
520  for (unsigned int i2 = i1 + 1; i2 < trforms.size(); ++i2) {
521  if (!trformUse[i2] && trforms[i2].zp == trforms[i1].zp &&
522  php.layerGroup_[trforms[i2].lay - 1] == static_cast<int>(i + 1)) {
523  php.addTrForm(trforms[i2].h3v);
524  nz++;
525  trformUse[i2] = true;
526  }
527  }
528  if (nz > 0) {
529  php.scaleTrForm(double(1.0 / nz));
530  }
531  }
532  }
533  }
534 
535  double rmin = HGCalTBParameters::k_ScaleFromDDD * php.waferR_;
536  for (unsigned i = 0; i < wafer2copy.size(); ++i) {
537  php.waferCopy_.emplace_back(wafer2copy[i]);
538  php.waferPosX_.emplace_back(wafers[i].xyz.x());
539  php.waferPosY_.emplace_back(wafers[i].xyz.y());
540  auto ktr = wafertype.find(wafer2copy[i]);
541  int typet = (ktr == wafertype.end()) ? 0 : (ktr->second);
542  php.waferTypeT_.emplace_back(typet);
543  double r = wafers[i].xyz.perp();
544  int type(3);
545  for (int k = 1; k < 4; ++k) {
546  if ((r + rmin) <= php.boundR_[k]) {
547  type = k;
548  break;
549  }
550  }
551  php.waferTypeL_.emplace_back(type);
552  }
553  php.copiesInLayers_ = copiesInLayers;
554  php.nSectors_ = static_cast<int>(php.waferCopy_.size());
555 
556  std::vector<HGCalTBGeomParameters::cellParameters>::const_iterator itrf = wafers.end();
557  for (unsigned int i = 0; i < cellsf.size(); ++i) {
558  auto itr = cellsf.find(i);
559  if (itr == cellsf.end()) {
560  throw cms::Exception("DDException") << "HGCalTBGeomParameters: missing info for fine cell number " << i;
561  } else {
562  double xx = (itr->second).xyz.x();
563  double yy = (itr->second).xyz.y();
564  int waf = (itr->second).wafer;
565  std::pair<double, double> xy = cellPosition(wafers, itrf, waf, xx, yy);
566  php.cellFineX_.emplace_back(xy.first);
567  php.cellFineY_.emplace_back(xy.second);
568  php.cellFineHalf_.emplace_back((itr->second).half);
569  }
570  }
571  itrf = wafers.end();
572  for (unsigned int i = 0; i < cellsc.size(); ++i) {
573  auto itr = cellsc.find(i);
574  if (itr == cellsc.end()) {
575  throw cms::Exception("DDException") << "HGCalTBGeomParameters: missing info for coarse cell number " << i;
576  } else {
577  double xx = (itr->second).xyz.x();
578  double yy = (itr->second).xyz.y();
579  int waf = (itr->second).wafer;
580  std::pair<double, double> xy = cellPosition(wafers, itrf, waf, xx, yy);
581  php.cellCoarseX_.emplace_back(xy.first);
582  php.cellCoarseY_.emplace_back(xy.second);
583  php.cellCoarseHalf_.emplace_back((itr->second).half);
584  }
585  }
586  int depth(0);
587  for (unsigned int i = 0; i < php.layerGroup_.size(); ++i) {
588  bool first(true);
589  for (unsigned int k = 0; k < php.layerGroup_.size(); ++k) {
590  if (php.layerGroup_[k] == static_cast<int>(i + 1)) {
591  if (first) {
592  php.depth_.emplace_back(i + 1);
593  php.depthIndex_.emplace_back(depth);
594  php.depthLayerF_.emplace_back(k);
595  ++depth;
596  first = false;
597  }
598  }
599  }
600  }
601  HGCalTBParameters::hgtrap mytr = php.getModule(0, false);
607  double dz = mytr.dz;
608  php.fillModule(mytr, true);
609  mytr.dz = 2 * dz;
610  php.fillModule(mytr, true);
611  mytr.dz = 3 * dz;
612  php.fillModule(mytr, true);
613 #ifdef EDM_ML_DEBUG
614  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters finds " << php.zLayerHex_.size() << " layers";
615  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
616  int k = php.layerIndex_[i];
617  edm::LogVerbatim("HGCalGeom") << "Layer[" << i << ":" << k << ":" << php.layer_[k]
618  << "] with r = " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
619  << " at z = " << php.zLayerHex_[i];
620  }
621  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters has " << php.depthIndex_.size() << " depths";
622  for (unsigned int i = 0; i < php.depthIndex_.size(); ++i) {
623  int k = php.depthIndex_[i];
624  edm::LogVerbatim("HGCalGeom") << "Reco Layer[" << i << ":" << k << "] First Layer " << php.depthLayerF_[i]
625  << " Depth " << php.depth_[k];
626  }
627  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters finds " << php.nSectors_ << " wafers";
628  for (unsigned int i = 0; i < php.waferCopy_.size(); ++i)
629  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << ": " << php.waferCopy_[i] << "] type " << php.waferTypeL_[i]
630  << ":" << php.waferTypeT_[i] << " at (" << php.waferPosX_[i] << ","
631  << php.waferPosY_[i] << ",0)";
632  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters: wafer radius " << php.waferR_ << " and dimensions of the "
633  << "wafers:";
634  edm::LogVerbatim("HGCalGeom") << "Sim[0] " << php.moduleLayS_[0] << " dx " << php.moduleBlS_[0] << ":"
635  << php.moduleTlS_[0] << " dy " << php.moduleHS_[0] << " dz " << php.moduleDzS_[0]
636  << " alpha " << php.moduleAlphaS_[0];
637  for (unsigned int k = 0; k < php.moduleLayR_.size(); ++k)
638  edm::LogVerbatim("HGCalGeom") << "Rec[" << k << "] " << php.moduleLayR_[k] << " dx " << php.moduleBlR_[k] << ":"
639  << php.moduleTlR_[k] << " dy " << php.moduleHR_[k] << " dz " << php.moduleDzR_[k]
640  << " alpha " << php.moduleAlphaR_[k];
641  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters finds " << php.cellFineX_.size() << " fine cells in a wafer";
642  for (unsigned int i = 0; i < php.cellFineX_.size(); ++i)
643  edm::LogVerbatim("HGCalGeom") << "Fine Cell[" << i << "] at (" << php.cellFineX_[i] << "," << php.cellFineY_[i]
644  << ",0)";
645  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters finds " << php.cellCoarseX_.size()
646  << " coarse cells in a wafer";
647  for (unsigned int i = 0; i < php.cellCoarseX_.size(); ++i)
648  edm::LogVerbatim("HGCalGeom") << "Coarse Cell[" << i << "] at (" << php.cellCoarseX_[i] << ","
649  << php.cellCoarseY_[i] << ",0)";
650  edm::LogVerbatim("HGCalGeom") << "Obtained " << php.trformIndex_.size() << " transformation matrices";
651  for (unsigned int k = 0; k < php.trformIndex_.size(); ++k) {
652  edm::LogVerbatim("HGCalGeom") << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k] << std::dec
653  << ") Translation (" << php.trformTranX_[k] << ", " << php.trformTranY_[k] << ", "
654  << php.trformTranZ_[k] << " Rotation (" << php.trformRotXX_[k] << ", "
655  << php.trformRotYX_[k] << ", " << php.trformRotZX_[k] << ", " << php.trformRotXY_[k]
656  << ", " << php.trformRotYY_[k] << ", " << php.trformRotZY_[k] << ", "
657  << php.trformRotXZ_[k] << ", " << php.trformRotYZ_[k] << ", " << php.trformRotZZ_[k]
658  << ")";
659  }
660  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
661  for (unsigned int k = 0; k < php.copiesInLayers_.size(); ++k) {
662  const auto& theModules = php.copiesInLayers_[k];
663  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
664  int k2(0);
665  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin(); itr != theModules.end(); ++itr, ++k2) {
666  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":" << itr->second;
667  }
668  }
669 #endif
670 }
671 
673  HGCalTBParameters& php,
674  const DDCompactView* cpv,
675  const std::string& sdTag1,
676  const std::string& sdTag2) {
678  php.boundR_ = getDDDArray("RadiusBound", sv, 4);
680  php.rLimit_ = getDDDArray("RadiusLimits", sv, 2);
682  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv, 0));
683 
684  // Grouping of layers
685  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZFine", sv, 0));
686  php.layerGroupM_ = dbl_to_int(getDDDArray("GroupingZMid", sv, 0));
687  php.layerGroupO_ = dbl_to_int(getDDDArray("GroupingZOut", sv, 0));
688  php.slopeMin_ = getDDDArray("Slope", sv, 1);
689 
690  // Wafer size
691  std::string attribute = "Volume";
692  DDSpecificsMatchesValueFilter filter1{DDValue(attribute, sdTag1, 0.0)};
693  DDFilteredView fv1(*cpv, filter1);
694  if (fv1.firstChild()) {
696  const auto& dummy = getDDDArray("WaferSize", sv, 0);
697  waferSize_ = dummy[0];
698  }
699 
700  // Cell size
701  DDSpecificsMatchesValueFilter filter2{DDValue(attribute, sdTag2, 0.0)};
702  DDFilteredView fv2(*cpv, filter2);
703  if (fv2.firstChild()) {
705  php.cellSize_ = getDDDArray("CellSize", sv, 0);
706  }
707 
708  loadSpecParsHexagon(php);
709 }
710 
712  HGCalTBParameters& php,
713  const std::string& sdTag1,
714  const std::string& sdTag2,
715  const std::string& sdTag3,
716  const std::string& sdTag4) {
717  php.boundR_ = fv.get<std::vector<double> >(sdTag4, "RadiusBound");
719  php.rLimit_ = fv.get<std::vector<double> >(sdTag4, "RadiusLimits");
721  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(sdTag4, "LevelTop"));
722 
723  // Grouping of layers
724  php.layerGroup_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "GroupingZFine"));
725  php.layerGroupM_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "GroupingZMid"));
726  php.layerGroupO_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "GroupingZOut"));
727  php.slopeMin_ = fv.get<std::vector<double> >(sdTag4, "Slope");
728  if (php.slopeMin_.empty())
729  php.slopeMin_.emplace_back(0);
730 
731  // Wafer size
732  const auto& dummy = fv.get<std::vector<double> >(sdTag2, "WaferSize");
734 
735  // Cell size
736  php.cellSize_ = fv.get<std::vector<double> >(sdTag3, "CellSize");
738 
739  loadSpecParsHexagon(php);
740 }
741 
743 #ifdef EDM_ML_DEBUG
744  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters: wafer radius ranges"
745  << " for cell grouping " << php.boundR_[0] << ":" << php.boundR_[1] << ":"
746  << php.boundR_[2] << ":" << php.boundR_[3];
747  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters: Minimum/maximum R " << php.rLimit_[0] << ":"
748  << php.rLimit_[1];
749  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters: LevelTop " << php.levelT_[0];
750  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters: minimum slope " << php.slopeMin_[0]
751  << " and layer groupings "
752  << "for the 3 ranges:";
753  for (unsigned int k = 0; k < php.layerGroup_.size(); ++k)
754  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerGroup_[k] << ":" << php.layerGroupM_[k] << ":"
755  << php.layerGroupO_[k];
756  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters: Wafer Size: " << waferSize_;
757  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters: " << php.cellSize_.size() << " cells of sizes:";
758  for (unsigned int k = 0; k < php.cellSize_.size(); ++k)
759  edm::LogVerbatim("HGCalGeom") << " [" << k << "] " << php.cellSize_[k];
760  edm::LogVerbatim("HGCalGeom") << "HGCalTBGeomParameters: First Layer " << php.firstLayer_;
761 #endif
762 }
763 
766  double rin(php.rLimit_[0]), rout(php.rLimit_[1]), rMaxFine(php.boundR_[1]);
767 #ifdef EDM_ML_DEBUG
768  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":" << rmin << " R Limits: " << rin << ":" << rout
769  << " Fine " << rMaxFine;
770 #endif
771  // Clear the vectors
772  php.waferCopy_.clear();
773  php.waferTypeL_.clear();
774  php.waferTypeT_.clear();
775  php.waferPosX_.clear();
776  php.waferPosY_.clear();
777  double dx = 0.5 * waferW;
778  double dy = 3.0 * dx * tan(30._deg);
779  double rr = 2.0 * dx * tan(30._deg);
780  int ncol = static_cast<int>(2.0 * rout / waferW) + 1;
781  int nrow = static_cast<int>(rout / (waferW * tan(30._deg))) + 1;
782  int ns2 = (2 * ncol + 1) * (2 * nrow + 1) * php.layer_.size();
783  int incm(0), inrm(0);
784  HGCalTBParameters::layer_map copiesInLayers(php.layer_.size() + 1);
785  HGCalTBParameters::waferT_map waferTypes(ns2 + 1);
786 #ifdef EDM_ML_DEBUG
787  int kount(0), ntot(0);
788  edm::LogVerbatim("HGCalGeom") << "Row " << nrow << " Column " << ncol;
789 #endif
790  for (int nr = -nrow; nr <= nrow; ++nr) {
791  int inr = (nr >= 0) ? nr : -nr;
792  for (int nc = -ncol; nc <= ncol; ++nc) {
793  int inc = (nc >= 0) ? nc : -nc;
794  if (inr % 2 == inc % 2) {
795  double xpos = nc * dx;
796  double ypos = nr * dy;
797  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, rin, rout, true);
798  double rpos = std::sqrt(xpos * xpos + ypos * ypos);
799  int typet = (rpos < rMaxFine) ? 1 : 2;
800  int typel(3);
801  for (int k = 1; k < 4; ++k) {
802  if ((rpos + rmin) <= php.boundR_[k]) {
803  typel = k;
804  break;
805  }
806  }
807 #ifdef EDM_ML_DEBUG
808  ++ntot;
809 #endif
810  if (corner.first > 0) {
811  int copy = HGCalTypes::packTypeUV(typel, nc, nr);
812  if (inc > incm)
813  incm = inc;
814  if (inr > inrm)
815  inrm = inr;
816 #ifdef EDM_ML_DEBUG
817  kount++;
818  edm::LogVerbatim("HGCalGeom") << kount << ":" << ntot << " Copy " << copy << " Type " << typel << ":" << typet
819  << " Location " << corner.first << " Position " << xpos << ":" << ypos
820  << " Layers " << php.layer_.size();
821 #endif
822  php.waferCopy_.emplace_back(copy);
823  php.waferTypeL_.emplace_back(typel);
824  php.waferTypeT_.emplace_back(typet);
825  php.waferPosX_.emplace_back(xpos);
826  php.waferPosY_.emplace_back(ypos);
827  for (unsigned int il = 0; il < php.layer_.size(); ++il) {
828  std::pair<int, int> corner =
829  HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, php.rMinLayHex_[il], php.rMaxLayHex_[il], true);
830  if (corner.first > 0) {
831  auto cpy = copiesInLayers[php.layer_[il]].find(copy);
832  if (cpy == copiesInLayers[php.layer_[il]].end())
833  copiesInLayers[php.layer_[il]][copy] =
834  ((corner.first == static_cast<int>(HGCalTBParameters::k_CornerSize)) ? php.waferCopy_.size() : -1);
835  }
836  if ((corner.first > 0) && (corner.first < static_cast<int>(HGCalTBParameters::k_CornerSize))) {
837  int wl = HGCalWaferIndex::waferIndex(php.layer_[il], copy, 0, true);
838  waferTypes[wl] = corner;
839  }
840  }
841  }
842  }
843  }
844  }
845  php.copiesInLayers_ = copiesInLayers;
846  php.waferTypes_ = waferTypes;
847  php.nSectors_ = static_cast<int>(php.waferCopy_.size());
848  php.waferUVMax_ = 0;
849 #ifdef EDM_ML_DEBUG
850  edm::LogVerbatim("HGCalGeom") << "HGCalWaferHexagon: # of columns " << incm << " # of rows " << inrm << " and "
851  << kount << ":" << ntot << " wafers; R " << rin << ":" << rout;
852  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
853  for (unsigned int k = 0; k < copiesInLayers.size(); ++k) {
854  const auto& theModules = copiesInLayers[k];
855  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
856  int k2(0);
857  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin(); itr != theModules.end(); ++itr, ++k2) {
858  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":" << itr->second;
859  }
860  }
861 #endif
862 }
863 
865  // Special parameters for cell parameters
866  std::string attribute = "OnlyForHGCalNumbering";
867  DDSpecificsHasNamedValueFilter filter1{attribute};
868  DDFilteredView fv1(*cpv, filter1);
869  bool ok = fv1.firstChild();
870 
871  if (ok) {
872  php.cellFine_ = dbl_to_int(cpv->vector("waferFine"));
873  php.cellCoarse_ = dbl_to_int(cpv->vector("waferCoarse"));
874  }
875 
876  loadCellParsHexagon(php);
877 }
878 
880  for (auto const& it : vmap) {
881  if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "waferFine")) {
882  for (const auto& i : it.second)
883  php.cellFine_.emplace_back(std::round(i));
884  } else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), "waferCoarse")) {
885  for (const auto& i : it.second)
886  php.cellCoarse_.emplace_back(std::round(i));
887  }
888  }
889 
890  loadCellParsHexagon(php);
891 }
892 
894 #ifdef EDM_ML_DEBUG
895  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellFine_.size() << " rows for fine cells";
896  for (unsigned int k = 0; k < php.cellFine_.size(); ++k)
897  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellFine_[k];
898  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellCoarse_.size() << " rows for coarse cells";
899  for (unsigned int k = 0; k < php.cellCoarse_.size(); ++k)
900  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellCoarse_[k];
901 #endif
902 }
903 
905  const DDsvalues_type& sv,
906  const int nmin) {
907  DDValue value(str);
908  if (DDfetch(&sv, value)) {
909  const std::vector<double>& fvec = value.doubles();
910  int nval = fvec.size();
911  if (nmin > 0) {
912  if (nval < nmin) {
913  throw cms::Exception("DDException")
914  << "HGCalTBGeomParameters: # of " << str << " bins " << nval << " < " << nmin << " ==> illegal";
915  }
916  } else {
917  if (nval < 1 && nmin == 0) {
918  throw cms::Exception("DDException")
919  << "HGCalTBGeomParameters: # of " << str << " bins " << nval << " < 1 ==> illegal"
920  << " (nmin=" << nmin << ")";
921  }
922  }
923  return fvec;
924  } else {
925  if (nmin >= 0) {
926  throw cms::Exception("DDException") << "HGCalTBGeomParameters: cannot get array " << str;
927  }
928  std::vector<double> fvec;
929  return fvec;
930  }
931 }
932 
933 std::pair<double, double> HGCalTBGeomParameters::cellPosition(
934  const std::vector<HGCalTBGeomParameters::cellParameters>& wafers,
935  std::vector<HGCalTBGeomParameters::cellParameters>::const_iterator& itrf,
936  int wafer,
937  double xx,
938  double yy) {
939  if (itrf == wafers.end()) {
940  for (std::vector<HGCalTBGeomParameters::cellParameters>::const_iterator itr = wafers.begin(); itr != wafers.end();
941  ++itr) {
942  if (itr->wafer == wafer) {
943  itrf = itr;
944  break;
945  }
946  }
947  }
948  double dx(0), dy(0);
949  if (itrf != wafers.end()) {
950  dx = (xx - itrf->xyz.x());
951  if (std::abs(dx) < tolerance)
952  dx = 0;
953  dy = (yy - itrf->xyz.y());
954  if (std::abs(dy) < tolerance)
955  dy = 0;
956  }
957  return std::make_pair(dx, dy);
958 }
959 
960 void HGCalTBGeomParameters::rescale(std::vector<double>& v, const double s) {
961  std::for_each(v.begin(), v.end(), [s](double& n) { n *= s; });
962 }
963 
964 void HGCalTBGeomParameters::resetZero(std::vector<double>& v) {
965  for (auto& n : v) {
966  if (std::abs(n) < tolmin)
967  n = 0;
968  }
969 }
std::vector< double > moduleBlS_
Log< level::Info, true > LogVerbatim
std::vector< double > cellFineX_
nav_type copyNumbers() const
return the stack of copy numbers
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:335
void rescale(std::vector< double > &, const double s)
std::vector< int > layer_
std::vector< bool > cellCoarseHalf_
const std::vector< int > copyNos() const
The list of the volume copy numbers.
double rIn(void) const
Definition: DDSolid.cc:456
std::vector< int > waferCopy_
static constexpr double k_ScaleFromDDD
static int32_t getUnpackedCell6(int id)
Definition: HGCalTypes.cc:40
std::vector< double > rMaxLayHex_
std::vector< double > trformRotZY_
std::vector< double > xVec(void) const
Definition: DDSolid.cc:378
std::vector< double > const & vector(std::string_view iKey) const
returns an empty container if not found
std::vector< double > zVec(void) const
Definition: DDSolid.cc:328
float *__restrict__ zv
std::vector< double > moduleHS_
std::vector< double > trformRotZX_
const double tolmin
void loadWaferHexagon(HGCalTBParameters &php)
std::vector< double > moduleTlS_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:342
std::vector< std::unordered_map< int32_t, int32_t > > layer_map
double rOut(void) const
Definition: DDSolid.cc:458
static constexpr double k_ScaleFromDD4hepToG4
static constexpr double k_ScaleFromDD4hep
std::vector< double > trformTranX_
void resetZero(std::vector< double > &)
std::vector< int > waferTypeL_
std::vector< double > cellCoarseY_
std::vector< int > moduleLayR_
void scaleTrForm(double)
static constexpr uint32_t k_CornerSize
std::vector< double > moduleHR_
std::vector< double > boundR_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
std::vector< int > layerIndex_
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
std::vector< double > cellCoarseX_
const std::string names[nVars_]
std::vector< double > slopeMin_
std::vector< double > moduleAlphaR_
std::vector< int > cellFine_
std::unordered_map< std::string, std::vector< double > > DDVectorsMap
Definition: DDNamespace.h:20
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
std::vector< double > trformRotYZ_
std::vector< double > waferPosX_
std::vector< double > zVec(void) const
Definition: DDSolid.cc:387
static constexpr double k_ScaleFromDDDToG4
static int32_t getUnpackedCellType6(int id)
Definition: HGCalTypes.cc:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
std::vector< int > depthIndex_
std::string_view name() const
std::vector< double > moduleAlphaS_
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
const double tolerance
std::vector< double > zLayerHex_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
static constexpr double tol
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
std::vector< int > cellCoarse_
void fillTrForm(const hgtrform &mytr)
bool next()
set current node to the next node in the filtered tree
std::vector< int > waferTypeT_
T sqrt(T t)
Definition: SSEVec.h:19
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< double > moduleDzR_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void loadCellParsHexagon(const DDCompactView *cpv, HGCalTBParameters &php)
std::vector< double > getDDDArray(const std::string &str, const DDsvalues_type &sv, const int nmin)
Definition: value.py:1
static constexpr double tan30deg_
std::vector< double > trformTranZ_
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::vector< double > moduleBlR_
bool firstChild()
set the current node to the first child
std::vector< int > levelT_
std::vector< int > layerGroup_
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::vector< int > moduleLayS_
std::vector< double > trformRotXX_
DDsvalues_type mergedSpecifics() const
const N & name() const
Definition: DDBase.h:59
void fillModule(const hgtrap &mytr, bool reco)
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
T get(const std::string &)
extract attribute value
constexpr float sol
Definition: Config.h:13
std::vector< double > trformRotYX_
std::vector< double > rMinLayHex_
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double > > XYZPointD
point in space with cartesian internal representation
Definition: Point3D.h:8
std::vector< int > layerGroupM_
std::vector< double > trformRotZZ_
std::vector< double > cellFineY_
std::vector< double > cellSize_
std::vector< double > trformRotYY_
std::unordered_map< int32_t, std::pair< int32_t, int32_t > > waferT_map
void addTrForm(const CLHEP::Hep3Vector &h3v)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
dd4hep::Solid solid() const
std::pair< double, double > cellPosition(const std::vector< cellParameters > &wafers, std::vector< cellParameters >::const_iterator &itrf, int wafer, double xx, double yy)
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
const RotationMatrix rotation() const
std::vector< double > trformTranY_
std::vector< int > depth_
std::vector< uint32_t > trformIndex_
std::vector< int > depthLayerF_
void loadSpecParsHexagon(const DDFilteredView &fv, HGCalTBParameters &php, const DDCompactView *cpv, const std::string &sdTag1, const std::string &sdTag2)
std::vector< double > trformRotXY_
bool firstChild()
set the current node to the first child ...
std::vector< double > moduleTlR_
void loadGeometryHexagon(const DDFilteredView &_fv, HGCalTBParameters &php, const std::string &sdTag1, const DDCompactView *cpv, const std::string &sdTag2, const std::string &sdTag3, HGCalGeometryMode::WaferMode mode)
std::vector< bool > cellFineHalf_
std::vector< double > trformRotXZ_
static int32_t packTypeUV(int type, int u, int v)
Definition: HGCalTypes.cc:3
std::vector< int > layerGroupO_
Log< level::Warning, false > LogWarning
const DDTranslation & translation() const
The absolute translation of the current node.
#define str(s)
std::vector< double > moduleDzS_
const std::vector< double > parameters() const
extract shape parameters
__shared__ uint32_t ntot
std::vector< double > waferPosY_
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
std::vector< double > rLimit_
const Translation translation() const
hgtrap getModule(unsigned int k, bool reco) const