CMS 3D CMS Logo

HcalGeomParameters.cc
Go to the documentation of this file.
2 
5 
14 
15 //#define EDM_ML_DEBUG
16 using namespace geant_units::operators;
17 
18 static const double tan10deg = std::tan(10._deg);
19 
20 void HcalGeomParameters::getConstRHO(std::vector<double>& rHO) const {
21  rHO.emplace_back(rminHO_);
22  for (double i : etaHO_)
23  rHO.emplace_back(i);
24 }
25 
26 std::vector<int> HcalGeomParameters::getModHalfHBHE(const int type) const {
27  std::vector<int> modHalf;
28  if (type == 0) {
29  modHalf.emplace_back(nmodHB_);
30  modHalf.emplace_back(nzHB_);
31  } else {
32  modHalf.emplace_back(nmodHE_);
33  modHalf.emplace_back(nzHE_);
34  }
35  return modHalf;
36 }
37 
39  DDFilteredView fv = _fv;
40  bool dodet = true;
41  bool hf = false;
42  clear(php);
43 
44  while (dodet) {
46  std::vector<int> copy = fv.copyNumbers();
47  const DDSolid& sol = fv.logicalPart().solid();
48  int idet = 0, lay = -1;
49  int nsiz = static_cast<int>(copy.size());
50  if (nsiz > 0)
51  lay = copy[nsiz - 1] / 10;
52  if (nsiz > 6)
53  idet = copy[nsiz - 2] / 1000;
54  else if (nsiz > 4)
55  idet = copy[nsiz - 3] / 1000;
56  else if (nsiz > 1)
57  idet = copy[nsiz - 2] / 1000;
58 #ifdef EDM_ML_DEBUG
59  std::ostringstream st1;
60  for (unsigned int k = 0; k < copy.size(); ++k)
61  st1 << " " << copy[k];
62  edm::LogVerbatim("HCalGeom") << "Name " << fv.logicalPart().solid().name() << " Copy " << copy.size() << ":"
63  << st1.str();
64 #endif
65  double dx = 0, dy = 0, dz = 0, dx1 = 0, dx2 = 0;
66  double alp(0);
67  if (sol.shape() == DDSolidShape::ddbox) {
68  const DDBox& box = static_cast<DDBox>(sol);
72  } else if (sol.shape() == DDSolidShape::ddtrap) {
73  const DDTrap& trp = static_cast<DDTrap>(sol);
76  dx = 0.25 * HcalGeomParameters::k_ScaleFromDDDToG4 * (trp.x1() + trp.x2() + trp.x3() + trp.x4());
77  dy = 0.5 * HcalGeomParameters::k_ScaleFromDDDToG4 * (trp.y1() + trp.y2());
79  alp = 0.5 * (trp.alpha1() + trp.alpha2());
80  } else if (sol.shape() == DDSolidShape::ddtubs) {
81  const DDTubs& tub = static_cast<DDTubs>(sol);
85  }
86  if (idet == 3) {
87  // HB
88 #ifdef EDM_ML_DEBUG
89  edm::LogVerbatim("HCalGeom") << "HB " << sol.name() << " Shape " << sol.shape() << " Layer " << lay << " R "
90  << t.Rho();
91 #endif
92  if (lay >= 0 && lay < maxLayer_) {
93  ib_[lay]++;
94  rb_[lay] += (HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho());
95  if (thkb_[lay] <= 0) {
96  if (lay < 17)
97  thkb_[lay] = dx;
98  else
99  thkb_[lay] = std::min(dx, dy);
100  }
101  if (lay < 17) {
102  bool found = false;
103  for (double k : rxb_) {
104  if (std::abs(k - (HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho())) < 0.01) {
105  found = true;
106  break;
107  }
108  }
109  if (!found) {
110  rxb_.emplace_back(HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho());
111  php.rhoxHB.emplace_back(HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho() * std::cos(t.phi()));
112  php.zxHB.emplace_back(HcalGeomParameters::k_ScaleFromDDDToG4 * std::abs(t.z()));
113  php.dyHB.emplace_back(2. * dy);
114  php.dxHB.emplace_back(2. * dz);
115  php.layHB.emplace_back(lay);
116  }
117  }
118  }
119  if (lay == 2) {
120  int iz = copy[nsiz - 5];
121  int fi = copy[nsiz - 4];
122  unsigned int it1 = find(iz, izb_);
123  if (it1 == izb_.size())
124  izb_.emplace_back(iz);
125  unsigned int it2 = find(fi, phib_);
126  if (it2 == phib_.size())
127  phib_.emplace_back(fi);
128  }
129  if (lay == 18) {
130  int ifi = -1, ich = -1;
131  if (nsiz > 2)
132  ifi = copy[nsiz - 3];
133  if (nsiz > 3)
134  ich = copy[nsiz - 4];
135  double z1 = std::abs((HcalGeomParameters::k_ScaleFromDDDToG4 * t.z()) + dz);
137  if (std::abs(z1 - z2) < 0.01)
138  z1 = 0;
139  if (ifi == 1 && ich == 4) {
140  if (z1 > z2) {
141  double tmp = z1;
142  z1 = z2;
143  z2 = tmp;
144  }
145  bool sok = true;
146  for (unsigned int kk = 0; kk < php.zHO.size(); kk++) {
147  if (std::abs(z2 - php.zHO[kk]) < 0.01) {
148  sok = false;
149  break;
150  } else if (z2 < php.zHO[kk]) {
151  php.zHO.resize(php.zHO.size() + 2);
152  for (unsigned int kz = php.zHO.size() - 1; kz > kk + 1; kz = kz - 2) {
153  php.zHO[kz] = php.zHO[kz - 2];
154  php.zHO[kz - 1] = php.zHO[kz - 3];
155  }
156  php.zHO[kk + 1] = z2;
157  php.zHO[kk] = z1;
158  sok = false;
159  break;
160  }
161  }
162  if (sok) {
163  php.zHO.emplace_back(z1);
164  php.zHO.emplace_back(z2);
165  }
166 #ifdef EDM_ML_DEBUG
167  edm::LogVerbatim("HCalGeom") << "Detector " << idet << " Lay " << lay << " fi " << ifi << " " << ich << " z "
168  << z1 << " " << z2;
169 #endif
170  }
171  }
172  } else if (idet == 4) {
173  // HE
174 #ifdef EDM_ML_DEBUG
175  edm::LogVerbatim("HCalGeom") << "HE " << sol.name() << " Shape " << sol.shape() << " Layer " << lay << " Z "
176  << t.z();
177 #endif
178  if (lay >= 0 && lay < maxLayer_) {
179  ie_[lay]++;
181  if (thke_[lay] <= 0)
182  thke_[lay] = dz;
183  double rinHE = HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho() * cos(alp) - dy;
184  double routHE = HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho() * cos(alp) + dy;
185  rminHE_[lay] += rinHE;
186  rmaxHE_[lay] += routHE;
187  bool found = false;
188  for (double k : php.zxHE) {
190  found = true;
191  break;
192  }
193  }
194  if (!found) {
195  php.zxHE.emplace_back(HcalGeomParameters::k_ScaleFromDDDToG4 * std::abs(t.z()));
196  php.rhoxHE.emplace_back(HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho() * std::cos(t.phi()));
197  php.dyHE.emplace_back(dy * std::cos(t.phi()));
198  dx1 -= 0.5 * (HcalGeomParameters::k_ScaleFromDDDToG4 * t.rho() - dy) * std::cos(t.phi()) * tan10deg;
199  dx2 -= 0.5 * (HcalGeomParameters::k_ScaleFromDDDToG4 * t.rho() + dy) * std::cos(t.phi()) * tan10deg;
200  php.dx1HE.emplace_back(-dx1);
201  php.dx2HE.emplace_back(-dx2);
202  php.layHE.emplace_back(lay);
203  }
204  }
205  if (copy[nsiz - 1] == kHELayer1_ || copy[nsiz - 1] == kHELayer2_) {
206  int iz = copy[nsiz - 7];
207  int fi = copy[nsiz - 5];
208  unsigned int it1 = find(iz, ize_);
209  if (it1 == ize_.size())
210  ize_.emplace_back(iz);
211  unsigned int it2 = find(fi, phie_);
212  if (it2 == phie_.size())
213  phie_.emplace_back(fi);
214  }
215  } else if (idet == 5) {
216  // HF
217  if (!hf) {
218  const std::vector<double>& paras = sol.parameters();
219 #ifdef EDM_ML_DEBUG
220  edm::LogVerbatim("HCalGeom") << "HF " << sol.name() << " Shape " << sol.shape() << " Z " << t.z() << " with "
221  << paras.size() << " Parameters";
222  for (unsigned j = 0; j < paras.size(); j++)
223  edm::LogVerbatim("HCalGeom") << "HF Parameter[" << j << "] = " << paras[j];
224 #endif
225  if (sol.shape() == DDSolidShape::ddpolycone_rrz) {
226  int nz = (int)(paras.size()) - 3;
227  dzVcal_ = 0.5 * HcalGeomParameters::k_ScaleFromDDDToG4 * (paras[nz] - paras[3]);
228  hf = true;
229  } else if (sol.shape() == DDSolidShape::ddtubs || sol.shape() == DDSolidShape::ddcons) {
230  dzVcal_ = HcalGeomParameters::k_ScaleFromDDDToG4 * paras[0];
231  hf = true;
232  } else if (sol.shape() == DDSolidShape::ddtrap) {
233  dzVcal_ = HcalGeomParameters::k_ScaleFromDDDToG4 * paras[0];
234  hf = true;
235  }
236 #ifdef EDM_ML_DEBUG
237  edm::LogVerbatim("HCalGeom") << "Sets for Detector " << idet << " for " << sol.name() << " Flag " << hf
238  << " DZ " << dzVcal_;
239 #endif
240  }
241 #ifdef EDM_ML_DEBUG
242  } else {
243  edm::LogVerbatim("HCalGeom") << "Unknown Detector " << idet << " for " << sol.name() << " Shape " << sol.shape()
244  << " R " << t.Rho() << " Z " << t.z();
245 #endif
246  }
247  dodet = fv.next();
248  }
249 
250  loadfinal(php);
251 }
252 
254  const cms::DDFilter filter("OnlyForHcalSimNumbering", "HCAL");
255  cms::DDFilteredView fv(cpv, filter);
256  clear(php);
257  bool hf(false);
258  while (fv.firstChild()) {
259  auto t = fv.translation();
260  std::vector<double> paras = fv.parameters();
261  std::vector<int> copy = fv.copyNos();
262  int idet = 0, lay = -1;
263  int nsiz = static_cast<int>(copy.size());
264  if (nsiz > 0)
265  lay = copy[0] / 10;
266  if (nsiz > 6)
267  idet = copy[1] / 1000;
268  else if (nsiz > 4)
269  idet = copy[2] / 1000;
270  else if (nsiz > 1)
271  idet = copy[1] / 1000;
272 #ifdef EDM_ML_DEBUG
273  std::ostringstream st1;
274  for (unsigned int k = 0; k < copy.size(); ++k)
275  st1 << " " << copy[k];
276  edm::LogVerbatim("HCalGeom") << "Name " << fv.name() << " Copy " << copy.size() << ":" << st1.str();
277  for (unsigned int n = 0; n < copy.size(); ++n)
278  edm::LogVerbatim("HCalGeom") << "[" << n << "] " << copy[n];
279  edm::LogVerbatim("HCalGeom") << "Detector " << idet << " Layer " << lay << " parameters: " << paras.size();
280  for (unsigned int n = 0; n < paras.size(); ++n)
281  edm::LogVerbatim("HCalGeom") << "[" << n << "] " << paras[n];
282 #endif
283  double dx = 0, dy = 0, dz = 0, dx1 = 0, dx2 = 0;
284  double alp(0);
285  if (dd4hep::isA<dd4hep::Box>(fv.solid())) {
289  } else if (dd4hep::isA<dd4hep::Trap>(fv.solid())) {
292  dx = 0.25 * HcalGeomParameters::k_ScaleFromDD4hepToG4 * (paras[4] + paras[5] + paras[8] + paras[9]);
293  dy = 0.5 * HcalGeomParameters::k_ScaleFromDD4hepToG4 * (paras[3] + paras[7]);
295  alp = 0.5 * (paras[6] + paras[10]);
296  } else if (dd4hep::isA<dd4hep::Tube>(fv.solid())) {
300  }
301  if (idet == 3) {
302  // HB
303 #ifdef EDM_ML_DEBUG
304  edm::LogVerbatim("HCalGeom") << "HB " << fv.name() << " Shape " << cms::dd::name(cms::DDSolidShapeMap, fv.shape())
305  << " Layer " << lay << " R " << t.Rho();
306 #endif
307  if (lay >= 0 && lay < maxLayer_) {
308  ib_[lay]++;
309  rb_[lay] += (HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho());
310  if (thkb_[lay] <= 0) {
311  if (lay < 17)
312  thkb_[lay] = dx;
313  else
314  thkb_[lay] = std::min(dx, dy);
315  }
316  if (lay < 17) {
317  bool found = false;
318  for (double k : rxb_) {
319  if (std::abs(k - (HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho())) < 0.01) {
320  found = true;
321  break;
322  }
323  }
324  if (!found) {
325  rxb_.emplace_back(HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho());
326  php.rhoxHB.emplace_back(HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() * std::cos(t.phi()));
327  php.zxHB.emplace_back(std::abs(HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.z()));
328  php.dyHB.emplace_back(2. * dy);
329  php.dxHB.emplace_back(2. * dz);
330  php.layHB.emplace_back(lay);
331  }
332  }
333  }
334  if (lay == 2) {
335  int iz = copy[4];
336  int fi = copy[3];
337  unsigned int it1 = find(iz, izb_);
338  if (it1 == izb_.size())
339  izb_.emplace_back(iz);
340  unsigned int it2 = find(fi, phib_);
341  if (it2 == phib_.size())
342  phib_.emplace_back(fi);
343  }
344  if (lay == 18) {
345  int ifi = -1, ich = -1;
346  if (nsiz > 2)
347  ifi = copy[2];
348  if (nsiz > 3)
349  ich = copy[3];
352  if (std::abs(z1 - z2) < 0.01)
353  z1 = 0;
354  if (ifi == 1 && ich == 4) {
355  if (z1 > z2) {
356  double tmp = z1;
357  z1 = z2;
358  z2 = tmp;
359  }
360  bool sok = true;
361  for (unsigned int kk = 0; kk < php.zHO.size(); kk++) {
362  if (std::abs(z2 - php.zHO[kk]) < 0.01) {
363  sok = false;
364  break;
365  } else if (z2 < php.zHO[kk]) {
366  php.zHO.resize(php.zHO.size() + 2);
367  for (unsigned int kz = php.zHO.size() - 1; kz > kk + 1; kz = kz - 2) {
368  php.zHO[kz] = php.zHO[kz - 2];
369  php.zHO[kz - 1] = php.zHO[kz - 3];
370  }
371  php.zHO[kk + 1] = z2;
372  php.zHO[kk] = z1;
373  sok = false;
374  break;
375  }
376  }
377  if (sok) {
378  php.zHO.emplace_back(z1);
379  php.zHO.emplace_back(z2);
380  }
381 #ifdef EDM_ML_DEBUG
382  edm::LogVerbatim("HCalGeom") << "Detector " << idet << " Lay " << lay << " fi " << ifi << " " << ich << " z "
383  << z1 << " " << z2;
384 #endif
385  }
386  }
387  } else if (idet == 4) {
388  // HE
389 #ifdef EDM_ML_DEBUG
390  edm::LogVerbatim("HCalGeom") << "HE " << fv.name() << " Shape " << cms::dd::name(cms::DDSolidShapeMap, fv.shape())
391  << " Layer " << lay << " Z " << t.z();
392 #endif
393  if (lay >= 0 && lay < maxLayer_) {
394  ie_[lay]++;
396  if (thke_[lay] <= 0)
397  thke_[lay] = dz;
398  double rinHE = HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() * cos(alp) - dy;
399  double routHE = HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() * cos(alp) + dy;
400  rminHE_[lay] += rinHE;
401  rmaxHE_[lay] += routHE;
402  bool found = false;
403  for (double k : php.zxHE) {
405  found = true;
406  break;
407  }
408  }
409  if (!found) {
410  php.zxHE.emplace_back(std::abs(HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.z()));
411  php.rhoxHE.emplace_back(HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() * std::cos(t.phi()));
412  php.dyHE.emplace_back(dy * std::cos(t.phi()));
413  dx1 -= 0.5 * (HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() - dy) * std::cos(t.phi()) * tan10deg;
414  dx2 -= 0.5 * (HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() + dy) * std::cos(t.phi()) * tan10deg;
415  php.dx1HE.emplace_back(-dx1);
416  php.dx2HE.emplace_back(-dx2);
417  php.layHE.emplace_back(lay);
418  }
419  }
420  if (copy[0] == kHELayer1_ || copy[0] == kHELayer2_) {
421  int iz = copy[6];
422  int fi = copy[4];
423  unsigned int it1 = find(iz, ize_);
424  if (it1 == ize_.size())
425  ize_.emplace_back(iz);
426  unsigned int it2 = find(fi, phie_);
427  if (it2 == phie_.size())
428  phie_.emplace_back(fi);
429  }
430  } else if (idet == 5) {
431  // HF
432  if (!hf) {
433 #ifdef EDM_ML_DEBUG
434  edm::LogVerbatim("HCalGeom") << "HF " << fv.name() << " Shape "
435  << cms::dd::name(cms::DDSolidShapeMap, fv.shape()) << " Z "
436  << HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.z() << " with " << paras.size()
437  << " Parameters";
438  for (unsigned j = 0; j < paras.size(); j++)
439  edm::LogVerbatim("HCalGeom") << "HF Parameter[" << j << "] = " << paras[j];
440 #endif
441  if (dd4hep::isA<dd4hep::Polycone>(fv.solid())) {
442  int nz = (int)(paras.size()) - 3;
443  dzVcal_ = 0.5 * HcalGeomParameters::k_ScaleFromDD4hepToG4 * (paras[nz] - paras[3]);
444  hf = true;
445  } else if (dd4hep::isA<dd4hep::Tube>(fv.solid()) || dd4hep::isA<dd4hep::ConeSegment>(fv.solid())) {
446  dzVcal_ = HcalGeomParameters::k_ScaleFromDD4hepToG4 * paras[2];
447  hf = true;
448  } else if (dd4hep::isA<dd4hep::Trap>(fv.solid())) {
449  dzVcal_ = HcalGeomParameters::k_ScaleFromDD4hepToG4 * paras[0];
450  hf = true;
451  }
452 #ifdef EDM_ML_DEBUG
453  edm::LogVerbatim("HCalGeom") << "Sets for Detector " << idet << " for " << fv.name() << " Flag " << hf << " DZ "
454  << dzVcal_;
455 #endif
456  }
457 #ifdef EDM_ML_DEBUG
458  } else {
459  edm::LogVerbatim("HCalGeom") << "Unknown Detector " << idet << " for " << fv.name() << " Shape "
460  << cms::dd::name(cms::DDSolidShapeMap, fv.shape()) << " R "
461  << (HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho()) << " Z "
463 #endif
464  }
465  }
466  loadfinal(php);
467 }
468 
469 unsigned int HcalGeomParameters::find(int element, std::vector<int>& array) const {
470  unsigned int id = array.size();
471  for (unsigned int i = 0; i < array.size(); i++) {
472  if (element == array[i]) {
473  id = i;
474  break;
475  }
476  }
477  return id;
478 }
479 
480 double HcalGeomParameters::getEta(double r, double z) const {
481  double tmp = 0;
482  if (z != 0)
483  tmp = -log(tan(0.5 * atan(r / z)));
484 #ifdef EDM_ML_DEBUG
485  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters::getEta " << r << " " << z << " ==> " << tmp;
486 #endif
487  return tmp;
488 }
489 
491  php.rhoxHB.clear();
492  php.zxHB.clear();
493  php.dyHB.clear();
494  php.dxHB.clear();
495  php.layHB.clear();
496  php.layHE.clear();
497  php.zxHE.clear();
498  php.rhoxHE.clear();
499  php.dyHE.clear();
500  php.dx1HE.clear();
501  php.dx2HE.clear();
502 
503  // Initialize all variables
504  nzHB_ = nmodHB_ = 0;
505  nzHE_ = nmodHE_ = 0;
506  for (int i = 0; i < 4; ++i)
507  etaHO_[i] = 0;
508  zVcal_ = dzVcal_ = dlShort_ = 0;
509  rminHO_ = dzVcal_ = -1.;
510  for (int i = 0; i < maxLayer_; ++i) {
511  rb_.emplace_back(0.0);
512  ze_.emplace_back(0.0);
513  thkb_.emplace_back(-1.0);
514  thke_.emplace_back(-1.0);
515  ib_.emplace_back(0);
516  ie_.emplace_back(0);
517  rminHE_.emplace_back(0.0);
518  rmaxHE_.emplace_back(0.0);
519  }
520 }
521 
523  int ibmx = 0, iemx = 0;
524  for (int i = 0; i < maxLayer_; i++) {
525  if (ib_[i] > 0) {
526  rb_[i] /= static_cast<double>(ib_[i]);
527  ibmx = i + 1;
528  }
529  if (ie_[i] > 0) {
530  ze_[i] /= static_cast<double>(ie_[i]);
531  rminHE_[i] /= static_cast<double>(ie_[i]);
532  rmaxHE_[i] /= static_cast<double>(ie_[i]);
533  iemx = i + 1;
534  }
535 #ifdef EDM_ML_DEBUG
536  edm::LogVerbatim("HCalGeom") << "Index " << i << " Barrel " << ib_[i] << " " << rb_[i] << " Endcap " << ie_[i]
537  << " " << ze_[i] << ":" << rminHE_[i] << ":" << rmaxHE_[i];
538 #endif
539  }
540  for (int i = 4; i >= 0; i--) {
541  if (ib_[i] == 0) {
542  rb_[i] = rb_[i + 1];
543  thkb_[i] = thkb_[i + 1];
544  }
545  if (ie_[i] == 0) {
546  ze_[i] = ze_[i + 1];
547  thke_[i] = thke_[i + 1];
548  }
549 #ifdef EDM_ML_DEBUG
550  if (ib_[i] == 0 || ie_[i] == 0)
551  edm::LogVerbatim("HCalGeom") << "Index " << i << " Barrel " << ib_[i] << " " << rb_[i] << " Endcap " << ie_[i]
552  << " " << ze_[i];
553 #endif
554  }
555 
556 #ifdef EDM_ML_DEBUG
557  for (unsigned int k = 0; k < php.layHB.size(); ++k)
558  edm::LogVerbatim("HCalGeom") << "HB: " << php.layHB[k] << " R " << rxb_[k] << " " << php.rhoxHB[k] << " Z "
559  << php.zxHB[k] << " DY " << php.dyHB[k] << " DZ " << php.dxHB[k];
560  for (unsigned int k = 0; k < php.layHE.size(); ++k)
561  edm::LogVerbatim("HCalGeom") << "HE: " << php.layHE[k] << " R " << php.rhoxHE[k] << " Z " << php.zxHE[k]
562  << " X1|X2 " << php.dx1HE[k] << "|" << php.dx2HE[k] << " DY " << php.dyHE[k];
563  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters: Maximum Layer for HB " << ibmx << " for HE " << iemx
564  << " extent " << dzVcal_;
565 #endif
566 
567  if (ibmx > 0) {
568  php.rHB.resize(ibmx);
569  php.drHB.resize(ibmx);
570  for (int i = 0; i < ibmx; i++) {
571  php.rHB[i] = rb_[i];
572  php.drHB[i] = thkb_[i];
573 #ifdef EDM_ML_DEBUG
574  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters: php.rHB[" << i << "] = " << php.rHB[i] << " php.drHB[" << i
575  << "] = " << php.drHB[i];
576 #endif
577  }
578  }
579  if (iemx > 0) {
580  php.zHE.resize(iemx);
581  php.dzHE.resize(iemx);
582  for (int i = 0; i < iemx; i++) {
583  php.zHE[i] = ze_[i];
584  php.dzHE[i] = thke_[i];
585 #ifdef EDM_ML_DEBUG
586  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters: php.zHE[" << i << "] = " << php.zHE[i] << " php.dzHE[" << i
587  << "] = " << php.dzHE[i];
588 #endif
589  }
590  }
591 
592  nzHB_ = static_cast<int>(izb_.size());
593  nmodHB_ = static_cast<int>(phib_.size());
594 #ifdef EDM_ML_DEBUG
595  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters::loadGeometry: " << nzHB_ << " barrel half-sectors";
596  for (int i = 0; i < nzHB_; i++)
597  edm::LogVerbatim("HCalGeom") << "Section " << i << " Copy number " << izb_[i];
598  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters::loadGeometry: " << nmodHB_ << " barrel modules";
599  for (int i = 0; i < nmodHB_; i++)
600  edm::LogVerbatim("HCalGeom") << "Module " << i << " Copy number " << phib_[i];
601 #endif
602 
603  nzHE_ = static_cast<int>(ize_.size());
604  nmodHE_ = static_cast<int>(phie_.size());
605 #ifdef EDM_ML_DEBUG
606  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters::loadGeometry: " << nzHE_ << " endcap half-sectors";
607  for (int i = 0; i < nzHE_; i++)
608  edm::LogVerbatim("HCalGeom") << "Section " << i << " Copy number " << ize_[i];
609  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters::loadGeometry: " << nmodHE_ << " endcap modules";
610  for (int i = 0; i < nmodHE_; i++)
611  edm::LogVerbatim("HCalGeom") << "Module " << i << " Copy number " << phie_[i];
612 #endif
613 
614 #ifdef EDM_ML_DEBUG
615  edm::LogVerbatim("HCalGeom") << "HO has Z of size " << php.zHO.size();
616  for (unsigned int kk = 0; kk < php.zHO.size(); kk++)
617  edm::LogVerbatim("HCalGeom") << "ZHO[" << kk << "] = " << php.zHO[kk];
618 #endif
619  if (ibmx > 17 && php.zHO.size() > 4) {
620  rminHO_ = php.rHB[17] - 100.0;
621  etaHO_[0] = getEta(0.5 * (php.rHB[17] + php.rHB[18]), php.zHO[1]);
622  etaHO_[1] = getEta(php.rHB[18] + php.drHB[18], php.zHO[2]);
623  etaHO_[2] = getEta(php.rHB[18] - php.drHB[18], php.zHO[3]);
624  etaHO_[3] = getEta(php.rHB[18] + php.drHB[18], php.zHO[4]);
625  }
626 #ifdef EDM_ML_DEBUG
627  edm::LogVerbatim("HCalGeom") << "HO Eta boundaries " << etaHO_[0] << " " << etaHO_[1] << " " << etaHO_[2] << " "
628  << etaHO_[3];
629  edm::LogVerbatim("HCalGeom") << "HO Parameters " << rminHO_ << " " << php.zHO.size();
630  for (unsigned int i = 0; i < php.zHO.size(); ++i)
631  edm::LogVerbatim("HCalGeom") << " zho[" << i << "] = " << php.zHO[i];
632 #endif
633 }
Log< level::Info, true > LogVerbatim
std::vector< double > zHO
void loadGeometry(const DDFilteredView &_fv, HcalParameters &php)
nav_type copyNumbers() const
return the stack of copy numbers
std::vector< int > layHE
double halfZ(void) const
Definition: DDSolid.cc:216
const std::vector< int > copyNos() const
The list of the volume copy numbers.
const cms::DDSolidShape shape() const
std::vector< double > rHB
double rIn(void) const
Definition: DDSolid.cc:456
std::string name(Mapping a, V value)
Definition: DDSolidShapes.h:31
std::vector< double > rhoxHB
double rOut(void) const
Definition: DDSolid.cc:458
std::vector< int > getModHalfHBHE(const int type) const
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:135
std::vector< double > dx2HE
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
float getEta(float r, float z)
Definition: Hit.h:38
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
std::vector< double > rhoxHE
void getConstRHO(std::vector< double > &) const
std::vector< double > zxHE
std::string_view name() const
static constexpr double k_ScaleFromDDDToG4
std::vector< double > zHE
double x3(void) const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
Definition: DDSolid.cc:151
std::vector< double > dyHE
std::vector< double > zxHB
bool next()
set current node to the next node in the filtered tree
std::vector< double > dx1HE
std::vector< double > dzHE
unsigned find(int element, std::vector< int > &array) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void loadfinal(HcalParameters &php)
Interface to a Trapezoid.
Definition: DDSolid.h:88
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double y2(void) const
Half-length along y of the face at +pDz.
Definition: DDSolid.cc:149
static const double tan10deg
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 21 > DDSolidShapeMap
Definition: DDSolidShapes.h:99
bool firstChild()
set the current node to the first child
double x4(void) const
Half-length along x of the side at y=+pDy2 of the face at +pDz.
Definition: DDSolid.cc:153
const N & name() const
Definition: DDBase.h:59
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
std::vector< double > dyHB
constexpr float sol
Definition: Config.h:13
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: DDSolid.cc:145
Interface to a Box.
Definition: DDSolid.h:167
double alpha1(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy1 to the centre at y=+pDy1 of t...
Definition: DDSolid.cc:147
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
dd4hep::Solid solid() const
double alpha2(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy2 to the centre at y=+pDy2 of t...
Definition: DDSolid.cc:155
std::vector< double > dxHB
double halfX(void) const
Definition: DDSolid.cc:212
double zhalf(void) const
Definition: DDSolid.cc:454
double halfY(void) const
Definition: DDSolid.cc:214
std::vector< double > drHB
double y1(void) const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:141
void clear(EGIsoObj &c)
Definition: egamma.h:82
double getEta(double r, double z) const
const DDTranslation & translation() const
The absolute translation of the current node.
tmp
align.sh
Definition: createJobs.py:716
std::vector< int > layHB
const std::vector< double > parameters() const
extract shape parameters
static constexpr double k_ScaleFromDD4hepToG4
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
void clear(HcalParameters &php)
const Translation translation() const
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:143