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

Fix deprecated enum arithmetics in CaloGeometry #45133

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion Geometry/CaloGeometry/src/CaloGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ unsigned int CaloGeometry::makeIndex(DetId::Detector det, int subdet, bool& ok)
edm::LogWarning("CaloGeometry") << "Det:Subdet " << idet << ":" << subdet << " min|max Det " << kMinDet << ":"
<< kMaxDet << " min|max subdet 0:" << kMaxSub;

return ((det - kMinDet) * kNSubDets + subdet);
return ((det - static_cast<int>(kMinDet)) * kNSubDets + subdet);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to define all these

enum {
kMaxDet = 10,
kMinDet = 3,
kNDets = kMaxDet - kMinDet + 1,
kMaxSub = 6,
kNSubDets = kMaxSub + 1,
kLength = kNDets * kNSubDets
};

as static constexpr constants.

}

void CaloGeometry::setSubdetGeometry(DetId::Detector det, int subdet, const CaloSubdetectorGeometry* geom) {
Expand Down