From 5b1e1c8771091cc70ff7a428d041a925eb4a6a77 Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Tue, 4 Jun 2024 15:21:05 +0200 Subject: [PATCH 1/2] Fix deprecated enum arithmetics in CaloGeometry --- Geometry/CaloGeometry/src/CaloGeometry.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/CaloGeometry/src/CaloGeometry.cc b/Geometry/CaloGeometry/src/CaloGeometry.cc index ed24ab2aa3c32..66d652da3d6b1 100644 --- a/Geometry/CaloGeometry/src/CaloGeometry.cc +++ b/Geometry/CaloGeometry/src/CaloGeometry.cc @@ -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(kMinDet)) * kNSubDets + subdet); } void CaloGeometry::setSubdetGeometry(DetId::Detector det, int subdet, const CaloSubdetectorGeometry* geom) { From f7a44d155d5de450563caf63685795fccfb411ea Mon Sep 17 00:00:00 2001 From: Ivan Razumov Date: Tue, 4 Jun 2024 16:11:13 +0200 Subject: [PATCH 2/2] Changes from review --- Geometry/CaloGeometry/interface/CaloGeometry.h | 10 ++-------- Geometry/CaloGeometry/src/CaloGeometry.cc | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Geometry/CaloGeometry/interface/CaloGeometry.h b/Geometry/CaloGeometry/interface/CaloGeometry.h index 11ab58ecdea9a..b4e3116bd58ef 100644 --- a/Geometry/CaloGeometry/interface/CaloGeometry.h +++ b/Geometry/CaloGeometry/interface/CaloGeometry.h @@ -56,14 +56,8 @@ class CaloGeometry { unsigned int makeIndex(DetId::Detector det, int subdet, bool& ok) const; - enum { - kMaxDet = 10, - kMinDet = 3, - kNDets = kMaxDet - kMinDet + 1, - kMaxSub = 6, - kNSubDets = kMaxSub + 1, - kLength = kNDets * kNSubDets - }; + static constexpr int kMaxDet = 10, kMinDet = 3, kNDets = kMaxDet - kMinDet + 1, kMaxSub = 6, kNSubDets = kMaxSub + 1, + kLength = kNDets * kNSubDets; }; #endif diff --git a/Geometry/CaloGeometry/src/CaloGeometry.cc b/Geometry/CaloGeometry/src/CaloGeometry.cc index 66d652da3d6b1..ed24ab2aa3c32 100644 --- a/Geometry/CaloGeometry/src/CaloGeometry.cc +++ b/Geometry/CaloGeometry/src/CaloGeometry.cc @@ -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 - static_cast(kMinDet)) * kNSubDets + subdet); + return ((det - kMinDet) * kNSubDets + subdet); } void CaloGeometry::setSubdetGeometry(DetId::Detector det, int subdet, const CaloSubdetectorGeometry* geom) {