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

[DQM] Apply code checks/format #47002

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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/GEM/plugins/GEMRecHitSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void GEMRecHitSource::analyze(edm::Event const& event, edm::EventSetup const& ev
for (auto [key, num_total_rechit] : total_rechit_iEta) {
mapTotalRecHitPerEvtIEta_.Fill(key, num_total_rechit);
}
for (auto [key, mapSub] : mapCLSOver5) {
for (const auto& [key, mapSub] : mapCLSOver5) {
for (auto [chamber, b] : mapSub) {
mapCLSOver5_.Fill(key4Tokey3(key), chamber, keyToIEta(key));
}
Expand Down
2 changes: 1 addition & 1 deletion DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSet
}

auto caloCICADAScores = iEvent.get(caloLayer1CICADAScoreToken_);
auto gtCICADAScores = iEvent.get(gtCICADAScoreToken_);
const auto& gtCICADAScores = iEvent.get(gtCICADAScoreToken_);
auto simCICADAScores = iEvent.get(simCICADAScoreToken_);

if (caloCICADAScores.size() > 0) {
Expand Down
2 changes: 1 addition & 1 deletion DQM/SiStripMonitorClient/plugins/SiStripOfflineDQM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ SiStripOfflineDQM::SiStripOfflineDQM(edm::ParameterSet const& pSet)
auto token = useSSQ ? QualityToken{esConsumes<edm::Transition::EndRun>(
edm::ESInputTag{"", tkMapPSet.getUntrackedParameter<std::string>("ssqLabel", "")})}
: QualityToken{};
tkMapOptions_.emplace_back(map_type, std::move(tkMapPSet), useSSQ, std::move(token));
tkMapOptions_.emplace_back(map_type, std::move(tkMapPSet), useSSQ, token);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might be related to llvm/llvm-project#86404 . This might be fixed in llvm 19 , so I can try to update llvm 19 for clang IBs. For now I can revert this change and suppress the clang-tidy warning by adding //NOLINT for this line

}
}

Expand Down
36 changes: 18 additions & 18 deletions DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,22 +183,22 @@ namespace sistrip {
CountersPtr inputL1ACounters = getCounters(event, l1aCountersTag_);
CountersPtr inputAPVAddresses = getCounters(event, apvAddressesTag_, false);
const edm::DetSetVector<SiStripRawDigi>* inputScopeDigis =
getProduct<edm::DetSetVector<SiStripRawDigi> >(event, scopeDigisTag_);
getProduct<edm::DetSetVector<SiStripRawDigi>>(event, scopeDigisTag_);
const edm::DetSetVector<SiStripRawDigi>* inputPayloadDigis =
getProduct<edm::DetSetVector<SiStripRawDigi> >(event, payloadDigisTag_);
getProduct<edm::DetSetVector<SiStripRawDigi>>(event, payloadDigisTag_);
const edm::DetSetVector<SiStripRawDigi>* inputReorderedDigis =
getProduct<edm::DetSetVector<SiStripRawDigi> >(event, reorderedDigisTag_);
getProduct<edm::DetSetVector<SiStripRawDigi>>(event, reorderedDigisTag_);
const edm::DetSetVector<SiStripRawDigi>* inputVirginRawDigis =
getProduct<edm::DetSetVector<SiStripRawDigi> >(event, virginRawDigisTag_);
getProduct<edm::DetSetVector<SiStripRawDigi>>(event, virginRawDigisTag_);
//construct the output vectors if the digis were found and they do not exist
if (inputScopeDigis && !mo.outputScopeDigisVector_.get())
mo.outputScopeDigisVector_.reset(new std::vector<edm::DetSet<SiStripRawDigi> >);
mo.outputScopeDigisVector_ = std::make_shared<std::vector<edm::DetSet<SiStripRawDigi>>>();
if (inputPayloadDigis && !mo.outputPayloadDigisVector_.get())
mo.outputPayloadDigisVector_.reset(new std::vector<edm::DetSet<SiStripRawDigi> >);
mo.outputPayloadDigisVector_ = std::make_shared<std::vector<edm::DetSet<SiStripRawDigi>>>();
if (inputReorderedDigis && !mo.outputReorderedDigisVector_.get())
mo.outputReorderedDigisVector_.reset(new std::vector<edm::DetSet<SiStripRawDigi> >);
mo.outputReorderedDigisVector_ = std::make_shared<std::vector<edm::DetSet<SiStripRawDigi>>>();
if (inputVirginRawDigis && !mo.outputVirginRawDigisVector_.get())
mo.outputVirginRawDigisVector_.reset(new std::vector<edm::DetSet<SiStripRawDigi> >);
mo.outputVirginRawDigisVector_ = std::make_shared<std::vector<edm::DetSet<SiStripRawDigi>>>();
//find matching FEDs
std::set<uint16_t> matchingFeds;
findMatchingFeds(eventId, apvAddress, inputTotalEventCounters, inputL1ACounters, inputAPVAddresses, matchingFeds);
Expand Down Expand Up @@ -309,10 +309,10 @@ namespace sistrip {
std::vector<uint32_t>& outputTotalEventCounters,
std::vector<uint32_t>& outputL1ACounters,
std::vector<uint32_t>& outputAPVAddresses,
std::vector<edm::DetSet<SiStripRawDigi> >* outputScopeDigisVector,
std::vector<edm::DetSet<SiStripRawDigi> >* outputPayloadDigisVector,
std::vector<edm::DetSet<SiStripRawDigi> >* outputReorderedDigisVector,
std::vector<edm::DetSet<SiStripRawDigi> >* outputVirginRawDigisVector,
std::vector<edm::DetSet<SiStripRawDigi>>* outputScopeDigisVector,
std::vector<edm::DetSet<SiStripRawDigi>>* outputPayloadDigisVector,
std::vector<edm::DetSet<SiStripRawDigi>>* outputReorderedDigisVector,
std::vector<edm::DetSet<SiStripRawDigi>>* outputVirginRawDigisVector,
const SiStripFedCabling& cabling) {
//reserve space in vectors
if (inputScopeDigis) {
Expand Down Expand Up @@ -391,12 +391,12 @@ namespace sistrip {
SpyEventMatcher::CountersPtr SpyEventMatcher::getCounters(const edm::EventPrincipal& event,
const edm::InputTag& tag,
const bool mapKeyIsByFedID) {
const std::vector<uint32_t>* vectorFromEvent = getProduct<std::vector<uint32_t> >(event, tag);
const std::vector<uint32_t>* vectorFromEvent = getProduct<std::vector<uint32_t>>(event, tag);
if (vectorFromEvent) {
//vector is from event so, will be deleted when the event is destroyed (and not before)
return std::make_shared<CountersWrapper>(vectorFromEvent);
} else {
const std::map<uint32_t, uint32_t>* mapFromEvent = getProduct<std::map<uint32_t, uint32_t> >(event, tag);
const std::map<uint32_t, uint32_t>* mapFromEvent = getProduct<std::map<uint32_t, uint32_t>>(event, tag);
if (mapFromEvent) {
std::vector<uint32_t>* newVector = new std::vector<uint32_t>(FED_ID_MAX + 1, 0);
if (mapKeyIsByFedID) {
Expand Down Expand Up @@ -428,10 +428,10 @@ namespace sistrip {
std::vector<uint32_t>& theTotalEventCounters,
std::vector<uint32_t>& theL1ACounters,
std::vector<uint32_t>& theAPVAddresses,
std::vector<edm::DetSet<SiStripRawDigi> >* theScopeDigisVector,
std::vector<edm::DetSet<SiStripRawDigi> >* thePayloadDigisVector,
std::vector<edm::DetSet<SiStripRawDigi> >* theReorderedDigisVector,
std::vector<edm::DetSet<SiStripRawDigi> >* theVirginRawDigisVector)
std::vector<edm::DetSet<SiStripRawDigi>>* theScopeDigisVector,
std::vector<edm::DetSet<SiStripRawDigi>>* thePayloadDigisVector,
std::vector<edm::DetSet<SiStripRawDigi>>* theReorderedDigisVector,
std::vector<edm::DetSet<SiStripRawDigi>>* theVirginRawDigisVector)
: rawData(new FEDRawDataCollection),
totalEventCounters(new std::vector<uint32_t>),
l1aCounters(new std::vector<uint32_t>),
Expand Down
6 changes: 3 additions & 3 deletions DQM/TrackerRemapper/bin/printPixelROCsMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ int main(int argc, char* argv[]) {
// Draw and save the map
TCanvas canvas("Summary", "Summary", 1200, k_height[static_cast<int>(region)]);
if (region == Region::Full) {
theMap.drawMaps(canvas, title.c_str());
theMap.drawMaps(canvas, title);
} else if (region == Region::Barrel) {
theMap.drawBarrelMaps(canvas, title.c_str());
theMap.drawBarrelMaps(canvas, title);
} else if (region == Region::Forward) {
theMap.drawForwardMaps(canvas, title.c_str());
theMap.drawForwardMaps(canvas, title);
}

// Construct the filename string based on the region
Expand Down
2 changes: 1 addition & 1 deletion DQM/TrackerRemapper/src/Phase1PixelMaps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ const indexedCorners Phase1PixelMaps::retrieveCorners(const std::vector<edm::Fil
indexedCorners theOutMap;

for (const auto& file : cornerFiles) {
auto cornerFileName = file.fullPath();
const auto& cornerFileName = file.fullPath();
std::ifstream cornerFile(cornerFileName.c_str());
if (!cornerFile.good()) {
throw cms::Exception("FileError") << "Problem opening corner file: " << cornerFileName;
Expand Down
2 changes: 1 addition & 1 deletion DQM/TrackerRemapper/src/Phase1PixelSummaryMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void Phase1PixelSummaryMap::setZAxisRange(const double min, const double max) {
//============================================================================
void Phase1PixelSummaryMap::addNamedBins(
edm::FileInPath geoFile, int tX, int tY, int sX, int sY, bool applyModuleRotation) {
auto cornerFileName = geoFile.fullPath();
const auto& cornerFileName = geoFile.fullPath();
std::ifstream cornerFile(cornerFileName.c_str());
if (!cornerFile.good()) {
throw cms::Exception("FileError") << "Problem opening corner file: " << cornerFileName;
Expand Down
42 changes: 22 additions & 20 deletions DQMOffline/ParticleFlow/plugins/PFAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ PFAnalyzer::PFAnalyzer(const edm::ParameterSet& pSet) {
//
for (unsigned int i = 0; i < m_cutList.size(); i++) {
m_fullCutList.push_back(std::vector<std::string>());
while (m_cutList[i].find("]") != std::string::npos) {
size_t pos = m_cutList[i].find("]");
while (m_cutList[i].find(']') != std::string::npos) {
size_t pos = m_cutList[i].find(']');
m_fullCutList[i].push_back(m_cutList[i].substr(1, pos));
m_cutList[i].erase(0, pos + 1);
}
Expand All @@ -108,7 +108,7 @@ PFAnalyzer::PFAnalyzer(const edm::ParameterSet& pSet) {
for (unsigned int i = 0; i < m_fullCutList.size(); i++) {
m_binList.push_back(std::vector<std::vector<double>>());
for (unsigned int j = 0; j < m_fullCutList[i].size(); j++) {
size_t pos = m_fullCutList[i][j].find(";");
size_t pos = m_fullCutList[i][j].find(';');
std::string observableName = m_fullCutList[i][j].substr(0, pos);
m_fullCutList[i][j].erase(0, pos + 1);

Expand All @@ -125,8 +125,8 @@ PFAnalyzer::PFAnalyzer(const edm::ParameterSet& pSet) {
//
for (unsigned int i = 0; i < m_jetCutList.size(); i++) {
m_fullJetCutList.push_back(std::vector<std::string>());
while (m_jetCutList[i].find("]") != std::string::npos) {
size_t pos = m_jetCutList[i].find("]");
while (m_jetCutList[i].find(']') != std::string::npos) {
size_t pos = m_jetCutList[i].find(']');
m_fullJetCutList[i].push_back(m_jetCutList[i].substr(1, pos));
m_jetCutList[i].erase(0, pos + 1);
}
Expand All @@ -135,7 +135,7 @@ PFAnalyzer::PFAnalyzer(const edm::ParameterSet& pSet) {
for (unsigned int i = 0; i < m_fullJetCutList.size(); i++) {
m_jetBinList.push_back(std::vector<std::vector<double>>());
for (unsigned int j = 0; j < m_fullJetCutList[i].size(); j++) {
size_t pos = m_fullJetCutList[i][j].find(";");
size_t pos = m_fullJetCutList[i][j].find(';');
std::string observableName = m_fullJetCutList[i][j].substr(0, pos);
m_fullJetCutList[i][j].erase(0, pos + 1);

Expand Down Expand Up @@ -219,31 +219,31 @@ void PFAnalyzer::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun
// Do the same for global observables (things like the number of PFCs in an event, or in a jet, etc)
for (unsigned int i = 0; i < m_eventObservables.size(); i++) {
std::string cEventObservable = m_eventObservables[i];
size_t pos = cEventObservable.find(";");
size_t pos = cEventObservable.find(';');
std::string observableName = cEventObservable.substr(0, pos);
cEventObservable.erase(0, pos + 1);

pos = cEventObservable.find(";");
pos = cEventObservable.find(';');
std::string axisString = cEventObservable.substr(0, pos);
cEventObservable.erase(0, pos + 1);

pos = cEventObservable.find(";");
pos = cEventObservable.find(';');
int nBins = atoi(cEventObservable.substr(0, pos).c_str());
cEventObservable.erase(0, pos + 1);

pos = cEventObservable.find(";");
pos = cEventObservable.find(';');
float binMin = atof(cEventObservable.substr(0, pos).c_str());
cEventObservable.erase(0, pos + 1);

pos = cEventObservable.find(";");
pos = cEventObservable.find(';');
float binMax = atof(cEventObservable.substr(0, pos).c_str());
cEventObservable.erase(0, pos + 1);

pos = cEventObservable.find(";");
pos = cEventObservable.find(';');
int nBinsJet = atoi(cEventObservable.substr(0, pos).c_str());
cEventObservable.erase(0, pos + 1);

pos = cEventObservable.find(";");
pos = cEventObservable.find(';');
float binMinJet = atof(cEventObservable.substr(0, pos).c_str());
cEventObservable.erase(0, pos + 1);

Expand Down Expand Up @@ -333,20 +333,20 @@ void PFAnalyzer::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun
PFAnalyzer::binInfo PFAnalyzer::getBinInfo(std::string observableString) {
PFAnalyzer::binInfo binningDetails;

size_t pos = observableString.find(";");
size_t pos = observableString.find(';');
binningDetails.observable = observableString.substr(0, pos);
observableString.erase(0, pos + 1);

std::vector<double> binList = getBinList(observableString);
pos = observableString.find(";");
pos = observableString.find(';');
binningDetails.axisName = observableString.substr(0, pos);
observableString.erase(0, pos + 1);

pos = observableString.find(";");
pos = observableString.find(';');
binningDetails.nBins = atoi(observableString.substr(0, pos).c_str());
observableString.erase(0, pos + 1);

pos = observableString.find(";");
pos = observableString.find(';');
binningDetails.binMin = atof(observableString.substr(0, pos).c_str());
observableString.erase(0, pos + 1);

Expand Down Expand Up @@ -399,8 +399,8 @@ std::string PFAnalyzer::stringWithDecimals(int bin, std::vector<double> bins) {
std::vector<double> PFAnalyzer::getBinList(std::string binString) {
std::vector<double> binList;

while (binString.find(";") != std::string::npos) {
size_t pos = binString.find(";");
while (binString.find(';') != std::string::npos) {
size_t pos = binString.find(';');
binList.push_back(atof(binString.substr(0, pos).c_str()));
binString.erase(0, pos + 1);
}
Expand Down Expand Up @@ -431,6 +431,7 @@ std::vector<std::string> PFAnalyzer::getAllSuffixes(std::vector<std::string> obs

std::vector<std::vector<int>> binList;

binList.reserve(nTotalBins);
for (int i = 0; i < nTotalBins; i++) {
binList.push_back(std::vector<int>());
}
Expand All @@ -451,6 +452,7 @@ std::vector<std::string> PFAnalyzer::getAllSuffixes(std::vector<std::string> obs
}

std::vector<std::string> allSuffixes;
allSuffixes.reserve(nTotalBins);
for (int i = 0; i < nTotalBins; i++) {
allSuffixes.push_back(getSuffix(binList[i], observables, binnings));
}
Expand Down Expand Up @@ -702,7 +704,7 @@ void PFAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup

std::vector<reco::PFCandidatePtr> pfConstits = cjet->getPFConstituents();

for (auto recoPF : pfConstits) {
for (const auto& recoPF : pfConstits) {
for (unsigned int j = 0; j < m_fullCutList.size(); j++) {
int binNumber = getPFBin(*recoPF, j);
if (binNumber < 0)
Expand Down
2 changes: 1 addition & 1 deletion DQMOffline/Trigger/plugins/ZGammaplusJetsMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void ZGammaplusJetsMonitor::analyze(edm::Event const& iEvent, edm::EventSetup co
if (!aodTriggerEvent.isValid())
return;

edm::TriggerNames triggerNames_ = iEvent.triggerNames(*triggerResults); // all trigger names available
const edm::TriggerNames& triggerNames_ = iEvent.triggerNames(*triggerResults); // all trigger names available

bool passTrig = false;

Expand Down
8 changes: 4 additions & 4 deletions DQMOffline/Trigger/src/HLTTauDQMPath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace {
for (auto iLabel = moduleLabels.begin(); iLabel != moduleLabels.end(); ++iLabel) {
if (HLTCP.moduleEDMType(*iLabel) != "EDFilter")
continue;
const std::string type = HLTCP.moduleType(*iLabel);
const std::string& type = HLTCP.moduleType(*iLabel);
LogTrace("HLTTauDQMOffline") << " " << std::distance(moduleLabels.begin(), iLabel) << " " << *iLabel << " "
<< type << " saveTags " << HLTCP.saveTags(*iLabel);
if (type.find("Selector") != std::string::npos)
Expand Down Expand Up @@ -99,7 +99,7 @@ namespace {
}

bool isL3TauProducer(const HLTConfigProvider& HLTCP, const std::string& producerLabel) const {
const std::string type = HLTCP.moduleType(producerLabel);
const std::string& type = HLTCP.moduleType(producerLabel);
if (type == "PFRecoTauProducer" || type == "RecoTauPiZeroUnembedder" ||
type == "BTagProbabilityToDiscriminator") {
LogDebug("HLTTauDQMOffline") << "Found tau producer " << type << " with label " << producerLabel
Expand All @@ -110,7 +110,7 @@ namespace {
}

bool isL3ElectronProducer(const HLTConfigProvider& HLTCP, const std::string& producerLabel) const {
const std::string type = HLTCP.moduleType(producerLabel);
const std::string& type = HLTCP.moduleType(producerLabel);
if (type == "EgammaHLTPixelMatchElectronProducers") {
LogDebug("HLTTauDQMOffline") << "Found electron producer " << type << " with label " << producerLabel
<< " from path " << name_;
Expand All @@ -120,7 +120,7 @@ namespace {
}

bool isL3MuonProducer(const HLTConfigProvider& HLTCP, const std::string& producerLabel) const {
const std::string type = HLTCP.moduleType(producerLabel);
const std::string& type = HLTCP.moduleType(producerLabel);
if (type == "L3MuonCandidateProducer" || type == "L3MuonCombinedRelativeIsolationProducer") {
LogDebug("HLTTauDQMOffline") << "Found muon producer " << type << " with label " << producerLabel
<< " from path " << name_;
Expand Down
2 changes: 1 addition & 1 deletion DQMOffline/Trigger/src/HLTTauDQMPathPlotter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults,
int firstMatchedMETFilter = -1;
if (hCounter_) {
hCounter_->Fill(0.5);
if (refCollection.taus.size() > 0) {
if (!refCollection.taus.empty()) {
hCounter_->Fill(1.5);
if (hltPath_.fired(triggerResults))
hCounter_->Fill(2.5);
Expand Down
2 changes: 1 addition & 1 deletion DQMServices/Core/src/DQMStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ namespace dqm::implementation {
}
std::vector<std::string> out;
for (const auto& dir : subdirs) {
if (dir.length() == 0)
if (dir.empty())
continue;
out.push_back(this->cwd_ + dir);
}
Expand Down
7 changes: 4 additions & 3 deletions DQMServices/StreamerIO/plugins/DQMStreamerReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
#include "FWCore/Utilities/interface/UnixSignalHandlers.h"
#include "IOPool/Streamer/interface/DumpTools.h"

#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <memory>
#include <queue>
#include <algorithm>
#include <cctype>

namespace dqmservices {
using namespace edm::streamer;
Expand Down Expand Up @@ -114,7 +115,7 @@ namespace dqmservices {
std::vector<std::string> tnames;
header->hltTriggerNames(tnames);

triggerSelector_.reset(new TriggerSelector(hltSel_, tnames));
triggerSelector_ = std::make_shared<TriggerSelector>(hltSel_, tnames);

// check if any trigger path name requested matches with trigger name in the header file
setMatchTriggerSel(tnames);
Expand Down
5 changes: 3 additions & 2 deletions DQMServices/StreamerIO/plugins/TriggerSelector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
#include <algorithm>

#include <boost/regex.hpp>
#include <memory>

namespace dqmservices {

// compatibility constructor

TriggerSelector::TriggerSelector(Strings const& pathspecs, Strings const& triggernames) : useOld_(true) {
acceptAll_ = false;
eventSelector_.reset(new edm::EventSelector(pathspecs, triggernames));
eventSelector_ = std::make_shared<edm::EventSelector>(pathspecs, triggernames);
}

TriggerSelector::TriggerSelector(std::string const& expression, Strings const& triggernames) : useOld_(false) {
Expand Down Expand Up @@ -47,7 +48,7 @@ namespace dqmservices {
}

// build decision tree
masterElement_.reset(new TreeElement(expression_, triggernames));
masterElement_ = std::make_shared<TreeElement>(expression_, triggernames);
}

bool TriggerSelector::acceptEvent(edm::TriggerResults const& tr) const {
Expand Down
2 changes: 1 addition & 1 deletion HLTriggerOffline/Egamma/src/EmDQM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ void EmDQM::dqmEndRun(edm::Run const &iRun, edm::EventSetup const &iSetup) {

// returns count of non-overlapping occurrences of 'sub' in 'str'
int EmDQM::countSubstring(const std::string &str, const std::string &sub) {
if (sub.length() == 0)
if (sub.empty())
return 0;
int count = 0;
for (size_t offset = str.find(sub); offset != std::string::npos; offset = str.find(sub, offset + sub.length())) {
Expand Down
Loading