CMS 3D CMS Logo

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::HcalGeomParameters ( )
default

Member Function Documentation

◆ clear()

void HcalGeomParameters::clear ( HcalParameters php)
private

Definition at line 490 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.

490  {
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 }
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_

◆ find()

unsigned int HcalGeomParameters::find ( int  element,
std::vector< int > &  array 
) const
private

Definition at line 469 of file HcalGeomParameters.cc.

References mps_check::array, mps_fire::i, and l1ctLayer2EG_cff::id.

469  {
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 }

◆ getConstDzHF()

double HcalGeomParameters::getConstDzHF ( ) const
inline

Definition at line 40 of file HcalGeomParameters.h.

References dzVcal_.

40 { return dzVcal_; }

◆ getConstRHO()

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 }

◆ getEta()

double HcalGeomParameters::getEta ( double  r,
double  z 
) const
private

Definition at line 480 of file HcalGeomParameters.cc.

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

480  {
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 }
Log< level::Info, true > LogVerbatim
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
tmp
align.sh
Definition: createJobs.py:716

◆ getModHalfHBHE()

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 }

◆ loadfinal()

void HcalGeomParameters::loadfinal ( HcalParameters php)
private

Definition at line 522 of file HcalGeomParameters.cc.

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

522  {
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
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_
std::vector< double > drHB
std::vector< double > thkb_
std::vector< double > rmaxHE_
double getEta(double r, double z) const
std::vector< int > ie_
std::vector< int > layHB
std::vector< int > ib_

◆ loadGeometry() [1/2]

void HcalGeomParameters::loadGeometry ( const DDFilteredView _fv,
HcalParameters php 
)

Definition at line 38 of file HcalGeomParameters.cc.

References funct::abs(), DDTrap::alpha1(), DDTrap::alpha2(), l1ct::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(), photonIsolationHIProducer_cfi::hf, createfilelist::int, dqmiolumiharvest::j, dqmdumpme::k, k_ScaleFromDDDToG4, GetRecoTauVFromDQM_MC_cff::kk, HcalParameters::layHB, HcalParameters::layHE, DDFilteredView::logicalPart(), SiStripPI::min, DDBase< N, C >::name(), DDFilteredView::next(), HcalParameters::rhoxHB, HcalParameters::rhoxHE, DDTubs::rIn(), DDTubs::rOut(), mkfit::Const::sol, DDLogicalPart::solid(), submitPVValidationJobs::t, tan10deg, createJobs::tmp, DDFilteredView::translation(), DDTrap::x1(), DDTrap::x2(), DDTrap::x3(), DDTrap::x4(), DDTrap::y1(), DDTrap::y2(), testProducerWithPsetDescEmpty_cfi::z2, 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 > 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]++;
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) {
231  hf = true;
232  } else if (sol.shape() == DDSolidShape::ddtrap) {
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 }
Log< level::Info, true > LogVerbatim
std::vector< double > zHO
nav_type copyNumbers() const
return the stack of copy numbers
std::vector< int > layHE
std::vector< int > izb_
double halfZ(void) const
Definition: DDSolid.cc:216
double rIn(void) const
Definition: DDSolid.cc:456
std::vector< double > rhoxHB
std::vector< double > thke_
static const int maxLayer_
double rOut(void) const
Definition: DDSolid.cc:458
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:135
std::vector< double > dx2HE
static const int kHELayer1_
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_
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
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
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
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
std::vector< double > rb_
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
std::vector< int > ize_
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
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
std::vector< double > ze_
double halfX(void) const
Definition: DDSolid.cc:212
double zhalf(void) const
Definition: DDSolid.cc:454
double halfY(void) const
Definition: DDSolid.cc:214
double y1(void) const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:141
std::vector< double > thkb_
std::vector< double > rmaxHE_
std::vector< int > ie_
const DDTranslation & translation() const
The absolute translation of the current node.
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
void clear(HcalParameters &php)
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:143

◆ loadGeometry() [2/2]

void HcalGeomParameters::loadGeometry ( const cms::DDCompactView cpv,
HcalParameters php 
)

Definition at line 253 of file HcalGeomParameters.cc.

References funct::abs(), l1ct::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, ALCARECOTkAlBeamHalo_cff::filter, spr::find(), cms::DDFilteredView::firstChild(), newFWLiteAna::found, photonIsolationHIProducer_cfi::hf, createfilelist::int, dqmiolumiharvest::j, dqmdumpme::k, k_ScaleFromDD4hepToG4, GetRecoTauVFromDQM_MC_cff::kk, HcalParameters::layHB, HcalParameters::layHE, SiStripPI::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(), testProducerWithPsetDescEmpty_cfi::z2, HcalParameters::zHO, HcalParameters::zxHB, and HcalParameters::zxHE.

