CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
HcalGeomParameters Class Reference

#include <HcalGeomParameters.h>

Public Member Functions

double getConstDzHF () const
 
void getConstRHO (std::vector< double > &) const
 
std::vector< int > getModHalfHBHE (const int type) const
 
 HcalGeomParameters ()=default
 
void loadGeometry (const DDFilteredView &_fv, HcalParameters &php)
 
void loadGeometry (const cms::DDCompactView &cpv, HcalParameters &php)
 

Static Public Attributes

static constexpr double k_ScaleFromDD4hep = (1.0 / dd4hep::cm)
 
static constexpr double k_ScaleFromDD4hepToG4 = (1.0 / dd4hep::mm)
 
static constexpr double k_ScaleFromDDD = 0.1
 
static constexpr double k_ScaleFromDDDToG4 = 1.0
 
static constexpr double k_ScaleToDD4hep = dd4hep::cm
 
static constexpr double k_ScaleToDD4hepFromG4 = dd4hep::mm
 
static constexpr double k_ScaleToDDD = 10.0
 
static constexpr double k_ScaleToDDDFromG4 = 1.0
 

Private Member Functions

void clear (HcalParameters &php)
 
unsigned find (int element, std::vector< int > &array) const
 
double getEta (double r, double z) const
 
void loadfinal (HcalParameters &php)
 

Private Attributes

double dlShort_
 
double dzVcal_
 
double etaHO_ [4]
 
std::vector< int > ib_
 
std::vector< int > ie_
 
std::vector< int > izb_
 
std::vector< int > ize_
 
int nmodHB_
 
int nmodHE_
 
int nzHB_
 
int nzHE_
 
std::vector< int > phib_
 
std::vector< int > phie_
 
std::vector< double > rb_
 
std::vector< double > rmaxHE_
 
std::vector< double > rminHE_
 
double rminHO_
 
std::vector< double > rxb_
 
std::vector< double > thkb_
 
std::vector< double > thke_
 
std::vector< double > ze_
 
double zVcal_
 

Static Private Attributes

static const int kHELayer1_ = 21
 
static const int kHELayer2_ = 71
 
static const int maxLayer_ = 20
 

Detailed Description

this class extracts some geometry constants from CompactView to be used by Reco Geometry/Topology

Date:
2015/06/25 00:06:50
Author
Sunanda Banerjee, Fermilab sunan.nosp@m.da.b.nosp@m.anerj.nosp@m.ee@c.nosp@m.ern.c.nosp@m.h

Definition at line 27 of file HcalGeomParameters.h.

Constructor & Destructor Documentation

HcalGeomParameters::HcalGeomParameters ( )
default

Member Function Documentation

void HcalGeomParameters::clear ( HcalParameters php)
private

Definition at line 461 of file HcalGeomParameters.cc.

References HcalParameters::dx1HE, HcalParameters::dx2HE, HcalParameters::dxHB, HcalParameters::dyHB, HcalParameters::dyHE, mps_fire::i, HcalParameters::layHB, HcalParameters::layHE, HcalParameters::rhoxHB, HcalParameters::rhoxHE, HcalParameters::zxHB, and HcalParameters::zxHE.

461  {
462  php.rhoxHB.clear();
463  php.zxHB.clear();
464  php.dyHB.clear();
465  php.dxHB.clear();
466  php.layHB.clear();
467  php.layHE.clear();
468  php.zxHE.clear();
469  php.rhoxHE.clear();
470  php.dyHE.clear();
471  php.dx1HE.clear();
472  php.dx2HE.clear();
473 
474  // Initialize all variables
475  nzHB_ = nmodHB_ = 0;
476  nzHE_ = nmodHE_ = 0;
477  for (int i = 0; i < 4; ++i)
478  etaHO_[i] = 0;
479  zVcal_ = dzVcal_ = dlShort_ = 0;
480  rminHO_ = dzVcal_ = -1.;
481  for (int i = 0; i < maxLayer_; ++i) {
482  rb_.emplace_back(0.0);
483  ze_.emplace_back(0.0);
484  thkb_.emplace_back(-1.0);
485  thke_.emplace_back(-1.0);
486  ib_.emplace_back(0);
487  ie_.emplace_back(0);
488  rminHE_.emplace_back(0.0);
489  rmaxHE_.emplace_back(0.0);
490  }
491 }
std::vector< int > layHE
std::vector< double > rhoxHB
std::vector< double > thke_
static const int maxLayer_
std::vector< double > dx2HE
std::vector< double > rhoxHE
std::vector< double > zxHE
std::vector< double > dyHE
std::vector< double > zxHB
std::vector< double > rminHE_
std::vector< double > dx1HE
std::vector< double > rb_
std::vector< double > dyHB
std::vector< double > dxHB
std::vector< double > ze_
std::vector< double > thkb_
std::vector< double > rmaxHE_
std::vector< int > ie_
std::vector< int > layHB
std::vector< int > ib_
unsigned int HcalGeomParameters::find ( int  element,
std::vector< int > &  array 
) const
private

Definition at line 440 of file HcalGeomParameters.cc.

References mps_fire::i, and gpuClustering::id.

440  {
441  unsigned int id = array.size();
442  for (unsigned int i = 0; i < array.size(); i++) {
443  if (element == array[i]) {
444  id = i;
445  break;
446  }
447  }
448  return id;
449 }
tuple array
Definition: mps_check.py:216
uint16_t *__restrict__ id
double HcalGeomParameters::getConstDzHF ( ) const
inline

