Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phase2-hgx333B Fix issues of wrong DetID assignment for V17 geometry of HGCal #40281

Merged
merged 3 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Geometry/HGCalCommonData/src/HGCalCellUV.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,12 @@ std::pair<int32_t, int32_t> 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) {
Expand Down
22 changes: 11 additions & 11 deletions Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion SimG4CMS/Calo/src/HGCScintSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion SimG4CMS/Calo/src/HGCalSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 7 additions & 4 deletions Validation/HGCalValidation/scripts/testHGCalSimTTBar_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand Down