253  {
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]++;
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())) {
447  hf = true;
448  } else if (dd4hep::isA<dd4hep::Trap>(fv.solid())) {
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 }
Log< level::Info, true > LogVerbatim
std::vector< double > zHO
std::vector< int > layHE
std::vector< int > izb_
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
unsigned find(int element, std::vector< int > &array) const
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
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

◆ dlShort_

double HcalGeomParameters::dlShort_
private

Definition at line 57 of file HcalGeomParameters.h.

◆ dzVcal_

double HcalGeomParameters::dzVcal_
private

Definition at line 56 of file HcalGeomParameters.h.

Referenced by getConstDzHF().

◆ etaHO_

double HcalGeomParameters::etaHO_[4]
private

Definition at line 54 of file HcalGeomParameters.h.

◆ ib_

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

Definition at line 61 of file HcalGeomParameters.h.

◆ ie_

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

Definition at line 61 of file HcalGeomParameters.h.

◆ izb_

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

Definition at line 61 of file HcalGeomParameters.h.

◆ ize_

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

Definition at line 61 of file HcalGeomParameters.h.

◆ k_ScaleFromDD4hep

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

Definition at line 33 of file HcalGeomParameters.h.

◆ k_ScaleFromDD4hepToG4

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

Definition at line 35 of file HcalGeomParameters.h.

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

◆ k_ScaleFromDDD

constexpr double HcalGeomParameters::k_ScaleFromDDD = 0.1
static

Definition at line 29 of file HcalGeomParameters.h.

◆ k_ScaleFromDDDToG4

constexpr double HcalGeomParameters::k_ScaleFromDDDToG4 = 1.0
static

Definition at line 31 of file HcalGeomParameters.h.

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

◆ k_ScaleToDD4hep

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

Definition at line 34 of file HcalGeomParameters.h.

◆ k_ScaleToDD4hepFromG4

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

Definition at line 36 of file HcalGeomParameters.h.

◆ k_ScaleToDDD

constexpr double HcalGeomParameters::k_ScaleToDDD = 10.0
static

Definition at line 30 of file HcalGeomParameters.h.

◆ k_ScaleToDDDFromG4

constexpr double HcalGeomParameters::k_ScaleToDDDFromG4 = 1.0
static

Definition at line 32 of file HcalGeomParameters.h.

◆ kHELayer1_

const int HcalGeomParameters::kHELayer1_ = 21
staticprivate

Definition at line 59 of file HcalGeomParameters.h.

◆ kHELayer2_

const int HcalGeomParameters::kHELayer2_ = 71
staticprivate

Definition at line 59 of file HcalGeomParameters.h.

◆ maxLayer_

const int HcalGeomParameters::maxLayer_ = 20
staticprivate

Definition at line 58 of file HcalGeomParameters.h.

◆ nmodHB_

int HcalGeomParameters::nmodHB_
private

Definition at line 52 of file HcalGeomParameters.h.

◆ nmodHE_

int HcalGeomParameters::nmodHE_
private

Definition at line 53 of file HcalGeomParameters.h.

◆ nzHB_

int HcalGeomParameters::nzHB_
private

Definition at line 52 of file HcalGeomParameters.h.

◆ nzHE_

int HcalGeomParameters::nzHE_
private

Definition at line 53 of file HcalGeomParameters.h.

◆ phib_

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

Definition at line 61 of file HcalGeomParameters.h.

◆ phie_

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

Definition at line 61 of file HcalGeomParameters.h.

◆ rb_

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

Definition at line 60 of file HcalGeomParameters.h.

◆ rmaxHE_

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

Definition at line 62 of file HcalGeomParameters.h.

◆ rminHE_

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

Definition at line 62 of file HcalGeomParameters.h.

◆ rminHO_

double HcalGeomParameters::rminHO_
private

Definition at line 54 of file HcalGeomParameters.h.

◆ rxb_

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

Definition at line 62 of file HcalGeomParameters.h.

◆ thkb_

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

Definition at line 60 of file HcalGeomParameters.h.

◆ thke_

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

Definition at line 60 of file HcalGeomParameters.h.

◆ ze_

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

Definition at line 60 of file HcalGeomParameters.h.

◆ zVcal_

double HcalGeomParameters::zVcal_
private

Definition at line 55 of file HcalGeomParameters.h.