Definition at line 40 of file HcalGeomParameters.h.

References dzVcal_.

40 { return dzVcal_; }
void HcalGeomParameters::getConstRHO ( std::vector< double > &  rHO) const

Definition at line 20 of file HcalGeomParameters.cc.

References mps_fire::i.

20  {
21  rHO.emplace_back(rminHO_);
22  for (double i : etaHO_)
23  rHO.emplace_back(i);
24 }
double HcalGeomParameters::getEta ( double  r,
double  z 
) const
private

Definition at line 451 of file HcalGeomParameters.cc.

References log, funct::tan(), and createJobs::tmp.

451  {
452  double tmp = 0;
453  if (z != 0)
454  tmp = -log(tan(0.5 * atan(r / z)));
455 #ifdef EDM_ML_DEBUG
456  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters::getEta " << r << " " << z << " ==> " << tmp;
457 #endif
458  return tmp;
459 }
Log< level::Info, true > LogVerbatim
static std::vector< std::string > checklist log
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
tmp
align.sh
Definition: createJobs.py:716
std::vector< int > HcalGeomParameters::getModHalfHBHE ( const int  type) const

Definition at line 26 of file HcalGeomParameters.cc.

26  {
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 }
void HcalGeomParameters::loadfinal ( HcalParameters php)
private

Definition at line 493 of file HcalGeomParameters.cc.

References HcalParameters::drHB, HcalParameters::dx1HE, HcalParameters::dx2HE, HcalParameters::dxHB, HcalParameters::dyHB, HcalParameters::dyHE, HcalParameters::dzHE, mps_fire::i, isotrackApplyRegressor::k, GetRecoTauVFromDQM_MC_cff::kk, HcalParameters::layHB, HcalParameters::layHE, HcalParameters::rHB, HcalParameters::rhoxHB, HcalParameters::rhoxHE, HcalParameters::zHE, HcalParameters::zHO, HcalParameters::zxHB, and HcalParameters::zxHE.

