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-hgx337C Backport the bugfix from #41380 to CMSSW_13_0_X in Geometry/HGcalCommonData to take care of the segmentation fault for 25234.911 #41398

Merged
merged 1 commit into from
Apr 28, 2023
Merged
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
28 changes: 14 additions & 14 deletions Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,23 +189,23 @@ std::array<int, 3> HGCalDDDConstants::assignCellTrap(float x, float y, float z,
int ll = layer - hgpar_->firstLayer_;
xx -= hgpar_->xLayerHex_[ll];
yy -= hgpar_->yLayerHex_[ll];
if (mode_ == HGCalGeometryMode::TrapezoidCassette) {
int cassette = HGCalTileIndex::tileCassette(iphi, hgpar_->phiOffset_, hgpar_->nphiCassette_, hgpar_->cassettes_);
auto cshift = hgcassette_.getShift(layer, zside, cassette);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeomT") << "Cassette " << cassette << " Shift " << -(zside * cshift.first) << ":"
<< cshift.second;
#endif
xx += (zside * cshift.first);
yy -= cshift.second;
}
double phi = (((yy == 0.0) && (xx == 0.0)) ? 0. : std::atan2(yy, xx));
if (phi < 0)
phi += (2.0 * M_PI);
if (indx.second != 0)
iphi = (1 + static_cast<int>(phi / indx.second)) % hgpar_->scintCells(layer);
if (iphi == 0)
iphi = hgpar_->scintCells(layer);
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
edm::LogVerbatim("HGCalGeomT") << "Cassette " << cassette << " Shift " << cshift.first << ":" << cshift.second<< " Original " << xx << ":"
<< yy;
#endif
xx += (zside * cshift.first);
yy -= cshift.second;
}
type = hgpar_->scintType(layer);
double r = std::sqrt(xx * xx + yy * yy);
auto ir = std::lower_bound(hgpar_->radiusLayer_[type].begin(), hgpar_->radiusLayer_[type].end(), r);
Expand Down Expand Up @@ -927,17 +927,17 @@ std::pair<float, float> HGCalDDDConstants::locateCellTrap(
int ll = lay - hgpar_->firstLayer_;
x += hgpar_->xLayerHex_[ll];
y += hgpar_->yLayerHex_[ll];
if (irad < 0)
x = -x;
if (mode_ == HGCalGeometryMode::TrapezoidCassette) {
int cassette = HGCalTileIndex::tileCassette(iphi, hgpar_->phiOffset_, hgpar_->nphiCassette_, hgpar_->cassettes_);
auto cshift = hgcassette_.getShift(lay, zside, cassette);
auto cshift = hgcassette_.getShift(lay, -1, cassette);
if (debug)
edm::LogVerbatim("HGCalGeom") << "Cassette " << cassette << " Shift " << -(zside * cshift.first) << ":"
<< cshift.second;
x -= (zside * cshift.first);
x -= cshift.first;
y += cshift.second;
}
if (irad < 0)
x = -x;
}
if (!reco) {
x *= HGCalParameters::k_ScaleToDDD;
Expand Down