16 using namespace geant_units::operators;
21 rHO.emplace_back(rminHO_);
22 for (
double i : etaHO_)
27 std::vector<int> modHalf;
29 modHalf.emplace_back(nmodHB_);
30 modHalf.emplace_back(nzHB_);
32 modHalf.emplace_back(nmodHE_);
33 modHalf.emplace_back(nzHE_);
48 int idet = 0, lay = -1;
49 int nsiz =
static_cast<int>(copy.size());
51 lay = copy[nsiz - 1] / 10;
53 idet = copy[nsiz - 2] / 1000;
57 double dx = 0,
dy = 0,
dz = 0, dx1 = 0, dx2 = 0;
84 if (lay >= 0 && lay < maxLayer_) {
87 if (thkb_[lay] <= 0) {
95 for (
double k : rxb_) {
105 php.
dyHB.emplace_back(2. *
dy);
106 php.
dxHB.emplace_back(2. *
dz);
107 php.
layHB.emplace_back(lay);
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);
122 int ifi = -1, ich = -1;
124 ifi = copy[nsiz - 3];
126 ich = copy[nsiz - 4];
131 if (ifi == 1 && ich == 4) {
138 for (
unsigned int kk = 0;
kk < php.
zHO.size();
kk++) {
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];
148 php.
zHO[kk + 1] = z2;
155 php.
zHO.emplace_back(z1);
156 php.
zHO.emplace_back(z2);
159 edm::LogVerbatim(
"HCalGeom") <<
"Detector " << idet <<
" Lay " << lay <<
" fi " << ifi <<
" " << ich <<
" z "
164 }
else if (idet == 4) {
170 if (lay >= 0 && lay < maxLayer_) {
177 rminHE_[lay] += rinHE;
178 rmaxHE_[lay] += routHE;
180 for (
double k : php.
zxHE) {
192 php.
dx1HE.emplace_back(-dx1);
193 php.
dx2HE.emplace_back(-dx2);
194 php.
layHE.emplace_back(lay);
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);
207 }
else if (idet == 5) {
210 const std::vector<double>& paras = sol.
parameters();
213 << paras.size() <<
" Parameters";
214 for (
unsigned j = 0;
j < paras.size();
j++)
218 int nz = (int)(paras.size()) - 3;
229 <<
" R " << t.Rho() <<
" Z " << t.z();
247 int idet = 0, lay = -1;
248 int nsiz =
static_cast<int>(copy.size());
252 idet = copy[1] / 1000;
255 for (
unsigned int n = 0;
n < copy.size(); ++
n)
257 edm::LogVerbatim(
"HCalGeom") <<
"Detector " << idet <<
" Layer " << lay <<
" parameters: " << paras.size();
258 for (
unsigned int n = 0;
n < paras.size(); ++
n)
261 double dx = 0,
dy = 0,
dz = 0, dx1 = 0, dx2 = 0;
263 if (dd4hep::isA<dd4hep::Box>(fv.
solid())) {
267 }
else if (dd4hep::isA<dd4hep::Trap>(fv.
solid())) {
273 alp = 0.5 * (paras[6] + paras[10]);
274 }
else if (dd4hep::isA<dd4hep::Tube>(fv.
solid())) {
283 <<
" Layer " << lay <<
" R " <<
t.Rho();
285 if (lay >= 0 && lay < maxLayer_) {
288 if (thkb_[lay] <= 0) {
296 for (
double k : rxb_) {
306 php.
dyHB.emplace_back(2. *
dy);
307 php.
dxHB.emplace_back(2. *
dz);
308 php.
layHB.emplace_back(lay);
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);
323 int ifi = -1, ich = -1;
332 if (ifi == 1 && ich == 4) {
339 for (
unsigned int kk = 0;
kk < php.
zHO.size();
kk++) {
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];
349 php.
zHO[kk + 1] = z2;
356 php.
zHO.emplace_back(z1);
357 php.
zHO.emplace_back(z2);
360 edm::LogVerbatim(
"HCalGeom") <<
"Detector " << idet <<
" Lay " << lay <<
" fi " << ifi <<
" " << ich <<
" z "
365 }
else if (idet == 4) {
369 <<
" Layer " << lay <<
" Z " <<
t.z();
371 if (lay >= 0 && lay < maxLayer_) {
378 rminHE_[lay] += rinHE;
379 rmaxHE_[lay] += routHE;
381 for (
double k : php.
zxHE) {
393 php.
dx1HE.emplace_back(-dx1);
394 php.
dx2HE.emplace_back(-dx2);
395 php.
layHE.emplace_back(lay);
398 if (copy[0] == kHELayer1_ || copy[0] == kHELayer2_) {
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);
408 }
else if (idet == 5) {
416 for (
unsigned j = 0;
j < paras.size();
j++)
419 if (dd4hep::isA<dd4hep::Polycone>(fv.
solid())) {
420 int nz = (int)(paras.size()) - 3;
423 }
else if (dd4hep::isA<dd4hep::Tube>(fv.
solid()) || dd4hep::isA<dd4hep::ConeSegment>(fv.
solid())) {
430 edm::LogVerbatim(
"HCalGeom") <<
"Unknown Detector " << idet <<
" for " << fv.
name() <<
" Shape "
441 unsigned int id = array.size();
442 for (
unsigned int i = 0;
i < array.size();
i++) {
443 if (element == array[
i]) {
454 tmp = -
log(
tan(0.5 * atan(r / z)));
456 edm::LogVerbatim(
"HCalGeom") <<
"HcalGeomParameters::getEta " << r <<
" " << z <<
" ==> " <<
tmp;
477 for (
int i = 0;
i < 4; ++
i)
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);
488 rminHE_.emplace_back(0.0);
489 rmaxHE_.emplace_back(0.0);
494 int ibmx = 0, iemx = 0;
495 for (
int i = 0;
i < maxLayer_;
i++) {
497 rb_[
i] /=
static_cast<double>(ib_[
i]);
501 ze_[
i] /=
static_cast<double>(ie_[
i]);
502 rminHE_[
i] /=
static_cast<double>(ie_[
i]);
503 rmaxHE_[
i] /=
static_cast<double>(ie_[
i]);
507 edm::LogVerbatim(
"HCalGeom") <<
"Index " <<
i <<
" Barrel " << ib_[
i] <<
" " << rb_[
i] <<
" Endcap " << ie_[
i]
508 <<
" " << ze_[
i] <<
":" << rminHE_[
i] <<
":" << rmaxHE_[
i];
511 for (
int i = 4;
i >= 0;
i--) {
514 thkb_[
i] = thkb_[
i + 1];
518 thke_[
i] = thke_[
i + 1];
521 if (ib_[
i] == 0 || ie_[
i] == 0)
522 edm::LogVerbatim(
"HCalGeom") <<
"Index " <<
i <<
" Barrel " << ib_[
i] <<
" " << rb_[
i] <<
" Endcap " << ie_[
i]
528 for (
unsigned int k = 0;
k < php.
layHB.size(); ++
k)
531 for (
unsigned int k = 0;
k < php.
layHE.size(); ++
k)
534 edm::LogVerbatim(
"HCalGeom") <<
"HcalGeomParameters: Maximum Layer for HB " << ibmx <<
" for HE " << iemx
535 <<
" extent " << dzVcal_;
539 php.
rHB.resize(ibmx);
540 php.
drHB.resize(ibmx);
541 for (
int i = 0;
i < ibmx;
i++) {
545 edm::LogVerbatim(
"HCalGeom") <<
"HcalGeomParameters: php.rHB[" <<
i <<
"] = " << php.
rHB[
i] <<
" php.drHB[" <<
i
546 <<
"] = " << php.
drHB[
i];
551 php.
zHE.resize(iemx);
552 php.
dzHE.resize(iemx);
553 for (
int i = 0;
i < iemx;
i++) {
557 edm::LogVerbatim(
"HCalGeom") <<
"HcalGeomParameters: php.zHE[" <<
i <<
"] = " << php.
zHE[
i] <<
" php.dzHE[" <<
i
558 <<
"] = " << php.
dzHE[
i];
563 nzHB_ =
static_cast<int>(izb_.size());
564 nmodHB_ =
static_cast<int>(phib_.size());
566 edm::LogVerbatim(
"HCalGeom") <<
"HcalGeomParameters::loadGeometry: " << nzHB_ <<
" barrel half-sectors";
567 for (
int i = 0;
i < nzHB_;
i++)
569 edm::LogVerbatim(
"HCalGeom") <<
"HcalGeomParameters::loadGeometry: " << nmodHB_ <<
" barrel modules";
570 for (
int i = 0;
i < nmodHB_;
i++)
574 nzHE_ =
static_cast<int>(ize_.size());
575 nmodHE_ =
static_cast<int>(phie_.size());
577 edm::LogVerbatim(
"HCalGeom") <<
"HcalGeomParameters::loadGeometry: " << nzHE_ <<
" endcap half-sectors";
578 for (
int i = 0;
i < nzHE_;
i++)
580 edm::LogVerbatim(
"HCalGeom") <<
"HcalGeomParameters::loadGeometry: " << nmodHE_ <<
" endcap modules";
581 for (
int i = 0;
i < nmodHE_;
i++)
587 for (
unsigned int kk = 0;
kk < php.
zHO.size();
kk++)
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]);
598 edm::LogVerbatim(
"HCalGeom") <<
"HO Eta boundaries " << etaHO_[0] <<
" " << etaHO_[1] <<
" " << etaHO_[2] <<
" "
601 for (
unsigned int i = 0;
i < php.
zHO.size(); ++
i)
Log< level::Info, true > LogVerbatim
std::vector< double > zHO
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
double halfZ(void) const
half of the z-Axis
void loadGeometry(const DDFilteredView &_fv, HcalParameters &php)
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
static std::vector< std::string > checklist log
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
uint16_t *__restrict__ id
std::vector< double > rHB
nav_type copyNumbers() const
return the stack of copy numbers
unsigned find(int element, std::vector< int > &array) const
std::string name(Mapping a, V value)
std::vector< double > rhoxHB
std::vector< int > getModHalfHBHE(const int type) const
std::vector< double > dx2HE
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void getConstRHO(std::vector< double > &) const
A DDSolid represents the shape of a part.
const Translation translation() const
const cms::DDSolidShape shape() const
std::vector< double > rhoxHE
std::vector< double > zxHE
static constexpr double k_ScaleFromDDDToG4
std::vector< double > zHE
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.
bool next()
set current node to the next node in the filtered tree
std::vector< double > dx1HE
std::vector< double > dzHE
Cos< T >::type cos(const T &t)
void loadfinal(HcalParameters &php)
Interface to a Trapezoid.
Tan< T >::type tan(const T &t)
double y1(void) const
Half-length along y of the face at -pDz.
Abs< T >::type abs(const T &t)
DDSolidShape shape(void) const
The type of the solid.
static const double tan10deg
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 21 > DDSolidShapeMap
std::string_view name() const
bool firstChild()
set the current node to the first child
const std::vector< int > copyNos() const
The list of the volume copy numbers.
std::vector< double > dyHB
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...
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...
std::vector< double > dxHB
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
double getEta(double r, double z) const
std::vector< double > drHB
double y2(void) const
Half-length along y of the face at +pDz.
const std::vector< double > parameters() const
extract shape parameters
const DDTranslation & translation() const
The absolute translation of the current node.
static constexpr double k_ScaleFromDD4hepToG4
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
dd4hep::Solid solid() const
double x3(void) const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
void clear(HcalParameters &php)