493  {
494  int ibmx = 0, iemx = 0;
495  for (int i = 0; i < maxLayer_; i++) {
496  if (ib_[i] > 0) {
497  rb_[i] /= static_cast<double>(ib_[i]);
498  ibmx = i + 1;
499  }
500  if (ie_[i] > 0) {
501  ze_[i] /= static_cast<double>(ie_[i]);
502  rminHE_[i] /= static_cast<double>(ie_[i]);
503  rmaxHE_[i] /= static_cast<double>(ie_[i]);
504  iemx = i + 1;
505  }
506 #ifdef EDM_ML_DEBUG
507  edm::LogVerbatim("HCalGeom") << "Index " << i << " Barrel " << ib_[i] << " " << rb_[i] << " Endcap " << ie_[i]
508  << " " << ze_[i] << ":" << rminHE_[i] << ":" << rmaxHE_[i];
509 #endif
510  }
511  for (int i = 4; i >= 0; i--) {
512  if (ib_[i] == 0) {
513  rb_[i] = rb_[i + 1];
514  thkb_[i] = thkb_[i + 1];
515  }
516  if (ie_[i] == 0) {
517  ze_[i] = ze_[i + 1];
518  thke_[i] = thke_[i + 1];
519  }
520 #ifdef EDM_ML_DEBUG
521  if (ib_[i] == 0 || ie_[i] == 0)
522  edm::LogVerbatim("HCalGeom") << "Index " << i << " Barrel " << ib_[i] << " " << rb_[i] << " Endcap " << ie_[i]
523  << " " << ze_[i];
524 #endif
525  }
526 
527 #ifdef EDM_ML_DEBUG
528  for (unsigned int k = 0; k < php.layHB.size(); ++k)
529  edm::LogVerbatim("HCalGeom") << "HB: " << php.layHB[k] << " R " << rxb_[k] << " " << php.rhoxHB[k] << " Z "
530  << php.zxHB[k] << " DY " << php.dyHB[k] << " DZ " << php.dxHB[k];
531  for (unsigned int k = 0; k < php.layHE.size(); ++k)
532  edm::LogVerbatim("HCalGeom") << "HE: " << php.layHE[k] << " R " << php.rhoxHE[k] << " Z " << php.zxHE[k]
533  << " X1|X2 " << php.dx1HE[k] << "|" << php.dx2HE[k] << " DY " << php.dyHE[k];
534  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters: Maximum Layer for HB " << ibmx << " for HE " << iemx
535  << " extent " << dzVcal_;
536 #endif
537 
538  if (ibmx > 0) {
539  php.rHB.resize(ibmx);
540  php.drHB.resize(ibmx);
541  for (int i = 0; i < ibmx; i++) {
542  php.rHB[i] = rb_[i];
543  php.drHB[i] = thkb_[i];
544 #ifdef EDM_ML_DEBUG
545  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters: php.rHB[" << i << "] = " << php.rHB[i] << " php.drHB[" << i
546  << "] = " << php.drHB[i];
547 #endif
548  }
549  }
550  if (iemx > 0) {
551  php.zHE.resize(iemx);
552  php.dzHE.resize(iemx);
553  for (int i = 0; i < iemx; i++) {
554  php.zHE[i] = ze_[i];
555  php.dzHE[i] = thke_[i];
556 #ifdef EDM_ML_DEBUG
557  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters: php.zHE[" << i << "] = " << php.zHE[i] << " php.dzHE[" << i
558  << "] = " << php.dzHE[i];
559 #endif
560  }
561  }
562 
563  nzHB_ = static_cast<int>(izb_.size());
564  nmodHB_ = static_cast<int>(phib_.size());
565 #ifdef EDM_ML_DEBUG
566  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters::loadGeometry: " << nzHB_ << " barrel half-sectors";
567  for (int i = 0; i < nzHB_; i++)
568  edm::LogVerbatim("HCalGeom") << "Section " << i << " Copy number " << izb_[i];
569  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters::loadGeometry: " << nmodHB_ << " barrel modules";
570  for (int i = 0; i < nmodHB_; i++)
571  edm::LogVerbatim("HCalGeom") << "Module " << i << " Copy number " << phib_[i];
572 #endif
573 
574  nzHE_ = static_cast<int>(ize_.size());
575  nmodHE_ = static_cast<int>(phie_.size());
576 #ifdef EDM_ML_DEBUG
577  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters::loadGeometry: " << nzHE_ << " endcap half-sectors";
578  for (int i = 0; i < nzHE_; i++)
579  edm::LogVerbatim("HCalGeom") << "Section " << i << " Copy number " << ize_[i];
580  edm::LogVerbatim("HCalGeom") << "HcalGeomParameters::loadGeometry: " << nmodHE_ << " endcap modules";
581  for (int i = 0; i < nmodHE_; i++)
582  edm::LogVerbatim("HCalGeom") << "Module " << i << " Copy number " << phie_[i];
583 #endif
584 
585 #ifdef EDM_ML_DEBUG
586  edm::LogVerbatim("HCalGeom") << "HO has Z of size " << php.zHO.size();
587  for (unsigned int kk = 0; kk < php.zHO.size(); kk++)
588  edm::LogVerbatim("HCalGeom") << "ZHO[" << kk << "] = " << php.zHO[kk];
589 #endif
590  if (ibmx > 17 && php.zHO.size() > 4) {
591  rminHO_ = php.rHB[17] - 100.0;
592  etaHO_[0] = getEta(0.5 * (php.rHB[17] + php.rHB[18]), php.zHO[1]);
593  etaHO_[1] = getEta(php.rHB[18] + php.drHB[18], php.zHO[2]);
594  etaHO_[2] = getEta(php.rHB[18] - php.drHB[18], php.zHO[3]);
595  etaHO_[3] = getEta(php.rHB[18] + php.drHB[18], php.zHO[4]);
596  }
597 #ifdef EDM_ML_DEBUG
598  edm::LogVerbatim("HCalGeom") << "HO Eta boundaries " << etaHO_[0] << " " << etaHO_[1] << " " << etaHO_[2] << " "
599  << etaHO_[3];
600  edm::LogVerbatim("HCalGeom") << "HO Parameters " << rminHO_ << " " << php.zHO.size();
601  for (unsigned int i = 0; i < php.zHO.size(); ++i)
602  edm::LogVerbatim("HCalGeom") << " zho[" << i << "] = " << php.zHO[i];
603 #endif
604 }
Log< level::Info, true > LogVerbatim
std::vector< double > zHO
std::vector< int > izb_
std::vector< int > layHE
std::vector< double > rHB
std::vector< double > rhoxHB
std::vector< double > thke_
static const int maxLayer_
std::vector< double > dx2HE
std::vector< int > phie_
std::vector< double > rxb_
std::vector< double > rhoxHE
std::vector< double > zxHE
std::vector< double > zHE
std::vector< double > dyHE
std::vector< double > zxHB
std::vector< int > phib_
std::vector< double > rminHE_
std::vector< double > dx1HE
std::vector< double > dzHE
std::vector< double > rb_
std::vector< double > dyHB
std::vector< int > ize_
std::vector< double > dxHB
std::vector< double > ze_
double getEta(double r, double z) const
std::vector< double > drHB
std::vector< double > thkb_
std::vector< double > rmaxHE_
std::vector< int > ie_
std::vector< int > layHB
std::vector< int > ib_
void HcalGeomParameters::loadGeometry ( const DDFilteredView _fv,
HcalParameters php 
)

Definition at line 38 of file HcalGeomParameters.cc.

References funct::abs(), DDTrap::alpha1(), DDTrap::alpha2(), clear(), filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), funct::cos(), ddbox, ddcons, ddpolycone_rrz, ddtrap, ddtubs, PVValHelper::dx, HcalParameters::dx1HE, HcalParameters::dx2HE, HcalParameters::dxHB, PVValHelper::dy, HcalParameters::dyHB, HcalParameters::dyHE, PVValHelper::dz, spr::find(), newFWLiteAna::found, DDBox::halfX(), DDBox::halfY(), DDTrap::halfZ(), DDBox::halfZ(), dqmiolumiharvest::j, isotrackApplyRegressor::k, k_ScaleFromDDDToG4, GetRecoTauVFromDQM_MC_cff::kk, HcalParameters::layHB, HcalParameters::layHE, DDFilteredView::logicalPart(), min(), DDBase< N, C >::name(), DDFilteredView::next(), DDSolid::parameters(), HcalParameters::rhoxHB, HcalParameters::rhoxHE, DDTubs::rIn(), DDTubs::rOut(), DDSolid::shape(), DDLogicalPart::solid(), submitPVValidationJobs::t, tan10deg, createJobs::tmp, DDFilteredView::translation(), DDTrap::x1(), DDTrap::x2(), DDTrap::x3(), DDTrap::x4(), DDTrap::y1(), DDTrap::y2(), DDTubs::zhalf(), HcalParameters::zHO, HcalParameters::zxHB, and HcalParameters::zxHE.

38  {
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 > 1)
53  idet = copy[nsiz - 2] / 1000;
54 #ifdef EDM_ML_DEBUG
55  edm::LogVerbatim("HCalGeom") << "Name " << fv.logicalPart().solid().name() << " Copy " << copy.size();
56 #endif
57  double dx = 0, dy = 0, dz = 0, dx1 = 0, dx2 = 0;
58  double alp(0);
59  if (sol.shape() == DDSolidShape::ddbox) {
60  const DDBox& box = static_cast<DDBox>(sol);
64  } else if (sol.shape() == DDSolidShape::ddtrap) {
65  const DDTrap& trp = static_cast<DDTrap>(sol);
68  dx = 0.25 * HcalGeomParameters::k_ScaleFromDDDToG4 * (trp.x1() + trp.x2() + trp.x3() + trp.x4());
69  dy = 0.5 * HcalGeomParameters::k_ScaleFromDDDToG4 * (trp.y1() + trp.y2());
71  alp = 0.5 * (trp.alpha1() + trp.alpha2());
72  } else if (sol.shape() == DDSolidShape::ddtubs) {
73  const DDTubs& tub = static_cast<DDTubs>(sol);
77  }
78  if (idet == 3) {
79  // HB
80 #ifdef EDM_ML_DEBUG
81  edm::LogVerbatim("HCalGeom") << "HB " << sol.name() << " Shape " << sol.shape() << " Layer " << lay << " R "
82  << t.Rho();
83 #endif
84  if (lay >= 0 && lay < maxLayer_) {
85  ib_[lay]++;
86  rb_[lay] += (HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho());
87  if (thkb_[lay] <= 0) {
88  if (lay < 17)
89  thkb_[lay] = dx;
90  else
91  thkb_[lay] = std::min(dx, dy);
92  }
93  if (lay < 17) {
94  bool found = false;
95  for (double k : rxb_) {
96  if (std::abs(k - (HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho())) < 0.01) {
97  found = true;
98  break;
99  }
100  }
101  if (!found) {
102  rxb_.emplace_back(HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho());
103  php.rhoxHB.emplace_back(HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho() * std::cos(t.phi()));
104  php.zxHB.emplace_back(HcalGeomParameters::k_ScaleFromDDDToG4 * std::abs(t.z()));
105  php.dyHB.emplace_back(2. * dy);
106  php.dxHB.emplace_back(2. * dz);
107  php.layHB.emplace_back(lay);
108  }
109  }
110  }
111  if (lay == 2) {
112  int iz = copy[nsiz - 5];
113  int fi = copy[nsiz - 4];
114  unsigned int it1 = find(iz, izb_);
115  if (it1 == izb_.size())
116  izb_.emplace_back(iz);
117  unsigned int it2 = find(fi, phib_);
118  if (it2 == phib_.size())
119  phib_.emplace_back(fi);
120  }
121  if (lay == 18) {
122  int ifi = -1, ich = -1;
123  if (nsiz > 2)
124  ifi = copy[nsiz - 3];
125  if (nsiz > 3)
126  ich = copy[nsiz - 4];
127  double z1 = std::abs((HcalGeomParameters::k_ScaleFromDDDToG4 * t.z()) + dz);
128  double z2 = std::abs((HcalGeomParameters::k_ScaleFromDDDToG4 * t.z()) - dz);
129  if (std::abs(z1 - z2) < 0.01)
130  z1 = 0;
131  if (ifi == 1 && ich == 4) {
132  if (z1 > z2) {
133  double tmp = z1;
134  z1 = z2;
135  z2 = tmp;
136  }
137  bool sok = true;
138  for (unsigned int kk = 0; kk < php.zHO.size(); kk++) {
139  if (std::abs(z2 - php.zHO[kk]) < 0.01) {
140  sok = false;
141  break;
142  } else if (z2 < php.zHO[kk]) {
143  php.zHO.resize(php.zHO.size() + 2);
144  for (unsigned int kz = php.zHO.size() - 1; kz > kk + 1; kz = kz - 2) {
145  php.zHO[kz] = php.zHO[kz - 2];
146  php.zHO[kz - 1] = php.zHO[kz - 3];
147  }
148  php.zHO[kk + 1] = z2;
149  php.zHO[kk] = z1;
150  sok = false;
151  break;
152  }
153  }
154  if (sok) {
155  php.zHO.emplace_back(z1);
156  php.zHO.emplace_back(z2);
157  }
158 #ifdef EDM_ML_DEBUG
159  edm::LogVerbatim("HCalGeom") << "Detector " << idet << " Lay " << lay << " fi " << ifi << " " << ich << " z "
160  << z1 << " " << z2;
161 #endif
162  }
163  }
164  } else if (idet == 4) {
165  // HE
166 #ifdef EDM_ML_DEBUG
167  edm::LogVerbatim("HCalGeom") << "HE " << sol.name() << " Shape " << sol.shape() << " Layer " << lay << " Z "
168  << t.z();
169 #endif
170  if (lay >= 0 && lay < maxLayer_) {
171  ie_[lay]++;
173  if (thke_[lay] <= 0)
174  thke_[lay] = dz;
175  double rinHE = HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho() * cos(alp) - dy;
176  double routHE = HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho() * cos(alp) + dy;
177  rminHE_[lay] += rinHE;
178  rmaxHE_[lay] += routHE;
179  bool found = false;
180  for (double k : php.zxHE) {
181  if (std::abs(k - std::abs(HcalGeomParameters::k_ScaleFromDDDToG4 * t.z())) < 0.01) {
182  found = true;
183  break;
184  }
185  }
186  if (!found) {
187  php.zxHE.emplace_back(HcalGeomParameters::k_ScaleFromDDDToG4 * std::abs(t.z()));
188  php.rhoxHE.emplace_back(HcalGeomParameters::k_ScaleFromDDDToG4 * t.Rho() * std::cos(t.phi()));
189  php.dyHE.emplace_back(dy * std::cos(t.phi()));
190  dx1 -= 0.5 * (HcalGeomParameters::k_ScaleFromDDDToG4 * t.rho() - dy) * std::cos(t.phi()) * tan10deg;
191  dx2 -= 0.5 * (HcalGeomParameters::k_ScaleFromDDDToG4 * t.rho() + dy) * std::cos(t.phi()) * tan10deg;
192  php.dx1HE.emplace_back(-dx1);
193  php.dx2HE.emplace_back(-dx2);
194  php.layHE.emplace_back(lay);
195  }
196  }
197  if (copy[nsiz - 1] == kHELayer1_ || copy[nsiz - 1] == kHELayer2_) {
198  int iz = copy[nsiz - 7];
199  int fi = copy[nsiz - 5];
200  unsigned int it1 = find(iz, ize_);
201  if (it1 == ize_.size())
202  ize_.emplace_back(iz);
203  unsigned int it2 = find(fi, phie_);
204  if (it2 == phie_.size())
205  phie_.emplace_back(fi);
206  }
207  } else if (idet == 5) {
208  // HF
209  if (!hf) {
210  const std::vector<double>& paras = sol.parameters();
211 #ifdef EDM_ML_DEBUG
212  edm::LogVerbatim("HCalGeom") << "HF " << sol.name() << " Shape " << sol.shape() << " Z " << t.z() << " with "
213  << paras.size() << " Parameters";
214  for (unsigned j = 0; j < paras.size(); j++)
215  edm::LogVerbatim("HCalGeom") << "HF Parameter[" << j << "] = " << paras[j];
216 #endif
217  if (sol.shape() == DDSolidShape::ddpolycone_rrz) {
218  int nz = (int)(paras.size()) - 3;
219  dzVcal_ = 0.5 * HcalGeomParameters::k_ScaleFromDDDToG4 * (paras[nz] - paras[3]);
220  hf = true;
221  } else if (sol.shape() == DDSolidShape::ddtubs || sol.shape() == DDSolidShape::ddcons) {
223  hf = true;
224  }
225  }
226 #ifdef EDM_ML_DEBUG
227  } else {
228  edm::LogVerbatim("HCalGeom") << "Unknown Detector " << idet << " for " << sol.name() << " Shape " << sol.shape()
229  << " R " << t.Rho() << " Z " << t.z();
230 #endif
231  }
232  dodet = fv.next();
233  }
234 
235  loadfinal(php);
236 }
Log< level::Info, true > LogVerbatim
std::vector< double > zHO
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:135
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
double halfZ(void) const
Definition: DDSolid.cc:216
std::vector< int > layHE
std::vector< int > izb_
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:143
const N & name() const
Definition: DDBase.h:59
double halfY(void) const
Definition: DDSolid.cc:214
nav_type copyNumbers() const
return the stack of copy numbers
unsigned find(int element, std::vector< int > &array) const
std::vector< double > rhoxHB
std::vector< double > thke_
static const int maxLayer_
std::vector< double > dx2HE
static const int kHELayer1_
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
std::vector< int > phie_
std::vector< double > rxb_
std::vector< double > rhoxHE
std::vector< double > zxHE
static constexpr double k_ScaleFromDDDToG4
static const int kHELayer2_
std::vector< double > dyHE
std::vector< double > zxHB
double x4(void) const
Half-length along x of the side at y=+pDy2 of the face at +pDz.
Definition: DDSolid.cc:153
std::vector< int > phib_
std::vector< double > rminHE_
bool next()
set current node to the next node in the filtered tree
std::vector< double > dx1HE
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void loadfinal(HcalParameters &php)
Interface to a Trapezoid.
Definition: DDSolid.h:88
double y1(void) const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:141
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
static const double tan10deg
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< double > rb_
double rOut(void) const
Definition: DDSolid.cc:458
std::vector< double > dyHB
double halfX(void) const
Definition: DDSolid.cc:212
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
std::vector< int > ize_
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 x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: DDSolid.cc:145
std::vector< double > ze_
double zhalf(void) const
Definition: DDSolid.cc:454
double y2(void) const
Half-length along y of the face at +pDz.
Definition: DDSolid.cc:149
std::vector< double > thkb_
std::vector< double > rmaxHE_
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< int > ie_
double rIn(void) const
Definition: DDSolid.cc:456
tmp
align.sh
Definition: createJobs.py:716
std::vector< int > layHB
std::vector< int > ib_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
double x3(void) const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
Definition: DDSolid.cc:151
void clear(HcalParameters &php)
void HcalGeomParameters::loadGeometry ( const cms::DDCompactView cpv,
HcalParameters php 
)

