Skip to content

Commit

Permalink
[CPP20][DQM] Remove deprecated enum arithmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
iarspider committed Mar 20, 2024
1 parent 754f2b8 commit 48668c3
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 46 deletions.
2 changes: 1 addition & 1 deletion DQM/CTPPS/plugins/DiamondSampicCalibrationDQMSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void DiamondSampicCalibrationDQMSource::analyze(const edm::Event &event, const e
hitHistoTmpYAxis->GetBinCenter(startBin + i));

//All plots with Time
if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE) {
if (rechit.time() != static_cast<float>(TotemTimingRecHit::NO_T_AVAILABLE)) {
int db = (detIdToHw[detId] & 0xE0) >> 5;
int sampic = (detIdToHw[detId] & 0x10) >> 4;
int channel = (detIdToHw[detId] & 0x0F);
Expand Down
2 changes: 1 addition & 1 deletion DQM/CTPPS/plugins/DiamondSampicDQMSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ void DiamondSampicDQMSource::analyze(const edm::Event &event, const edm::EventSe
}

//All plots with Time
if (rechit.time() != TotemTimingRecHit::NO_T_AVAILABLE) {
if (rechit.time() != static_cast<float>(TotemTimingRecHit::NO_T_AVAILABLE)) {
for (int i = 0; i < numOfBins; ++i)
potPlots_[detId_pot].hitDistribution2dWithTime->Fill(detId.plane() + UFSDShift,
hitHistoTmpYAxis->GetBinCenter(startBin + i));
Expand Down
24 changes: 12 additions & 12 deletions DQM/CTPPS/plugins/TotemT2DQMSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -378,27 +378,27 @@ void TotemT2DQMSource::fillFlags(const TotemT2Digi& digi, const TotemT2DetId& de
const TotemT2DetId secId(detid.armId());
const TotemT2DetId planeId(detid.planeId());
if (digi.hasTE()) {
sectorPlots_[secId].eventFlags->Fill(t2TE + 0.0);
planePlots_[planeId].eventFlagsPl->Fill(t2TE + 0.0);
channelPlots_[detid].eventFlagsCh->Fill(t2TE + 0.0);
sectorPlots_[secId].eventFlags->Fill(static_cast<double>(t2TE));
planePlots_[planeId].eventFlagsPl->Fill(static_cast<double>(t2TE));
channelPlots_[detid].eventFlagsCh->Fill(static_cast<double>(t2TE));
}

if (digi.hasLE()) {
sectorPlots_[secId].eventFlags->Fill(t2LE + 0.0);
planePlots_[planeId].eventFlagsPl->Fill(t2LE + 0.0);
channelPlots_[detid].eventFlagsCh->Fill(t2LE + 0.0);
sectorPlots_[secId].eventFlags->Fill(static_cast<double>(t2LE));
planePlots_[planeId].eventFlagsPl->Fill(static_cast<double>(t2LE));
channelPlots_[detid].eventFlagsCh->Fill(static_cast<double>(t2LE));
}

if (digi.hasManyTE()) {
sectorPlots_[secId].eventFlags->Fill(t2MT + 0.0);
planePlots_[planeId].eventFlagsPl->Fill(t2MT + 0.0);
channelPlots_[detid].eventFlagsCh->Fill(t2MT + 0.0);
sectorPlots_[secId].eventFlags->Fill(static_cast<double>(t2MT));
planePlots_[planeId].eventFlagsPl->Fill(static_cast<double>(t2MT));
channelPlots_[detid].eventFlagsCh->Fill(static_cast<double>(t2MT));
}

if (digi.hasManyLE()) {
sectorPlots_[secId].eventFlags->Fill(t2ML + 0.0);
planePlots_[planeId].eventFlagsPl->Fill(t2ML + 0.0);
channelPlots_[detid].eventFlagsCh->Fill(t2ML + 0.0);
sectorPlots_[secId].eventFlags->Fill(static_cast<double>(t2ML));
planePlots_[planeId].eventFlagsPl->Fill(static_cast<double>(t2ML));
channelPlots_[detid].eventFlagsCh->Fill(static_cast<double>(t2ML));
}
}

Expand Down
5 changes: 3 additions & 2 deletions DQM/EcalCommon/interface/EcalDQMCommonUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ namespace ecaldqm {
kEBTCCLow = 36,
kEBTCCHigh = 71,

nChannels = EBDetId::kSizeForDenseIndexing + EEDetId::kSizeForDenseIndexing,
nTowers = EcalTrigTowerDetId::kEBTotalTowers + EcalScDetId::kSizeForDenseIndexing
nChannels = static_cast<int>(EBDetId::kSizeForDenseIndexing) + static_cast<int>(EEDetId::kSizeForDenseIndexing),
nTowers =
static_cast<int>(EcalTrigTowerDetId::kEBTotalTowers) + static_cast<int>(EcalScDetId::kSizeForDenseIndexing)
};

extern std::vector<unsigned> const memDCC;
Expand Down
9 changes: 5 additions & 4 deletions DQM/EcalCommon/src/MESetBinningUtils2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace ecaldqm {
break;
case kProjEta:
if (_zside == 0) {
specs.nbins = nEEEtaBins / (3. - etaBound) * 6.;
specs.nbins = static_cast<int>(nEEEtaBins) / (3. - etaBound) * 6.;
specs.low = -3.;
specs.high = 3.;
} else {
Expand Down Expand Up @@ -351,11 +351,12 @@ namespace ecaldqm {
specs.nbins = nEBEtaBins + 2 * nEEEtaBins;
specs.edges = std::vector(specs.nbins + 1, 0.f);
for (int i(0); i <= nEEEtaBins; i++)
specs.edges[i] = -3. + (3. - etaBound) / nEEEtaBins * i;
specs.edges[i] = -3. + (3. - etaBound) / static_cast<double>(nEEEtaBins) * i;
for (int i(1); i <= nEBEtaBins; i++)
specs.edges[i + nEEEtaBins] = -etaBound + 2. * etaBound / nEBEtaBins * i;
specs.edges[i + nEEEtaBins] = -etaBound + 2. * etaBound / static_cast<double>(nEBEtaBins) * i;
for (int i(1); i <= nEEEtaBins; i++)
specs.edges[i + nEEEtaBins + nEBEtaBins] = etaBound + (3. - etaBound) / nEEEtaBins * i;
specs.edges[i + nEEEtaBins + nEBEtaBins] =
etaBound + (3. - etaBound) / static_cast<double>(nEEEtaBins) * i;
specs.title = "eta";
break;
case kProjPhi:
Expand Down
18 changes: 9 additions & 9 deletions DQM/EcalMonitorClient/src/CalibrationSummaryClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ namespace ecaldqm {
if (status == kGood && sLaser) {
for (map<int, unsigned>::iterator wlItr(laserWlToME_.begin()); wlItr != laserWlToME_.end(); ++wlItr) {
sLaser->use(wlItr->second);
if (sLaser->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
if (sLaser->getBinContent(getEcalDQMSetupObjects(), id) == static_cast<double>(kBad)) {
status = kBad;
break;
}
Expand All @@ -166,7 +166,7 @@ namespace ecaldqm {
if (id.subdetId() == EcalEndcap) {
for (map<int, unsigned>::iterator wlItr(ledWlToME_.begin()); wlItr != ledWlToME_.end(); ++wlItr) {
sLed->use(wlItr->second);
if (sLed->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
if (sLed->getBinContent(getEcalDQMSetupObjects(), id) == static_cast<double>(kBad)) {
status = kBad;
break;
}
Expand All @@ -177,7 +177,7 @@ namespace ecaldqm {
if (status == kGood && sTestPulse) {
for (map<int, unsigned>::iterator gainItr(tpGainToME_.begin()); gainItr != tpGainToME_.end(); ++gainItr) {
sTestPulse->use(gainItr->second);
if (sTestPulse->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
if (sTestPulse->getBinContent(getEcalDQMSetupObjects(), id) == static_cast<double>(kBad)) {
status = kBad;
break;
}
Expand All @@ -187,7 +187,7 @@ namespace ecaldqm {
if (status == kGood && sPedestal) {
for (map<int, unsigned>::iterator gainItr(pedGainToME_.begin()); gainItr != pedGainToME_.end(); ++gainItr) {
sPedestal->use(gainItr->second);
if (sPedestal->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
if (sPedestal->getBinContent(getEcalDQMSetupObjects(), id) == static_cast<double>(kBad)) {
status = kBad;
break;
}
Expand All @@ -211,13 +211,13 @@ namespace ecaldqm {

int status(kGood);

if (sPNIntegrity.getBinContent(getEcalDQMSetupObjects(), id) == kBad)
if (sPNIntegrity.getBinContent(getEcalDQMSetupObjects(), id) == static_cast<double>(kBad))
status = kBad;

if (status == kGood && sLaserPN) {
for (map<int, unsigned>::iterator wlItr(laserWlToME_.begin()); wlItr != laserWlToME_.end(); ++wlItr) {
sLaserPN->use(wlItr->second);
if (sLaserPN->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
if (sLaserPN->getBinContent(getEcalDQMSetupObjects(), id) == static_cast<double>(kBad)) {
status = kBad;
break;
}
Expand All @@ -227,7 +227,7 @@ namespace ecaldqm {
if (status == kGood && sLedPN) {
for (map<int, unsigned>::iterator wlItr(ledWlToME_.begin()); wlItr != ledWlToME_.end(); ++wlItr) {
sLedPN->use(wlItr->second);
if (sLedPN->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
if (sLedPN->getBinContent(getEcalDQMSetupObjects(), id) == static_cast<double>(kBad)) {
status = kBad;
break;
}
Expand All @@ -237,7 +237,7 @@ namespace ecaldqm {
if (status == kGood && sTestPulsePN) {
for (map<int, unsigned>::iterator gainItr(tpPNGainToME_.begin()); gainItr != tpPNGainToME_.end(); ++gainItr) {
sTestPulsePN->use(gainItr->second);
if (sTestPulsePN->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
if (sTestPulsePN->getBinContent(getEcalDQMSetupObjects(), id) == static_cast<double>(kBad)) {
status = kBad;
break;
}
Expand All @@ -248,7 +248,7 @@ namespace ecaldqm {
for (map<int, unsigned>::iterator gainItr(pedPNGainToME_.begin()); gainItr != pedPNGainToME_.end();
++gainItr) {
sPedestalPN->use(gainItr->second);
if (sPedestalPN->getBinContent(getEcalDQMSetupObjects(), id) == kBad) {
if (sPedestalPN->getBinContent(getEcalDQMSetupObjects(), id) == static_cast<double>(kBad)) {
status = kBad;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion DQM/EcalMonitorClient/src/CertificationClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace ecaldqm {
meanValue += certValue * nCrystals(iDCC + 1);
}

meCertification.fill(getEcalDQMSetupObjects(), meanValue / nChannels);
meCertification.fill(getEcalDQMSetupObjects(), meanValue / static_cast<double>(nChannels));
}

DEFINE_ECALDQM_WORKER(CertificationClient);
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 @@ -111,7 +111,7 @@ namespace ecaldqm {
float chStatus(sChStatus.getBinContent(getEcalDQMSetupObjects(), id));
if (entriesLS < minChannelEntries_)
continue;
if (chStatus != EcalChannelStatusCode::kOk)
if (chStatus != static_cast<float>(EcalChannelStatusCode::kOk))
continue; // exclude problematic channels

// Get max/min
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 @@ -146,7 +146,7 @@ namespace ecaldqm {

if (entriesLS < minChannelEntries)
continue;
if (chStatus != EcalChannelStatusCode::kOk)
if (chStatus != static_cast<float>(EcalChannelStatusCode::kOk))
continue; // exclude problematic channels

// Keep running count of timing mean, rms, and N_hits
Expand Down
2 changes: 1 addition & 1 deletion DQM/EcalMonitorTasks/interface/SelectiveReadoutTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace ecaldqm {
enum Constants {
nFIRTaps = 6,
bytesPerCrystal = 24,
nRU = EcalTrigTowerDetId::kEBTotalTowers + EcalScDetId::kSizeForDenseIndexing
nRU = static_cast<int>(EcalTrigTowerDetId::kEBTotalTowers) + static_cast<int>(EcalScDetId::kSizeForDenseIndexing)
};

private:
Expand Down
6 changes: 4 additions & 2 deletions DQM/EcalMonitorTasks/src/SelectiveReadoutTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ namespace ecaldqm {
}

if (isEB) {
meHighIntPayload.fill(getEcalDQMSetupObjects(), EcalBarrel, nHighInt[0] * bytesPerCrystal / 1024. / nEBDCC);
meLowIntPayload.fill(getEcalDQMSetupObjects(), EcalBarrel, nLowInt[0] * bytesPerCrystal / 1024. / nEBDCC);
meHighIntPayload.fill(
getEcalDQMSetupObjects(), EcalBarrel, nHighInt[0] * bytesPerCrystal / 1024. / static_cast<double>(nEBDCC));
meLowIntPayload.fill(
getEcalDQMSetupObjects(), EcalBarrel, nLowInt[0] * bytesPerCrystal / 1024. / static_cast<double>(nEBDCC));
} else {
meHighIntPayload.fill(
getEcalDQMSetupObjects(), -EcalEndcap, nHighInt[0] * bytesPerCrystal / 1024. / (nEEDCC / 2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ void SiPixelPhase1RawDataErrorComparator::bookHistograms(DQMStore::IBooker& iBoo
-0.5,
nErrors - 0.5,
nFEDs,
FEDNumbering::MINSiPixeluTCAFEDID - 0.5,
FEDNumbering::MAXSiPixeluTCAFEDID - 0.5);
static_cast<double>(FEDNumbering::MINSiPixeluTCAFEDID) - 0.5,
static_cast<double>(FEDNumbering::MAXSiPixeluTCAFEDID) - 0.5);
for (int j = 0; j < nErrors; j++) {
const auto& errorCode = static_cast<SiPixelFEDErrorCodes>(j + k_FED25);
h_FEDerrorVsFEDIdUnbalance_->setBinLabel(j + 1, errorCodeToTypeMap.at(errorCode));
Expand Down
7 changes: 5 additions & 2 deletions DQMOffline/Alignment/src/TkAlCaRecoMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ void TkAlCaRecoMonitor::bookHistograms(DQMStore::IBooker &iBooker, edm::Run cons
TrackPtNegative_->setAxisTitle("p_{T} of tracks charge < 0");

histname = "TrackQuality_";
TrackQuality_ = iBooker.book1D(
histname + AlgoName, histname + AlgoName, reco::TrackBase::qualitySize, -0.5, reco::TrackBase::qualitySize - 0.5);
TrackQuality_ = iBooker.book1D(histname + AlgoName,
histname + AlgoName,
reco::TrackBase::qualitySize,
-0.5,
static_cast<double>(reco::TrackBase::qualitySize) - 0.5);
TrackQuality_->setAxisTitle("quality");
for (int i = 0; i < reco::TrackBase::qualitySize; ++i) {
TrackQuality_->getTH1()->GetXaxis()->SetBinLabel(
Expand Down
2 changes: 1 addition & 1 deletion Validation/MuonCSCDigis/src/CSCStubMatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ GlobalPoint CSCStubMatcher::getGlobalPosition(unsigned int rawId, const CSCCorre
int ring = 1; // Default to ME1/b
if (lct.getStrip() > CSCConstants::MAX_HALF_STRIP_ME1B) {
ring = 4; // Change to ME1/a if the HalfStrip Number exceeds the range of ME1/b
fractional_strip -= CSCConstants::NUM_STRIPS_ME1B;
fractional_strip -= static_cast<float>(CSCConstants::NUM_STRIPS_ME1B);
}
CSCDetId cscId_(cscId.endcap(), cscId.station(), ring, cscId.chamber(), cscId.layer());
cscId = cscId_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,16 @@ void ElectronConversionRejectionValidator::bookHistograms(DQMStore::IBooker& ibo

h_convLog10TrailTrackpt_ = ibooker.book1D("convLog10TrailTrackpt", "# of Electrons", ptBin, -2.0, 3.0);

h_convLeadTrackAlgo_ = ibooker.book1D(
"convLeadTrackAlgo", "# of Electrons", reco::TrackBase::algoSize, -0.5, reco::TrackBase::algoSize - 0.5);
h_convTrailTrackAlgo_ = ibooker.book1D(
"convLeadTrackAlgo", "# of Electrons", reco::TrackBase::algoSize, -0.5, reco::TrackBase::algoSize - 0.5);
h_convLeadTrackAlgo_ = ibooker.book1D("convLeadTrackAlgo",
"# of Electrons",
reco::TrackBase::algoSize,
-0.5,
static_cast<double>(reco::TrackBase::algoSize) - 0.5);
h_convTrailTrackAlgo_ = ibooker.book1D("convLeadTrackAlgo",
"# of Electrons",
reco::TrackBase::algoSize,
-0.5,
static_cast<double>(reco::TrackBase::algoSize) - 0.5);
}

void ElectronConversionRejectionValidator::analyze(const edm::Event& e, const edm::EventSetup&) {
Expand Down
7 changes: 5 additions & 2 deletions Validation/RecoEgamma/plugins/PhotonValidator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3126,8 +3126,11 @@ void PhotonValidator::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&
h_trkProv_[0] = iBooker.book1D("allTrkProv", " Track pair provenance ", 4, 0., 4.);
h_trkProv_[1] = iBooker.book1D("assTrkProv", " Track pair provenance ", 4, 0., 4.);
//
h_trkAlgo_ =
iBooker.book1D("allTrackAlgo", " Track Algo ", reco::TrackBase::algoSize, -0.5, reco::TrackBase::algoSize - 0.5);
h_trkAlgo_ = iBooker.book1D("allTrackAlgo",
" Track Algo ",
reco::TrackBase::algoSize,
-0.5,
static_cast<double>(reco::TrackBase::algoSize) - 0.5);
h_convAlgo_ = iBooker.book1D("allConvAlgo", " Conv Algo ", 5, -0.5, 4.5);
h_convQuality_ = iBooker.book1D("allConvQuality", "Conv quality ", 11, -0.5, 11.);

Expand Down

0 comments on commit 48668c3

Please sign in to comment.