Skip to content

Commit

Permalink
Backport the bugfix from cms-sw#41380 in Geometry/HGcalCommonData to …
Browse files Browse the repository at this point in the history
…take care of the segmentation fault for 25234.911
  • Loading branch information
Sunanda authored and Ming-Yan committed Nov 29, 2023
1 parent 4bcdd78 commit 728f07c
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,15 @@ std::array<int, 3> HGCalDDDConstants::assignCellTrap(float x, float y, float z,
iphi = (1 + static_cast<int>(phi / indx.second)) % hgpar_->scintCells(layer);
if (iphi == 0)
iphi = hgpar_->scintCells(layer);
if (cassetteMode()) {
if (mode_ == HGCalGeometryMode::TrapezoidCassette) {
int cassette = HGCalTileIndex::tileCassette(iphi, hgpar_->phiOffset_, hgpar_->nphiCassette_, hgpar_->cassettes_);
auto cshift = hgcassette_.getShift(layer, -1, cassette);
#ifdef EDM_ML_DEBUG
std::ostringstream st1;
st1 << "Cassette " << cassette << " Shift " << cshift.first << ":" << cshift.second << " Original " << xx << ":"
<< yy;
edm::LogVerbatim("HGCalGeomT") << "Cassette " << cassette << " Shift " << cshift.first << ":" << cshift.second<< " Original " << xx << ":"
<< yy;
#endif
xx += (zside * cshift.first);
yy -= cshift.second;
#ifdef EDM_ML_DEBUG
st1 << " Shifted " << xx << ":" << yy;
edm::LogVerbatim("HGCalGeomT") << st1.str();
#endif
}
type = hgpar_->scintType(layer);
double r = std::sqrt(xx * xx + yy * yy);
Expand Down Expand Up @@ -947,19 +942,14 @@ std::pair<float, float> HGCalDDDConstants::locateCellTrap(
y += hgpar_->yLayerHex_[ll];
if (irad < 0)
x = -x;
if (cassetteMode()) {
if (mode_ == HGCalGeometryMode::TrapezoidCassette) {
int cassette = HGCalTileIndex::tileCassette(iphi, hgpar_->phiOffset_, hgpar_->nphiCassette_, hgpar_->cassettes_);
auto cshift = hgcassette_.getShift(lay, -1, cassette);
std::ostringstream st1;
if (debug)
st1 << "Cassette " << cassette << " Shift " << cshift.first << ":" << cshift.second << " Original " << x << ":"
<< y;
edm::LogVerbatim("HGCalGeom") << "Cassette " << cassette << " Shift " << -(zside * cshift.first) << ":"
<< cshift.second;
x -= cshift.first;
y += cshift.second;
if (debug) {
st1 << " Final " << x << ":" << y;
edm::LogVerbatim("HGCalGeom") << st1.str();
}
}
}
if (!reco) {
Expand Down

0 comments on commit 728f07c

Please sign in to comment.