Definition at line 238 of file HcalGeomParameters.cc.

References funct::abs(), clear(), filterCSVwithJSON::copy, cms::DDFilteredView::copyNos(), funct::cos(), cms::DDSolidShapeMap, PVValHelper::dx, HcalParameters::dx1HE, HcalParameters::dx2HE, HcalParameters::dxHB, PVValHelper::dy, HcalParameters::dyHB, HcalParameters::dyHE, PVValHelper::dz, alcazmumu_cfi::filter, spr::find(), cms::DDFilteredView::firstChild(), newFWLiteAna::found, dqmiolumiharvest::j, isotrackApplyRegressor::k, k_ScaleFromDD4hepToG4, GetRecoTauVFromDQM_MC_cff::kk, HcalParameters::layHB, HcalParameters::layHE, min(), dqmiodumpmetadata::n, cms::dd::name(), cms::DDFilteredView::name(), cms::DDFilteredView::parameters(), HcalParameters::rhoxHB, HcalParameters::rhoxHE, cms::DDFilteredView::shape(), cms::DDFilteredView::solid(), submitPVValidationJobs::t, tan10deg, createJobs::tmp, cms::DDFilteredView::translation(), HcalParameters::zHO, HcalParameters::zxHB, and HcalParameters::zxHE.

238  {
239  const cms::DDFilter filter("OnlyForHcalSimNumbering", "HCAL");
240  cms::DDFilteredView fv(cpv, filter);
241  clear(php);
242  bool hf(false);
243  while (fv.firstChild()) {
244  auto t = fv.translation();
245  std::vector<double> paras = fv.parameters();
246  std::vector<int> copy = fv.copyNos();
247  int idet = 0, lay = -1;
248  int nsiz = static_cast<int>(copy.size());
249  if (nsiz > 0)
250  lay = copy[0] / 10;
251  if (nsiz > 1)
252  idet = copy[1] / 1000;
253 #ifdef EDM_ML_DEBUG
254  edm::LogVerbatim("HCalGeom") << "Name " << fv.name() << " Copy " << copy.size();
255  for (unsigned int n = 0; n < copy.size(); ++n)
256  edm::LogVerbatim("HCalGeom") << "[" << n << "] " << copy[n];
257  edm::LogVerbatim("HCalGeom") << "Detector " << idet << " Layer " << lay << " parameters: " << paras.size();
258  for (unsigned int n = 0; n < paras.size(); ++n)
259  edm::LogVerbatim("HCalGeom") << "[" << n << "] " << paras[n];
260 #endif
261  double dx = 0, dy = 0, dz = 0, dx1 = 0, dx2 = 0;
262  double alp(0);
263  if (dd4hep::isA<dd4hep::Box>(fv.solid())) {
267  } else if (dd4hep::isA<dd4hep::Trap>(fv.solid())) {
270  dx = 0.25 * HcalGeomParameters::k_ScaleFromDD4hepToG4 * (paras[4] + paras[5] + paras[8] + paras[9]);
271  dy = 0.5 * HcalGeomParameters::k_ScaleFromDD4hepToG4 * (paras[3] + paras[7]);
273  alp = 0.5 * (paras[6] + paras[10]);
274  } else if (dd4hep::isA<dd4hep::Tube>(fv.solid())) {
278  }
279  if (idet == 3) {
280  // HB
281 #ifdef EDM_ML_DEBUG
282  edm::LogVerbatim("HCalGeom") << "HB " << fv.name() << " Shape " << cms::dd::name(cms::DDSolidShapeMap, fv.shape())
283  << " Layer " << lay << " R " << t.Rho();
284 #endif
285  if (lay >= 0 && lay < maxLayer_) {
286  ib_[lay]++;
288  if (thkb_[lay] <= 0) {
289  if (lay < 17)
290  thkb_[lay] = dx;
291  else
292  thkb_[lay] = std::min(dx, dy);
293  }
294  if (lay < 17) {
295  bool found = false;
296  for (double k : rxb_) {
297  if (std::abs(k - (HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho())) < 0.01) {
298  found = true;
299  break;
300  }
301  }
302  if (!found) {
303  rxb_.emplace_back(HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho());
304  php.rhoxHB.emplace_back(HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() * std::cos(t.phi()));
305  php.zxHB.emplace_back(std::abs(HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.z()));
306  php.dyHB.emplace_back(2. * dy);
307  php.dxHB.emplace_back(2. * dz);
308  php.layHB.emplace_back(lay);
309  }
310  }
311  }
312  if (lay == 2) {
313  int iz = copy[4];
314  int fi = copy[3];
315  unsigned int it1 = find(iz, izb_);
316  if (it1 == izb_.size())
317  izb_.emplace_back(iz);
318  unsigned int it2 = find(fi, phib_);
319  if (it2 == phib_.size())
320  phib_.emplace_back(fi);
321  }
322  if (lay == 18) {
323  int ifi = -1, ich = -1;
324  if (nsiz > 2)
325  ifi = copy[2];
326  if (nsiz > 3)
327  ich = copy[3];
330  if (std::abs(z1 - z2) < 0.01)
331  z1 = 0;
332  if (ifi == 1 && ich == 4) {
333  if (z1 > z2) {
334  double tmp = z1;
335  z1 = z2;
336  z2 = tmp;
337  }
338  bool sok = true;
339  for (unsigned int kk = 0; kk < php.zHO.size(); kk++) {
340  if (std::abs(z2 - php.zHO[kk]) < 0.01) {
341  sok = false;
342  break;
343  } else if (z2 < php.zHO[kk]) {
344  php.zHO.resize(php.zHO.size() + 2);
345  for (unsigned int kz = php.zHO.size() - 1; kz > kk + 1; kz = kz - 2) {
346  php.zHO[kz] = php.zHO[kz - 2];
347  php.zHO[kz - 1] = php.zHO[kz - 3];
348  }
349  php.zHO[kk + 1] = z2;
350  php.zHO[kk] = z1;
351  sok = false;
352  break;
353  }
354  }
355  if (sok) {
356  php.zHO.emplace_back(z1);
357  php.zHO.emplace_back(z2);
358  }
359 #ifdef EDM_ML_DEBUG
360  edm::LogVerbatim("HCalGeom") << "Detector " << idet << " Lay " << lay << " fi " << ifi << " " << ich << " z "
361  << z1 << " " << z2;
362 #endif
363  }
364  }
365  } else if (idet == 4) {
366  // HE
367 #ifdef EDM_ML_DEBUG
368  edm::LogVerbatim("HCalGeom") << "HE " << fv.name() << " Shape " << cms::dd::name(cms::DDSolidShapeMap, fv.shape())
369  << " Layer " << lay << " Z " << t.z();
370 #endif
371  if (lay >= 0 && lay < maxLayer_) {
372  ie_[lay]++;
374  if (thke_[lay] <= 0)
375  thke_[lay] = dz;
376  double rinHE = HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() * cos(alp) - dy;
377  double routHE = HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() * cos(alp) + dy;
378  rminHE_[lay] += rinHE;
379  rmaxHE_[lay] += routHE;
380  bool found = false;
381  for (double k : php.zxHE) {
383  found = true;
384  break;
385  }
386  }
387  if (!found) {
388  php.zxHE.emplace_back(std::abs(HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.z()));
389  php.rhoxHE.emplace_back(HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() * std::cos(t.phi()));
390  php.dyHE.emplace_back(dy * std::cos(t.phi()));
391  dx1 -= 0.5 * (HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() - dy) * std::cos(t.phi()) * tan10deg;
392  dx2 -= 0.5 * (HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho() + dy) * std::cos(t.phi()) * tan10deg;
393  php.dx1HE.emplace_back(-dx1);
394  php.dx2HE.emplace_back(-dx2);
395  php.layHE.emplace_back(lay);
396  }
397  }
398  if (copy[0] == kHELayer1_ || copy[0] == kHELayer2_) {
399  int iz = copy[6];
400  int fi = copy[4];
401  unsigned int it1 = find(iz, ize_);
402  if (it1 == ize_.size())
403  ize_.emplace_back(iz);
404  unsigned int it2 = find(fi, phie_);
405  if (it2 == phie_.size())
406  phie_.emplace_back(fi);
407  }
408  } else if (idet == 5) {
409  // HF
410  if (!hf) {
411 #ifdef EDM_ML_DEBUG
412  edm::LogVerbatim("HCalGeom") << "HF " << fv.name() << " Shape "
413  << cms::dd::name(cms::DDSolidShapeMap, fv.shape()) << " Z "
414  << HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.z() << " with " << paras.size()
415  << " Parameters";
416  for (unsigned j = 0; j < paras.size(); j++)
417  edm::LogVerbatim("HCalGeom") << "HF Parameter[" << j << "] = " << paras[j];
418 #endif
419  if (dd4hep::isA<dd4hep::Polycone>(fv.solid())) {
420  int nz = (int)(paras.size()) - 3;
421  dzVcal_ = 0.5 * HcalGeomParameters::k_ScaleFromDD4hepToG4 * (paras[nz] - paras[3]);
422  hf = true;
423  } else if (dd4hep::isA<dd4hep::Tube>(fv.solid()) || dd4hep::isA<dd4hep::ConeSegment>(fv.solid())) {
425  hf = true;
426  }
427  }
428 #ifdef EDM_ML_DEBUG
429  } else {
430  edm::LogVerbatim("HCalGeom") << "Unknown Detector " << idet << " for " << fv.name() << " Shape "
431  << cms::dd::name(cms::DDSolidShapeMap, fv.shape()) << " R "
432  << (HcalGeomParameters::k_ScaleFromDD4hepToG4 * t.Rho()) << " Z "
434 #endif
435  }
436  }
437  loadfinal(php);
438 }
Log< level::Info, true > LogVerbatim
std::vector< double > zHO
std::vector< int > layHE
std::vector< int > izb_
unsigned find(int element, std::vector< int > &array) const
std::string name(Mapping a, V value)
Definition: DDSolidShapes.h:31
std::vector< double > rhoxHB
std::vector< double > thke_
static const int maxLayer_
std::vector< double > dx2HE
static const int kHELayer1_
std::vector< int > phie_
std::vector< double > rxb_
std::vector< double > rhoxHE
std::vector< double > zxHE
static const int kHELayer2_
std::vector< double > dyHE
std::vector< double > zxHB
std::vector< int > phib_
std::vector< double > rminHE_
std::vector< double > dx1HE
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void loadfinal(HcalParameters &php)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const double tan10deg
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 21 > DDSolidShapeMap
Definition: DDSolidShapes.h:99
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< double > rb_
std::vector< double > dyHB
std::vector< int > ize_
std::vector< double > dxHB
std::vector< double > ze_
std::vector< double > thkb_
std::vector< double > rmaxHE_
std::vector< int > ie_
tmp
align.sh
Definition: createJobs.py:716
std::vector< int > layHB
std::vector< int > ib_
static constexpr double k_ScaleFromDD4hepToG4
void clear(HcalParameters &php)

