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

[CPP20][DQM] Replace some enums with constexpr ints #44515

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
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
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));
iarspider marked this conversation as resolved.
Show resolved Hide resolved
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