Skip to content

Commit

Permalink
Merge pull request #32423 from bsunanda/Phase2-hgx270
Browse files Browse the repository at this point in the history
Phase2-hgx270 Bug correction for HGCal scintillator Geometry
  • Loading branch information
cmsbuild authored Dec 10, 2020
2 parents 8f068ef + 15cd503 commit 4d8b2cc
Showing 4 changed files with 22 additions and 20 deletions.
3 changes: 2 additions & 1 deletion Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Original file line number Diff line number Diff line change
@@ -729,7 +729,8 @@ std::pair<float, float> HGCalDDDConstants::locateCellTrap(int lay, int irad, int
<< hgpar_->iradMaxBH_[indx.first] << " Type " << type << " Z " << indx.first << ":"
<< z << " phi " << phi << " R " << r << ":" << range.first << ":" << range.second;
#endif
r = std::max(range.first, std::min(r, range.second));
if (mode_ != HGCalGeometryMode::TrapezoidFile)
r = std::max(range.first, std::min(r, range.second));
x = r * std::cos(phi);
y = r * std::sin(phi);
if (irad < 0)
1 change: 1 addition & 0 deletions Geometry/HGCalCommonData/src/HGCalGeomParameters.cc
Original file line number Diff line number Diff line change
@@ -1789,6 +1789,7 @@ void HGCalGeomParameters::loadCellTrapezoid(HGCalParameters& php) {
edm::LogVerbatim("HGCalGeom") << "New [" << kk << "] new R = " << rv << " Eta = " << eta;
#endif
}
php.radiusLayer_[k].emplace_back(php.tileRingR_[php.tileRingR_.size() - 1].second);
}
// Minimum and maximum radius index for each layer
for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
4 changes: 2 additions & 2 deletions Geometry/HGCalGeometry/src/HGCalGeometryLoader.cc
Original file line number Diff line number Diff line change
@@ -101,8 +101,8 @@ HGCalGeometry* HGCalGeometryLoader::build(const HGCalTopology& topology) {
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "HGCalGeometryLoader::rad:phi:type " << irad * zside << ":" << iphi << ":"
<< type << " DetId " << HGCScintillatorDetId(detId) << " " << std::hex
<< detId.rawId() << std::dec << " transf " << ht3d.getTranslation() << " and "
<< ht3d.getRotation();
<< detId.rawId() << std::dec << " transf " << ht3d.getTranslation() << " R "
<< ht3d.getTranslation().perp() << " and " << ht3d.getRotation();
#endif
HGCalParameters::hgtrap vol = topology.dddConstants().getModule(md, false, true);
params[FlatTrd::k_dZ] = vol.dz;
34 changes: 17 additions & 17 deletions Geometry/HGCalGeometry/test/HGCalGeomLocatorTester.cc
Original file line number Diff line number Diff line change
@@ -84,28 +84,28 @@ void HGCalGeomLocaterTester::doTestSilicon(const HGCalGeometry* geom, DetId::Det
void HGCalGeomLocaterTester::doTestScintillator(const HGCalGeometry* geom, DetId::Detector det) {
const std::vector<DetId>& ids = geom->getValidDetIds();
std::cout << "doTest:: " << ids.size() << " valid ids for " << geom->cellElement() << std::endl;
const double tol = 0.5;
const double tol = 0.01;
const unsigned int step = 10;
int all(0), good(0), bad(0);
for (unsigned int k = 0; k < ids.size(); k += step) {
++all;
HGCScintillatorDetId id(ids[k]);
if ((id.iradiusAbs() != 7) && (id.iradiusAbs() != 41)) {
std::cout << "ID[" << k << "] " << id;
GlobalPoint global = geom->getPosition(id);
auto tilexy = geom->topology().dddConstants().locateCell(id, false);
double dx = global.x() - tilexy.first;
double dy = global.y() - tilexy.second;
std::cout << " position (" << global.x() << ", " << global.y() << ", " << global.z() << ") tileXY ("
<< tilexy.first << ", " << tilexy.second << ") Delta (" << dx << ", " << dy << ")";
if ((std::abs(dx) > tol) || (std::abs(dy) > tol)) {
std::cout << "***** ERROR *****" << std::endl;
++bad;
geom->topology().dddConstants().locateCell(id, true);
} else {
std::cout << std::endl;
++good;
}
std::cout << "ID[" << k << "] " << id;
GlobalPoint global = geom->getPosition(id);
auto tilexy = geom->topology().dddConstants().locateCell(id, false);
double dx = global.x() - tilexy.first;
double dy = global.y() - tilexy.second;
std::cout << " position (" << global.x() << ", " << global.y() << ", " << global.z() << ") tileXY (" << tilexy.first
<< ", " << tilexy.second << ") Delta (" << dx << ", " << dy << ")";
if ((std::abs(dx) > tol) || (std::abs(dy) > tol)) {
double r1 = sqrt(global.x() * global.x() + global.y() * global.y());
double r2 = sqrt(tilexy.first * tilexy.first + tilexy.second * tilexy.second);
std::cout << " R " << r1 << ":" << r2 << " ***** ERROR *****" << std::endl;
++bad;
geom->topology().dddConstants().locateCell(id, true);
} else {
std::cout << std::endl;
++good;
}
}
std::cout << "\n\nStudied " << all << " (" << ids.size() << ") IDs of which " << good << " are good and " << bad

0 comments on commit 4d8b2cc

Please sign in to comment.