Member Data Documentation

double HcalGeomParameters::dlShort_
private

Definition at line 57 of file HcalGeomParameters.h.

double HcalGeomParameters::dzVcal_
private

Definition at line 56 of file HcalGeomParameters.h.

Referenced by getConstDzHF().

double HcalGeomParameters::etaHO_[4]
private

Definition at line 54 of file HcalGeomParameters.h.

std::vector<int> HcalGeomParameters::ib_
private

Definition at line 61 of file HcalGeomParameters.h.

std::vector<int> HcalGeomParameters::ie_
private

Definition at line 61 of file HcalGeomParameters.h.

std::vector<int> HcalGeomParameters::izb_
private

Definition at line 61 of file HcalGeomParameters.h.

std::vector<int> HcalGeomParameters::ize_
private

Definition at line 61 of file HcalGeomParameters.h.

constexpr double HcalGeomParameters::k_ScaleFromDD4hep = (1.0 / dd4hep::cm)
static

Definition at line 33 of file HcalGeomParameters.h.

constexpr double HcalGeomParameters::k_ScaleFromDD4hepToG4 = (1.0 / dd4hep::mm)
static

Definition at line 35 of file HcalGeomParameters.h.

Referenced by HcalParametersFromDD::build(), and loadGeometry().

constexpr double HcalGeomParameters::k_ScaleFromDDD = 0.1
static

