From 8087bbb6cb2b2e8994bb29fa7004e69e94afe14f Mon Sep 17 00:00:00 2001 From: Sunanda Banerjee Date: Thu, 2 Apr 2020 18:58:13 +0200 Subject: [PATCH] Take care of Kevin's comments --- .../interface/HGCalParameters.h | 1 + .../HGCalCommonData/src/HGCalGeomParameters.cc | 8 ++++---- .../HGCalCommonData/src/HGCalParameters.cc | 18 +++++++++--------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Geometry/HGCalCommonData/interface/HGCalParameters.h b/Geometry/HGCalCommonData/interface/HGCalParameters.h index 1dabee3e1b7ac..ab52aba3caec8 100644 --- a/Geometry/HGCalCommonData/interface/HGCalParameters.h +++ b/Geometry/HGCalCommonData/interface/HGCalParameters.h @@ -25,6 +25,7 @@ class HGCalParameters { static constexpr double k_ScaleFromDD4HepToG4 = 10.0; static constexpr double k_ScaleToDD4HepFromG4 = 0.1; static constexpr uint32_t k_CornerSize = 6; + static constexpr double tol = 1.0e-12; struct hgtrap { int lay; diff --git a/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc b/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc index 05766c6cd4936..2d34924ffb4ee 100644 --- a/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc +++ b/Geometry/HGCalCommonData/src/HGCalGeomParameters.cc @@ -242,9 +242,9 @@ void HGCalGeomParameters::loadGeometryHexagon(const DDFilteredView& _fv, xx += (HGCalParameters::k_ScaleFromDDD * (p2.X())); yy += (HGCalParameters::k_ScaleFromDDD * (p2.Y())); #ifdef EDM_ML_DEBUG - if (std::abs(p2.X()) < 1.0e-12) + if (std::abs(p2.X()) < HGCalParameters::tol) p2.SetX(0.0); - if (std::abs(p2.Z()) < 1.0e-12) + if (std::abs(p2.Z()) < HGCalParameters::tol) p2.SetZ(0.0); edm::LogVerbatim("HGCalGeom") << "Wafer " << wafer << " Type " << type << " Cell " << cellx << " local " << xx << ":" << yy << " new " << p1 << ":" << p2; @@ -464,9 +464,9 @@ void HGCalGeomParameters::loadGeometryHexagon(const cms::DDCompactView* cpv, xx += (HGCalParameters::k_ScaleFromDDD * (p2.X())); yy += (HGCalParameters::k_ScaleFromDDD * (p2.Y())); #ifdef EDM_ML_DEBUG - if (std::abs(p2.X()) < 1.0e-12) + if (std::abs(p2.X()) < HGCalParameters::tol) p2.SetX(0.0); - if (std::abs(p2.Z()) < 1.0e-12) + if (std::abs(p2.Z()) < HGCalParameters::tol) p2.SetZ(0.0); edm::LogVerbatim("HGCalGeom") << "Wafer " << wafer << " Type " << type << " Cell " << cellx << " local " << xx << ":" << yy << " new " << p1 << ":" << p2; diff --git a/Geometry/HGCalCommonData/src/HGCalParameters.cc b/Geometry/HGCalCommonData/src/HGCalParameters.cc index a82fa3a123ef8..ca41bb0c2d80b 100644 --- a/Geometry/HGCalCommonData/src/HGCalParameters.cc +++ b/Geometry/HGCalCommonData/src/HGCalParameters.cc @@ -84,15 +84,15 @@ void HGCalParameters::fillTrForm(const HGCalParameters::hgtrform& mytr) { trformTranX_.emplace_back(mytr.h3v.x()); trformTranY_.emplace_back(mytr.h3v.y()); trformTranZ_.emplace_back(mytr.h3v.z()); - trformRotXX_.emplace_back((std::abs(mytr.hr.xx()) > 1.0e-12) ? mytr.hr.xx() : 0); - trformRotYX_.emplace_back((std::abs(mytr.hr.yx()) > 1.0e-12) ? mytr.hr.yx() : 0); - trformRotZX_.emplace_back((std::abs(mytr.hr.zx()) > 1.0e-12) ? mytr.hr.zx() : 0); - trformRotXY_.emplace_back((std::abs(mytr.hr.xy()) > 1.0e-12) ? mytr.hr.xy() : 0); - trformRotYY_.emplace_back((std::abs(mytr.hr.yy()) > 1.0e-12) ? mytr.hr.yy() : 0); - trformRotZY_.emplace_back((std::abs(mytr.hr.zy()) > 1.0e-12) ? mytr.hr.zy() : 0); - trformRotXZ_.emplace_back((std::abs(mytr.hr.xz()) > 1.0e-12) ? mytr.hr.xz() : 0); - trformRotYZ_.emplace_back((std::abs(mytr.hr.yz()) > 1.0e-12) ? mytr.hr.yz() : 0); - trformRotZZ_.emplace_back((std::abs(mytr.hr.zz()) > 1.0e-12) ? mytr.hr.zz() : 0); + trformRotXX_.emplace_back((std::abs(mytr.hr.xx()) > tol) ? mytr.hr.xx() : 0); + trformRotYX_.emplace_back((std::abs(mytr.hr.yx()) > tol) ? mytr.hr.yx() : 0); + trformRotZX_.emplace_back((std::abs(mytr.hr.zx()) > tol) ? mytr.hr.zx() : 0); + trformRotXY_.emplace_back((std::abs(mytr.hr.xy()) > tol) ? mytr.hr.xy() : 0); + trformRotYY_.emplace_back((std::abs(mytr.hr.yy()) > tol) ? mytr.hr.yy() : 0); + trformRotZY_.emplace_back((std::abs(mytr.hr.zy()) > tol) ? mytr.hr.zy() : 0); + trformRotXZ_.emplace_back((std::abs(mytr.hr.xz()) > tol) ? mytr.hr.xz() : 0); + trformRotYZ_.emplace_back((std::abs(mytr.hr.yz()) > tol) ? mytr.hr.yz() : 0); + trformRotZZ_.emplace_back((std::abs(mytr.hr.zz()) > tol) ? mytr.hr.zz() : 0); #ifdef EDM_ML_DEBUG unsigned int k = trformIndex_.size() - 1; edm::LogVerbatim("HGCalGeom") << "HGCalParameters[" << k << "] Index " << std::hex << trformIndex_[k] << std::dec