diff --git a/Geometry/HGCalCommonData/src/HGCalCellUV.cc b/Geometry/HGCalCommonData/src/HGCalCellUV.cc index 1c400a09bb0ff..ce7eaef0e95d1 100644 --- a/Geometry/HGCalCommonData/src/HGCalCellUV.cc +++ b/Geometry/HGCalCommonData/src/HGCalCellUV.cc @@ -299,9 +299,12 @@ std::pair HGCalCellUV::cellUVFromXY1( double ycell = (v + u - 2 * ncell_[type] + 1) * cellY; if ((yprime - sqrt3_ * xprime) > (ycell - sqrt3_ * xcell)) { u += -1; + if (((v - u) > ncell_[1]) || ((u - v) >= ncell_[1])) + --v; } else { u += -1; v += -1; + v = std::max(v, 0); } } } else if (partial == HGCalTypes::WaferHDBottom) { diff --git a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc index 639b2865c41f7..d0fe774040cdd 100644 --- a/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc +++ b/Geometry/HGCalCommonData/src/HGCalDDDConstants.cc @@ -607,22 +607,22 @@ bool HGCalDDDConstants::isValidHex8(int layer, int modU, int modV, int cellU, in << " Tests " << (cellU >= 0) << ":" << (cellU < 2 * N) << ":" << (cellV >= 0) << ":" << (cellV < 2 * N) << ":" << ((cellV - cellU) < N) << ":" << ((cellU - cellV) <= N); #endif - if (mode_ != HGCalGeometryMode::Hexagon8Cassette) { - if ((cellU < 0) || (cellU >= 2 * N) || (cellV < 0) || (cellV >= 2 * N)) { + // if (mode_ != HGCalGeometryMode::Hexagon8Cassette) { + if ((cellU < 0) || (cellU >= 2 * N) || (cellV < 0) || (cellV >= 2 * N)) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot statisfy Cell 1 condition " << cellU << ":" << cellV - << ":" << N; + edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot statisfy Cell 1 condition " << cellU << ":" << cellV + << ":" << N; #endif - return false; - } - if (((cellV - cellU) >= N) || ((cellU - cellV) > N)) { + return false; + } + if (((cellV - cellU) >= N) || ((cellU - cellV) > N)) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot statisfy Cell 2 condition " << cellU << ":" << cellV - << ":" << N; + edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot statisfy Cell 2 condition " << cellU << ":" << cellV + << ":" << N; #endif - return false; - } + return false; } + // } return isValidCell8(layer, modU, modV, cellU, cellV, type); } diff --git a/SimG4CMS/Calo/src/HGCScintSD.cc b/SimG4CMS/Calo/src/HGCScintSD.cc index ed8a5e0780ee0..8ccbc9d9b5363 100644 --- a/SimG4CMS/Calo/src/HGCScintSD.cc +++ b/SimG4CMS/Calo/src/HGCScintSD.cc @@ -220,7 +220,7 @@ uint32_t HGCScintSD::setDetUnitId(const G4Step* aStep) { double dx = xy.first - (hitPoint.x() / CLHEP::cm); double dy = xy.second - (hitPoint.y() / CLHEP::cm); double diff = std::sqrt(dx * dx + dy * dy); - constexpr double tol = 3.5; + constexpr double tol = 10.0; if (diff > tol) edm::LogVerbatim("HGCSim") << "CheckID " << HGCScintillatorDetId(id) << " input position: (" << hitPoint.x() / CLHEP::cm << ", " << hitPoint.y() / CLHEP::cm diff --git a/SimG4CMS/Calo/src/HGCalSD.cc b/SimG4CMS/Calo/src/HGCalSD.cc index d6429b2081356..d3ae4c40c5755 100644 --- a/SimG4CMS/Calo/src/HGCalSD.cc +++ b/SimG4CMS/Calo/src/HGCalSD.cc @@ -212,7 +212,7 @@ uint32_t HGCalSD::setDetUnitId(const G4Step* aStep) { double dx = xx - (hitPoint.x() / CLHEP::cm); double dy = xy.second - (hitPoint.y() / CLHEP::cm); double diff = std::sqrt(dx * dx + dy * dy); - constexpr double tol = 1.0; + constexpr double tol = 2.0; if (diff > tol) { bool valid1 = hgcons_->isValidHex8(hid1.layer(), hid1.waferU(), hid1.waferV(), hid1.cellU(), hid1.cellV(), true); int cellU(0), cellV(0), waferType(-1), waferU(0), waferV(0); diff --git a/Validation/HGCalValidation/scripts/testHGCalSimTTBar_cfg.py b/Validation/HGCalValidation/scripts/testHGCalSimTTBar_cfg.py index f9e9044a0621a..682eea57ed34c 100644 --- a/Validation/HGCalValidation/scripts/testHGCalSimTTBar_cfg.py +++ b/Validation/HGCalValidation/scripts/testHGCalSimTTBar_cfg.py @@ -64,10 +64,10 @@ ) process.MessageLogger.cerr.FwkReport.reportEvery = 1 -#if hasattr(process,'MessageLogger'): -# process.MessageLogger.ValidHGCal=dict() -# process.MessageLogger.HGCalGeom=dict() -# process.MessageLogger.HGCalSim=dict() +if hasattr(process,'MessageLogger'): + process.MessageLogger.HGCalError=dict() + process.MessageLogger.HGCSim=dict() +# process.MessageLogger.HGCalSim=dict() # Input source process.source = cms.Source("EmptySource") @@ -146,6 +146,9 @@ process.analysis_step = cms.Path(process.hgcalHitPartialEE+process.hgcalHitPartialHE) process.out_step = cms.EndPath(process.output) +process.g4SimHits.HGCSD.CheckID = True +process.g4SimHits.HGCScintSD.CheckID = True + # Schedule definition process.schedule = cms.Schedule(process.generation_step, process.genfiltersummary_step,