Definition at line 29 of file HcalGeomParameters.h.

constexpr double HcalGeomParameters::k_ScaleFromDDDToG4 = 1.0
static

Definition at line 31 of file HcalGeomParameters.h.

Referenced by HcalParametersFromDD::build(), and loadGeometry().

constexpr double HcalGeomParameters::k_ScaleToDD4hep = dd4hep::cm
static

Definition at line 34 of file HcalGeomParameters.h.

constexpr double HcalGeomParameters::k_ScaleToDD4hepFromG4 = dd4hep::mm
static

Definition at line 36 of file HcalGeomParameters.h.

constexpr double HcalGeomParameters::k_ScaleToDDD = 10.0
static

Definition at line 30 of file HcalGeomParameters.h.

constexpr double HcalGeomParameters::k_ScaleToDDDFromG4 = 1.0
static

Definition at line 32 of file HcalGeomParameters.h.

const int HcalGeomParameters::kHELayer1_ = 21
staticprivate

Definition at line 59 of file HcalGeomParameters.h.

const int HcalGeomParameters::kHELayer2_ = 71
staticprivate

Definition at line 59 of file HcalGeomParameters.h.

const int HcalGeomParameters::maxLayer_ = 20
staticprivate

Definition at line 58 of file HcalGeomParameters.h.

