21 #include <unordered_set>
51 std::map<int, HGCalGeomParameters::layerParameters>
layers;
52 std::vector<HGCalParameters::hgtrform> trforms;
53 std::vector<bool> trformUse;
60 int lay = (nsiz > 0) ?
copy[nsiz - 1] : 0;
61 int zp = (nsiz > 2) ?
copy[nsiz - 3] : -1;
65 throw cms::Exception(
"DDException") <<
"Funny layer # " << lay <<
" zp " << zp <<
" in " << nsiz <<
" components";
68 php.
layer_.emplace_back(lay);
71 double rin(0), rout(0);
74 const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
75 const std::vector<double>& rmin = polyhedra.
rMinVec();
76 const std::vector<double>& rmax = polyhedra.
rMaxVec();
80 const DDTubs& tube = static_cast<DDTubs>(sol);
89 const CLHEP::HepRep3x3
rotation(
x.X(),
y.X(),
z.X(),
x.Y(),
y.Y(),
z.Y(),
x.Z(),
y.Z(),
z.Z());
90 const CLHEP::HepRotation hr(
rotation);
98 const CLHEP::Hep3Vector h3v(
xx,
yy,
zz);
106 trforms.emplace_back(mytrf);
107 trformUse.emplace_back(
false);
116 std::unordered_map<int32_t, int32_t> copies;
118 std::vector<int32_t> wafer2copy;
119 std::vector<HGCalGeomParameters::cellParameters> wafers;
121 DDValue val1(attribute, sdTag2, 0.0);
126 throw cms::Exception(
"DDException") <<
"Attribute " << val1 <<
" not found but needed.";
129 std::unordered_set<std::string>
names;
135 int wafer = (nsiz > 0) ?
copy[nsiz - 1] : 0;
136 int layer = (nsiz > 1) ?
copy[nsiz - 2] : 0;
138 throw cms::Exception(
"DDException") <<
"Funny wafer # " << wafer <<
" in " << nsiz <<
" components";
139 }
else if (layer > (
int)(
layers.size())) {
140 edm::LogWarning(
"HGCalGeom") <<
"Funny wafer # " << wafer <<
" Layer " << layer <<
":" <<
layers.size()
141 <<
" among " << nsiz <<
" components";
143 auto itr = copies.find(wafer);
144 auto cpy = copiesInLayers[layer].find(wafer);
145 if (
itr != copies.end() && cpy == copiesInLayers[layer].end()) {
146 copiesInLayers[layer][wafer] =
itr->second;
148 if (
itr == copies.end()) {
149 copies[wafer] = wafer2copy.size();
150 copiesInLayers[layer][wafer] = wafer2copy.size();
157 wafer2copy.emplace_back(wafer);
160 wafers.emplace_back(cell);
162 std::vector<double> zv, rv;
164 const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
165 zv = polyhedra.
zVec();
197 std::map<int, int> wafertype;
198 std::map<int, HGCalGeomParameters::cellParameters> cellsf, cellsc;
199 DDValue val2(attribute, sdTag3, 0.0);
204 throw cms::Exception(
"DDException") <<
"Attribute " << val2 <<
" not found but needed.";
212 int cellx = (nsiz > 0) ?
copy[nsiz - 1] : 0;
213 int wafer = (nsiz > 1) ?
copy[nsiz - 2] : 0;
218 <<
"Funny cell # " << cell <<
" type " <<
type <<
" in " << nsiz <<
" components";
220 auto ktr = wafertype.find(wafer);
221 if (ktr == wafertype.end())
222 wafertype[wafer] =
type;
224 std::map<int, HGCalGeomParameters::cellParameters>::iterator
itr;
227 itr = cellsf.find(cell);
228 newc = (
itr == cellsf.end());
230 itr = cellsc.find(cell);
231 newc = (
itr == cellsc.end());
235 bool half = (
name.find(
"Half") != std::string::npos);
248 edm::LogVerbatim(
"HGCalGeom") <<
"Wafer " << wafer <<
" Type " <<
type <<
" Cell " << cellx <<
" local "
249 <<
xx <<
":" <<
yy <<
" new " <<
p1 <<
":" <<
p2;
265 layers, trforms, trformUse, copies, copiesInLayers, wafer2copy, wafers, wafertype, cellsf, cellsc, php);
276 std::map<int, HGCalGeomParameters::layerParameters>
layers;
277 std::vector<HGCalParameters::hgtrform> trforms;
278 std::vector<bool> trformUse;
279 std::vector<std::pair<int, int> > trused;
282 const std::vector<double>& pars = fv.
parameters();
286 int lay = (nsiz > 0) ?
copy[0] : 0;
287 int zp = (nsiz > 2) ?
copy[2] : -1;
291 throw cms::Exception(
"DDException") <<
"Funny layer # " << lay <<
" zp " << zp <<
" in " << nsiz <<
" components";
294 php.
layer_.emplace_back(lay);
298 double rin(0), rout(0);
299 if (dd4hep::isA<dd4hep::Polyhedra>(fv.
solid())) {
302 }
else if (dd4hep::isA<dd4hep::Tube>(fv.
solid())) {
303 dd4hep::Tube tubeSeg(fv.
solid());
310 std::pair<int, int> layz(lay, zp);
311 if (
std::find(trused.begin(), trused.end(), layz) == trused.end()) {
312 trused.emplace_back(layz);
315 const CLHEP::HepRep3x3
rotation(
x.X(),
y.X(),
z.X(),
x.Y(),
y.Y(),
z.Y(),
x.Z(),
y.Z(),
z.Z());
316 const CLHEP::HepRotation hr(
rotation);
324 const CLHEP::Hep3Vector h3v(
xx,
yy,
zz);
332 trforms.emplace_back(mytrf);
333 trformUse.emplace_back(
false);
342 std::unordered_map<int32_t, int32_t> copies;
344 std::vector<int32_t> wafer2copy;
345 std::vector<HGCalGeomParameters::cellParameters> wafers;
350 throw cms::Exception(
"DDException") <<
"Attribute " << sdTag2 <<
" not found but needed.";
353 std::unordered_set<std::string>
names;
358 int wafer = (nsiz > 0) ?
copy[0] : 0;
359 int layer = (nsiz > 1) ?
copy[1] : 0;
361 throw cms::Exception(
"DDException") <<
"Funny wafer # " << wafer <<
" in " << nsiz <<
" components";
362 }
else if (layer > (
int)(
layers.size())) {
363 edm::LogWarning(
"HGCalGeom") <<
"Funny wafer # " << wafer <<
" Layer " << layer <<
":" <<
layers.size()
364 <<
" among " << nsiz <<
" components";
366 auto itr = copies.find(wafer);
367 auto cpy = copiesInLayers[layer].find(wafer);
368 if (
itr != copies.end() && cpy == copiesInLayers[layer].end()) {
369 copiesInLayers[layer][wafer] =
itr->second;
371 if (
itr == copies.end()) {
372 copies[wafer] = wafer2copy.size();
373 copiesInLayers[layer][wafer] = wafer2copy.size();
380 wafer2copy.emplace_back(wafer);
383 wafers.emplace_back(cell);
386 const std::vector<double>& pars = fv1.
parameters();
421 std::map<int, int> wafertype;
422 std::map<int, HGCalGeomParameters::cellParameters> cellsf, cellsc;
427 throw cms::Exception(
"DDException") <<
"Attribute " << sdTag3 <<
" not found but needed.";
434 int cellx = (nsiz > 0) ?
copy[0] : 0;
435 int wafer = (nsiz > 1) ?
copy[1] : 0;
440 <<
"Funny cell # " << cell <<
" type " <<
type <<
" in " << nsiz <<
" components";
442 auto ktr = wafertype.find(wafer);
443 if (ktr == wafertype.end())
444 wafertype[wafer] =
type;
446 std::map<int, HGCalGeomParameters::cellParameters>::iterator
itr;
449 itr = cellsf.find(cell);
450 newc = (
itr == cellsf.end());
452 itr = cellsc.find(cell);
453 newc = (
itr == cellsc.end());
457 bool half = (
name.find(
"Half") != std::string::npos);
470 edm::LogVerbatim(
"HGCalGeom") <<
"Wafer " << wafer <<
" Type " <<
type <<
" Cell " << cellx <<
" local "
471 <<
xx <<
":" <<
yy <<
" new " <<
p1 <<
":" <<
p2;
487 layers, trforms, trformUse, copies, copiesInLayers, wafer2copy, wafers, wafertype, cellsf, cellsc, php);
491 std::vector<HGCalParameters::hgtrform>& trforms,
492 std::vector<bool>& trformUse,
493 const std::unordered_map<int32_t, int32_t>& copies,
495 const std::vector<int32_t>& wafer2copy,
496 const std::vector<HGCalGeomParameters::cellParameters>& wafers,
497 const std::map<int, int>& wafertype,
498 const std::map<int, HGCalGeomParameters::cellParameters>& cellsf,
499 const std::map<int, HGCalGeomParameters::cellParameters>& cellsc,
501 if (((cellsf.size() + cellsc.size()) == 0) || (wafers.empty()) || (
layers.empty())) {
502 throw cms::Exception(
"DDException") <<
"HGCalGeomParameters: mismatch between geometry and specpar: cells "
503 << cellsf.size() <<
":" << cellsc.size() <<
" wafers " << wafers.size()
504 <<
" layers " <<
layers.size();
507 for (
unsigned int i = 0;
i <
layers.size(); ++
i) {
508 for (
auto& layer :
layers) {
513 php.
zLayerHex_.emplace_back(layer.second.zpos);
519 for (
unsigned int i = 0;
i < php.
layer_.size(); ++
i) {
520 for (
unsigned int i1 = 0;
i1 < trforms.size(); ++
i1) {
521 if (!trformUse[
i1] && php.
layerGroup_[trforms[
i1].lay - 1] == (
int)(
i + 1)) {
523 trforms[
i1].lay = (
i + 1);
524 trformUse[
i1] =
true;
527 for (
unsigned int i2 =
i1 + 1;
i2 < trforms.size(); ++
i2) {
528 if (!trformUse[
i2] && trforms[
i2].zp == trforms[
i1].zp &&
532 trformUse[
i2] =
true;
543 for (
unsigned i = 0;
i < wafer2copy.size(); ++
i) {
547 auto ktr = wafertype.find(wafer2copy[
i]);
548 int typet = (ktr == wafertype.end()) ? 0 : (ktr->second);
550 double r = wafers[
i].xyz.perp();
552 for (
int k = 1;
k < 4; ++
k) {
563 std::vector<HGCalGeomParameters::cellParameters>::const_iterator itrf = wafers.end();
564 for (
unsigned int i = 0;
i < cellsf.size(); ++
i) {
565 auto itr = cellsf.find(
i);
566 if (
itr == cellsf.end()) {
567 throw cms::Exception(
"DDException") <<
"HGCalGeomParameters: missing info for fine cell number " <<
i;
569 double xx = (
itr->second).xyz.x();
570 double yy = (
itr->second).xyz.y();
571 int waf = (
itr->second).wafer;
579 for (
unsigned int i = 0;
i < cellsc.size(); ++
i) {
580 auto itr = cellsc.find(
i);
581 if (
itr == cellsc.end()) {
582 throw cms::Exception(
"DDException") <<
"HGCalGeomParameters: missing info for coarse cell number " <<
i;
584 double xx = (
itr->second).xyz.x();
585 double yy = (
itr->second).xyz.y();
586 int waf = (
itr->second).wafer;
599 php.
depth_.emplace_back(
i + 1);
639 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalGeomParameters: wafer radius " << php.
waferR_ <<
" and dimensions of the "
653 <<
" coarse cells in a wafer";
672 for (std::unordered_map<int, int>::const_iterator
itr = theModules.begin();
itr != theModules.end(); ++
itr, ++k2) {
682 std::map<int, HGCalGeomParameters::layerParameters>
layers;
694 if (nsiz < levelTop) {
695 int lay =
copy[nsiz - 1];
702 <<
" lay " << lay <<
" z " <<
zside;
706 <<
"Funny layer # " << lay <<
" zp " <<
zside <<
" in " << nsiz <<
" components";
709 php.
layer_.emplace_back(lay);
712 const DDTubs& tube = static_cast<DDTubs>(sol);
719 if (trforms.find(std::make_pair(lay,
zside)) == trforms.end()) {
722 const CLHEP::HepRep3x3
rotation(
x.X(),
y.X(),
z.X(),
x.Y(),
y.Y(),
z.Y(),
x.Z(),
y.Z(),
z.Z());
723 const CLHEP::HepRotation hr(
rotation);
738 trforms[std::make_pair(lay,
zside)] = mytrf;
756 std::map<int, HGCalGeomParameters::layerParameters>
layers;
767 int nsiz = static_cast<int>(fv.
level());
768 if (nsiz < levelTop) {
776 <<
" size " << nsiz <<
":" << levelTop <<
" lay " << lay <<
" z " <<
zside <<
":"
781 <<
"Funny layer # " << lay <<
" zp " <<
zside <<
" in " << nsiz <<
" components";
784 php.
layer_.emplace_back(lay);
787 const std::vector<double>& pars = fv.
parameters();
794 if (trforms.find(std::make_pair(lay,
zside)) == trforms.end()) {
797 const CLHEP::HepRep3x3
rotation(
x.X(),
y.X(),
z.X(),
x.Y(),
y.Y(),
z.Y(),
x.Z(),
y.Z(),
z.Z());
798 const CLHEP::HepRotation hr(
rotation);
813 trforms[std::make_pair(lay,
zside)] = mytrf;
826 const int& firstLayer,
828 double rmin(0), rmax(0);
829 for (
unsigned int i = 0;
i <
layers.size(); ++
i) {
830 for (
auto& layer :
layers) {
831 if (layer.first == (
int)(
i + firstLayer)) {
835 php.
zLayerHex_.emplace_back(layer.second.zpos);
837 rmin = layer.second.rmin;
838 rmax = layer.second.rmax;
840 if (rmin > layer.second.rmin)
841 rmin = layer.second.rmin;
842 if (rmax < layer.second.rmax)
843 rmax = layer.second.rmax;
849 php.
rLimit_.emplace_back(rmin);
850 php.
rLimit_.emplace_back(rmax);
855 for (
unsigned int i = 0;
i < php.
layer_.size(); ++
i) {
856 for (
auto& trform : trforms) {
857 if (trform.first.first == (
int)(
i + firstLayer)) {
930 php.
boundR_ = fv.
get<std::vector<double> >(sdTag4,
"RadiusBound");
932 php.
rLimit_ = fv.
get<std::vector<double> >(sdTag4,
"RadiusLimits");
940 php.
slopeMin_ = fv.
get<std::vector<double> >(sdTag4,
"Slope");
945 const auto&
dummy = fv.
get<std::vector<double> >(sdTag2,
"WaferSize");
949 php.
cellSize_ = fv.
get<std::vector<double> >(sdTag3,
"CellSize");
958 <<
" for cell grouping " << php.
boundR_[0] <<
":" << php.
boundR_[1] <<
":"
963 <<
"for the 3 ranges:";
1014 std::vector<int> waferIndex, waferTypes, waferParts, waferOrien;
1041 const auto&
dummy = fv.
get<std::vector<double> >(sdTag1,
"RadiusCuts");
1042 if (
dummy.size() > 3) {
1051 php.
slopeMin_ = fv.
get<std::vector<double> >(sdTag1,
"SlopeBottom");
1052 php.
zFrontMin_ = fv.
get<std::vector<double> >(sdTag1,
"ZFrontBottom");
1054 php.
rMinFront_ = fv.
get<std::vector<double> >(sdTag1,
"RMinFront");
1057 php.
slopeTop_ = fv.
get<std::vector<double> >(sdTag1,
"SlopeTop");
1058 php.
zFrontTop_ = fv.
get<std::vector<double> >(sdTag1,
"ZFrontTop");
1060 php.
rMaxFront_ = fv.
get<std::vector<double> >(sdTag1,
"RMaxFront");
1063 for (
unsigned int k = 0;
k < kmax; ++
k)
1066 const auto& dummy2 = fv.
get<std::vector<double> >(sdTag1,
"LayerOffset");
1067 if (!dummy2.empty()) {
1073 for (
auto const& it : vmap) {
1074 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"RadiusMixBoundary")) {
1075 for (
const auto&
i : it.second)
1077 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"ZRanges")) {
1078 for (
const auto&
i : it.second)
1080 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"LayerCenter")) {
1081 for (
const auto&
i : it.second)
1090 std::vector<int> waferIndex, waferTypes, waferParts, waferOrien;
1092 for (
auto const& it : vmap) {
1093 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"WaferIndexEE")) {
1094 for (
const auto&
i : it.second)
1095 waferIndex.emplace_back(std::round(
i));
1096 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"WaferTypesEE")) {
1097 for (
const auto&
i : it.second)
1098 waferTypes.emplace_back(std::round(
i));
1099 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"WaferPartialEE")) {
1100 for (
const auto&
i : it.second)
1101 waferParts.emplace_back(std::round(
i));
1102 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"WaferOrientEE")) {
1103 for (
const auto&
i : it.second)
1104 waferOrien.emplace_back(std::round(
i));
1108 for (
auto const& it : vmap) {
1109 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"WaferIndexHE")) {
1110 for (
const auto&
i : it.second)
1111 waferIndex.emplace_back(std::round(
i));
1112 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"WaferTypesHE")) {
1113 for (
const auto&
i : it.second)
1114 waferTypes.emplace_back(std::round(
i));
1115 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"WaferPartialHE")) {
1116 for (
const auto&
i : it.second)
1117 waferParts.emplace_back(std::round(
i));
1118 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"WaferOrientHE")) {
1119 for (
const auto&
i : it.second)
1120 waferOrien.emplace_back(std::round(
i));
1134 <<
"parameters for 120 to 200 micron "
1139 <<
"parameters for 200 to 300 micron "
1164 const std::vector<int>& waferIndex,
1165 const std::vector<int>& waferTypes,
1166 const std::vector<int>& waferParts,
1167 const std::vector<int>& waferOrien) {
1169 for (
unsigned int k = 0;
k < waferIndex.size(); ++
k) {
1177 <<
" Type " << waferTypes[
k] <<
" Partial type " << waferParts[
k] <<
" Orientation "
1178 << waferOrien[
k] <<
":"
1222 std::vector<int> tileIndx, tileType, tileSiPM;
1223 std::vector<int> tileHEX1, tileHEX2, tileHEX3, tileHEX4;
1224 std::vector<double> tileRMin, tileRMax;
1225 std::vector<int> tileRingMin, tileRingMax;
1233 tileRMin = fv.
vector(
"TileRMin");
1234 tileRMax = fv.
vector(
"TileRMax");
1259 for (
auto const& it : vmap) {
1260 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"RadiusMixBoundary")) {
1261 for (
const auto&
i : it.second)
1263 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"ZRanges")) {
1264 for (
const auto&
i : it.second)
1266 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"LayerCenter")) {
1267 for (
const auto&
i : it.second)
1274 php.
rMinLayerBH_ = fv.
get<std::vector<double> >(sdTag1,
"RMinLayerBH");
1281 php.
slopeMin_ = fv.
get<std::vector<double> >(sdTag1,
"SlopeBottom");
1282 php.
zFrontMin_ = fv.
get<std::vector<double> >(sdTag1,
"ZFrontBottom");
1284 php.
rMinFront_ = fv.
get<std::vector<double> >(sdTag1,
"RMinFront");
1287 php.
slopeTop_ = fv.
get<std::vector<double> >(sdTag1,
"SlopeTop");
1288 php.
zFrontTop_ = fv.
get<std::vector<double> >(sdTag1,
"ZFrontTop");
1290 php.
rMaxFront_ = fv.
get<std::vector<double> >(sdTag1,
"RMaxFront");
1293 for (
unsigned int k = 0;
k < kmax; ++
k)
1296 const auto& dummy2 = fv.
get<std::vector<double> >(sdTag1,
"LayerOffset");
1303 std::vector<int> tileIndx, tileType, tileSiPM;
1304 std::vector<int> tileHEX1, tileHEX2, tileHEX3, tileHEX4;
1305 std::vector<double> tileRMin, tileRMax;
1306 std::vector<int> tileRingMin, tileRingMax;
1307 for (
auto const& it : vmap) {
1308 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileIndex")) {
1309 for (
const auto&
i : it.second)
1310 tileIndx.emplace_back(std::round(
i));
1311 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileType")) {
1312 for (
const auto&
i : it.second)
1313 tileType.emplace_back(std::round(
i));
1314 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileSiPM")) {
1315 for (
const auto&
i : it.second)
1316 tileSiPM.emplace_back(std::round(
i));
1317 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileHEX1")) {
1318 for (
const auto&
i : it.second)
1319 tileHEX1.emplace_back(std::round(
i));
1320 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileHEX2")) {
1321 for (
const auto&
i : it.second)
1322 tileHEX2.emplace_back(std::round(
i));
1323 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileHEX3")) {
1324 for (
const auto&
i : it.second)
1325 tileHEX3.emplace_back(std::round(
i));
1326 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileHEX4")) {
1327 for (
const auto&
i : it.second)
1328 tileHEX4.emplace_back(std::round(
i));
1329 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileRMin")) {
1330 for (
const auto&
i : it.second)
1332 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileRMax")) {
1333 for (
const auto&
i : it.second)
1335 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileRingMin")) {
1336 for (
const auto&
i : it.second)
1337 tileRingMin.emplace_back(std::round(
i));
1338 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"TileRingMax")) {
1339 for (
const auto&
i : it.second)
1340 tileRingMax.emplace_back(std::round(
i));
1391 const std::vector<int>& tileIndx,
1392 const std::vector<int>& tileType,
1393 const std::vector<int>& tileSiPM,
1394 const std::vector<int>& tileHEX1,
1395 const std::vector<int>& tileHEX2,
1396 const std::vector<int>& tileHEX3,
1397 const std::vector<int>& tileHEX4,
1398 const std::vector<double>& tileRMin,
1399 const std::vector<double>& tileRMax,
1400 const std::vector<int>& tileRingMin,
1401 const std::vector<int>& tileRingMax) {
1403 for (
unsigned int k = 0;
k < tileIndx.size(); ++
k) {
1408 <<
" Type " << tileType[
k] <<
" SiPM " << tileSiPM[
k] <<
" HEX " << std::hex
1409 << tileHEX1[
k] <<
":" << tileHEX2[
k] <<
":" << tileHEX3[
k] <<
":" << tileHEX4[
k]
1414 for (
unsigned int k = 0;
k < tileRMin.size(); ++
k) {
1417 edm::LogVerbatim(
"HGCalGeom") <<
"TileRingR[" <<
k <<
"] " << tileRMin[
k] <<
":" << tileRMax[
k];
1421 for (
unsigned k = 0;
k < tileRingMin.size(); ++
k) {
1424 edm::LogVerbatim(
"HGCalGeom") <<
"TileRingRange[" <<
k <<
"] " << tileRingMin[
k] <<
":" << tileRingMax[
k];
1433 edm::LogVerbatim(
"HGCalGeom") <<
"Input waferWidth " << waferW <<
":" << rmin <<
" R Limits: " << rin <<
":" << rout
1434 <<
" Fine " << rMaxFine;
1442 double dx = 0.5 * waferW;
1443 double dy = 3.0 *
dx *
tan(30._deg);
1444 double rr = 2.0 *
dx *
tan(30._deg);
1445 int ncol = (
int)(2.0 * rout / waferW) + 1;
1446 int nrow = (
int)(rout / (waferW *
tan(30._deg))) + 1;
1447 int ns2 = (2 * ncol + 1) * (2 * nrow + 1) * php.
layer_.size();
1448 int incm(0), inrm(0), kount(0), ntot(0);
1454 for (
int nr = -nrow;
nr <= nrow; ++
nr) {
1455 int inr = (
nr >= 0) ?
nr : -
nr;
1456 for (
int nc = -ncol; nc <= ncol; ++nc) {
1457 int inc = (nc >= 0) ? nc : -nc;
1458 if (inr % 2 == inc % 2) {
1459 double xpos = nc *
dx;
1460 double ypos =
nr *
dy;
1462 double rpos =
std::sqrt(xpos * xpos + ypos * ypos);
1463 int typet = (rpos < rMaxFine) ? 1 : 2;
1465 for (
int k = 1;
k < 4; ++
k) {
1466 if ((rpos + rmin) <= php.
boundR_[
k]) {
1480 edm::LogVerbatim(
"HGCalGeom") << kount <<
":" << ntot <<
" Copy " <<
copy <<
" Type " << typel <<
":" << typet
1481 <<
" Location " <<
corner.first <<
" Position " << xpos <<
":" << ypos
1482 <<
" Layers " << php.
layer_.size();
1489 for (
unsigned int il = 0; il < php.
layer_.size(); ++il) {
1490 std::pair<int, int>
corner =
1493 auto cpy = copiesInLayers[php.
layer_[il]].find(
copy);
1494 if (cpy == copiesInLayers[php.
layer_[il]].end())
1512 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalWaferHexagon: # of columns " << incm <<
" # of rows " << inrm <<
" and "
1513 << kount <<
":" << ntot <<
" wafers; R " << rin <<
":" << rout;
1515 for (
unsigned int k = 0;
k < copiesInLayers.size(); ++
k) {
1516 const auto& theModules = copiesInLayers[
k];
1519 for (std::unordered_map<int, int>::const_iterator
itr = theModules.begin();
itr != theModules.end(); ++
itr, ++k2) {
1539 edm::LogVerbatim(
"HGCalGeom") <<
"Input waferWidth " << waferW <<
":" << waferS <<
" R Max: " << rout;
1547 double r = 0.5 * (waferW + waferS);
1549 double dy = 0.75 *
R;
1550 double r1 = 0.5 * waferW;
1552 int N = (
r == 0) ? 3 : ((
int)(0.5 * rout /
r) + 3);
1553 int ns1 = (2 *
N + 1) * (2 *
N + 1);
1556 edm::LogVerbatim(
"HGCalGeom") <<
"wafer " << waferW <<
":" << waferS <<
" r " <<
r <<
" dy " <<
dy <<
" N " <<
N
1557 <<
" sizes " << ns1 <<
":" << ns2;
1558 std::vector<int> indtypes(ns1 + 1);
1564 int ipos(0), lpos(0), uvmax(0), nwarn(0);
1565 std::vector<int> uvmx(php.
zLayerHex_.size(), 0);
1566 for (
int v = -
N;
v <=
N; ++
v) {
1567 for (
int u = -
N; u <=
N; ++u) {
1569 int nc = -2 * u +
v;
1570 double xpos = nc *
r;
1571 double ypos =
nr *
dy;
1576 wafersInLayers[indx] = ipos;
1586 double xpos0 = xpos + xyoff.first;
1587 double ypos0 = ypos + xyoff.second;
1598 typesInLayers[kndx] = lpos;
1601 indtypes.emplace_back(kndx);
1603 std::pair<int, int>
corner =
1608 <<
" u " << u <<
" v " <<
v <<
" with " <<
corner.first <<
" corners";
1616 edm::LogVerbatim(
"HGCalGeom") <<
"Layer " << lay <<
" u|v " << u <<
":" <<
v <<
" with corner "
1634 <<
"Layer:u:v " <<
i <<
":" << lay <<
":" << u <<
":" <<
v <<
" Part " << corner0.first <<
":"
1635 <<
part <<
" Orient " << corner0.second <<
":" <<
orient <<
" Position " << xpos0 <<
":" << ypos0
1637 <<
" Compatibiliety Flag " <<
ok;
1643 waferTypes[
wl] = corner0;
1646 <<
"Layer " << lay <<
" u|v " << u <<
":" <<
v <<
" Index " << std::hex <<
wl <<
std::dec <<
" pos "
1647 << xpos0 <<
":" << ypos0 <<
" R " <<
r1 <<
":" << R1 <<
" Range " << php.
rMinLayHex_[
i] <<
":"
1649 <<
corner.second <<
" croner0 " << corner0.first <<
":" << corner0.second;
1654 edm::LogVerbatim(
"HGCalGeom") <<
"Layer " << lay <<
" u|v " << u <<
":" <<
v <<
" with corner "
1663 edm::LogWarning(
"HGCalGeom") <<
"HGCalGeomParameters::loadWafer8: there are " << nwarn
1664 <<
" wafers with non-matching partial- orientation types";
1702 int id = indtypes[
k];
1723 << xyoff.first <<
":" << xyoff.second;
1744 for (
auto const& it : vmap) {
1745 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"waferFine")) {
1746 for (
const auto&
i : it.second)
1748 }
else if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
"waferCoarse")) {
1749 for (
const auto&
i : it.second)
1760 for (
unsigned int k = 0;
k < php.
cellFine_.size(); ++
k)
1781 for (
unsigned int k = 0;
k < 2; ++
k) {
1805 for (
unsigned int k = 0;
k < 2; ++
k) {
1814 edm::LogVerbatim(
"HGCalGeom") <<
"Old [" <<
k <<
"] rmax " << rmax <<
" Z = " << zv
1815 <<
" dEta = " << php.
cellSize_[
k] <<
"\nOld[0] new R = " << rv <<
" Eta = " <<
eta;
1823 edm::LogVerbatim(
"HGCalGeom") <<
"Old [" << kount <<
"] new R = " << rv <<
" Eta = " <<
eta;
1831 std::vector<double>::iterator
low,
high;
1848 edm::LogVerbatim(
"HGCalGeom") <<
"Modified irlow " << irlow <<
" dr " << drlow;
1867 edm::LogVerbatim(
"HGCalGeom") <<
"Modified irhigh " << irhigh <<
" dr " << drhigh;
1873 edm::LogVerbatim(
"HGCalGeom") <<
"Old Layer " <<
k <<
" Type " <<
kk <<
" Low edge " << irlow <<
":" << drlow
1874 <<
" Top edge " << irhigh <<
":" << drhigh;
1879 for (
unsigned int k = 0;
k < 2; ++
k) {
1908 mytr.
h = 0.5 * (rmax - rmin);
1937 const std::vector<double>& fvec =
value.doubles();
1938 int nval = fvec.size();
1942 <<
"HGCalGeomParameters: # of " <<
str <<
" bins " << nval <<
" < " << nmin <<
" ==> illegal";
1945 if (nval < 1 && nmin == 0) {
1947 <<
"HGCalGeomParameters: # of " <<
str <<
" bins " << nval <<
" < 1 ==> illegal"
1948 <<
" (nmin=" << nmin <<
")";
1954 throw cms::Exception(
"DDException") <<
"HGCalGeomParameters: cannot get array " <<
str;
1956 std::vector<double> fvec;
1962 const std::vector<HGCalGeomParameters::cellParameters>& wafers,
1963 std::vector<HGCalGeomParameters::cellParameters>::const_iterator& itrf,
1967 if (itrf == wafers.end()) {
1968 for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator
itr = wafers.begin();
itr != wafers.end();
1970 if (
itr->wafer == wafer) {
1976 double dx(0),
dy(0);
1977 if (itrf != wafers.end()) {
1978 dx = (
xx - itrf->xyz.x());
1981 dy = (
yy - itrf->xyz.y());
1985 return std::make_pair(
dx,
dy);
1989 std::for_each(
v.begin(),
v.end(), [
s](
double&
n) {
n *=
s; });