Skip to content

Commit

Permalink
Merge pull request #44515 from iarspider/cpp20-no-enum-arithmetics-dq…
Browse files Browse the repository at this point in the history
…m-v2

[CPP20][DQM] Replace some enums with constexpr ints
  • Loading branch information
cmsbuild authored Apr 2, 2024
2 parents 5a1a2f7 + d7fe83e commit 0eb47f7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 30 deletions.
2 changes: 1 addition & 1 deletion DQM/CTPPS/plugins/TotemT2DQMSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class TotemT2DQMSource : public DQMEDAnalyzer {
static constexpr double T2_BIN_WIDTH_NS_ = 25. / 4;
MonitorElement* totemT2ErrorFlags_2D_ = nullptr;

enum evFlag { t2TE = 0, t2LE, t2MT, t2ML };
static constexpr int t2TE = 0, t2LE = 1, t2MT = 2, t2ML = 3;

const unsigned int nbinsx_, nbinsy_;
const unsigned int windowsNum_;
Expand Down
22 changes: 7 additions & 15 deletions DQM/EcalCommon/interface/MESetBinningUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,13 @@ namespace ecaldqm {
nBinType
};

enum Constants {
nPresetBinnings = kRCT + 1,

nEBSMEta = 85,
nEBSMPhi = 20,
nEESMX = 40,
nEESMXRed = 30, // for EE+-01&05&09
nEESMXExt = 45, // for EE+-02&08
nEESMY = 40,
nEESMYRed = 35, // for EE+-03&07

nEBEtaBins = 34,
nEEEtaBins = 20,
nPhiBins = 36
};
typedef int Constants;
static constexpr int nPresetBinnings = kRCT + 1, nEBSMEta = 85, nEBSMPhi = 20, nEESMX = 40;
static constexpr int nEESMXRed = 30; // for EE+-01&05&09
static constexpr int nEESMXExt = 45; //for EE+-02&08
static constexpr int nEESMY = 40;
static constexpr int nEESMYRed = 35; // for EE+-03&07
static constexpr int nEBEtaBins = 34, nEEEtaBins = 20, nPhiBins = 36;

struct AxisSpecs {
int nbins;
Expand Down
2 changes: 1 addition & 1 deletion DQM/EcalMonitorClient/src/PresampleClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace ecaldqm {

// Fill Presample Trend plots:
// Use PedestalByLS which only contains digis from "current" LS
float chStatus(sChStatus.getBinContent(getEcalDQMSetupObjects(), id));
int chStatus = static_cast<int>(sChStatus.getBinContent(getEcalDQMSetupObjects(), id));
if (entriesLS < minChannelEntries_)
continue;
if (chStatus != EcalChannelStatusCode::kOk)
Expand Down
2 changes: 1 addition & 1 deletion DQM/EcalMonitorClient/src/TimingClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace ecaldqm {
float entriesLS(tLSItr->getBinEntries());
float meanLS(tLSItr->getBinContent());
float rmsLS(tLSItr->getBinError() * sqrt(entriesLS));
float chStatus(sChStatus.getBinContent(getEcalDQMSetupObjects(), id));
int chStatus = static_cast<int>(sChStatus.getBinContent(getEcalDQMSetupObjects(), id));

if (entriesLS < minChannelEntries)
continue;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/CTPPSReco/interface/TotemTimingRecHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class TotemTimingRecHit : public CTPPSTimingRecHit {
public:
enum TimingAlgorithm { NOT_SET, CFD, SMART, SIMPLE };
enum { NO_T_AVAILABLE = -100 };
static constexpr int NO_T_AVAILABLE = -100;

TotemTimingRecHit()
: CTPPSTimingRecHit(), sampicThresholdTime_(0), tPrecision_(0), amplitude_(0), baselineRMS_(0), mode_(NOT_SET) {}
Expand Down
16 changes: 5 additions & 11 deletions DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,11 @@ class EcalTrigTowerDetId : public DetId {
static const int SUBDETIJMODE = 0;
static const int SUBDETDCCTTMODE = 1;

enum {
kEETowersInPhiPerEndcap = 4 * kEETowersInPhiPerQuadrant,
kEEOuterEta = 18,
kEEInnerEta = 28,
kEETowersInEta = (kEEInnerEta - kEEOuterEta + 1),
kEBHalfTowers = kEBTowersPerSM * 18,
kEBTotalTowers = kEBHalfTowers * 2,
kEETowersPerEndcap = kEETowersInEta * kEETowersInPhiPerEndcap - 72,
kEETotalTowers = kEETowersPerEndcap * 2,
kSizeForDenseIndexing = kEBTotalTowers + kEETotalTowers
};
static constexpr int kEETowersInPhiPerEndcap = 4 * kEETowersInPhiPerQuadrant, kEEOuterEta = 18, kEEInnerEta = 28,
kEETowersInEta = (kEEInnerEta - kEEOuterEta + 1), kEBHalfTowers = kEBTowersPerSM * 18,
kEBTotalTowers = kEBHalfTowers * 2,
kEETowersPerEndcap = kEETowersInEta * kEETowersInPhiPerEndcap - 72,
kEETotalTowers = kEETowersPerEndcap * 2, kSizeForDenseIndexing = kEBTotalTowers + kEETotalTowers;
};

std::ostream& operator<<(std::ostream&, const EcalTrigTowerDetId& id);
Expand Down

0 comments on commit 0eb47f7

Please sign in to comment.