int HcalGeomParameters::nmodHB_
private

Definition at line 52 of file HcalGeomParameters.h.

int HcalGeomParameters::nmodHE_
private

Definition at line 53 of file HcalGeomParameters.h.

int HcalGeomParameters::nzHB_
private

Definition at line 52 of file HcalGeomParameters.h.

int HcalGeomParameters::nzHE_
private

Definition at line 53 of file HcalGeomParameters.h.

std::vector<int> HcalGeomParameters::phib_
private

Definition at line 61 of file HcalGeomParameters.h.

std::vector<int> HcalGeomParameters::phie_
private

Definition at line 61 of file HcalGeomParameters.h.

std::vector<double> HcalGeomParameters::rb_
private

Definition at line 60 of file HcalGeomParameters.h.

std::vector<double> HcalGeomParameters::rmaxHE_
private

Definition at line 62 of file HcalGeomParameters.h.

std::vector<double> HcalGeomParameters::rminHE_
private

Definition at line 62 of file HcalGeomParameters.h.

double HcalGeomParameters::rminHO_
private

Definition at line 54 of file HcalGeomParameters.h.

std::vector<double> HcalGeomParameters::rxb_
private

Definition at line 62 of file HcalGeomParameters.h.

std::vector<double> HcalGeomParameters::thkb_
private

Definition at line 60 of file HcalGeomParameters.h.

std::vector<double> HcalGeomParameters::thke_
private

Definition at line 60 of file HcalGeomParameters.h.

std::vector<double> HcalGeomParameters::ze_
private

Definition at line 60 of file HcalGeomParameters.h.

double HcalGeomParameters::zVcal_
private

Definition at line 55 of file HcalGeomParameters.h.