Skip to content

Commit

Permalink
[Clang tidy] Apply clang tidy checks for dqm
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsbuild committed Jul 15, 2020
1 parent b992d12 commit cb7971c
Show file tree
Hide file tree
Showing 24 changed files with 481 additions and 501 deletions.
4 changes: 2 additions & 2 deletions DQM/SiStripCommon/test/plugins/Test_SiStrip_HistId.cc
Expand Up @@ -19,9 +19,9 @@
class Test_SiStrip_HistId : public edm::EDAnalyzer {
public:
explicit Test_SiStrip_HistId(const edm::ParameterSet&);
~Test_SiStrip_HistId();
~Test_SiStrip_HistId() override;

virtual void analyze(const edm::Event&, const edm::EventSetup&);
void analyze(const edm::Event&, const edm::EventSetup&) override;

private:
#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
Expand Down
8 changes: 4 additions & 4 deletions DQM/SiStripCommon/test/plugins/testTkHistoMap.cc
Expand Up @@ -23,9 +23,9 @@
#include "TPostScript.h"
#include "TCanvas.h"

#include <math.h>
#include <vector>
#include <cmath>
#include <sstream>
#include <vector>

//******** Single include for the TkMap *************
#include "DQM/SiStripCommon/interface/TkHistoMap.h"
Expand All @@ -38,7 +38,7 @@
class testTkHistoMap : public DQMOneEDAnalyzer<> {
public:
explicit testTkHistoMap(const edm::ParameterSet&);
~testTkHistoMap();
~testTkHistoMap() override;

void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override {}
void analyze(const edm::Event&, const edm::EventSetup&) override;
Expand Down Expand Up @@ -87,7 +87,7 @@ void testTkHistoMap::read(const TkDetMap* tkDetMap) {
tkhistoCheck = std::make_unique<TkHistoMap>(tkDetMap);

tkhisto->loadTkHistoMap("detId", "detId");
tkhistoBis->loadTkHistoMap("detIdBis", "detIdBis", 1);
tkhistoBis->loadTkHistoMap("detIdBis", "detIdBis", true);
tkhistoZ->loadTkHistoMap("Zmap", "Zmap");
tkhistoPhi->loadTkHistoMap("Phi", "Phi");
tkhistoR->loadTkHistoMap("Rmap", "Rmap");
Expand Down
8 changes: 4 additions & 4 deletions DQMServices/Components/test/testSchemaEvolution.cpp
Expand Up @@ -20,9 +20,9 @@ class TestSchemaEvolution : public CppUnit::TestFixture {

public:
TestSchemaEvolution() = default;
~TestSchemaEvolution() = default;
void setUp() {}
void tearDown() {}
~TestSchemaEvolution() override = default;
void setUp() override {}
void tearDown() override {}
void checkVersions();

private:
Expand Down Expand Up @@ -107,7 +107,7 @@ void TestSchemaEvolution::gatherAllClasses() {
"TProfile",
"TProfile2D",
"TF1",
0};
nullptr};

int i = 0;
while (classes[i]) {
Expand Down
24 changes: 12 additions & 12 deletions DQMServices/FwkIO/test/DummyFillDQMStore.cc
Expand Up @@ -59,10 +59,10 @@ namespace {
m_valueToFill = iPSet.getUntrackedParameter<double>("value");
}

virtual ~TH1FFiller(){};
~TH1FFiller() override{};

void reset() { m_element->Reset(); }
void fill() { m_element->Fill(m_valueToFill); }
void reset() override { m_element->Reset(); }
void fill() override { m_element->Fill(m_valueToFill); }

private:
double m_valueToFill;
Expand Down Expand Up @@ -90,10 +90,10 @@ namespace {
m_valueToFill = iPSet.getUntrackedParameter<double>("value");
}

virtual ~TH2FFiller(){};
~TH2FFiller() override{};

void reset() { m_element->Reset(); }
void fill() { m_element->Fill(m_valueToFill, m_valueToFill); }
void reset() override { m_element->Reset(); }
void fill() override { m_element->Fill(m_valueToFill, m_valueToFill); }

private:
double m_valueToFill;
Expand All @@ -107,15 +107,15 @@ namespace {
class DummyFillDQMStore : public DQMOneLumiEDAnalyzer<> {
public:
explicit DummyFillDQMStore(const edm::ParameterSet&);
~DummyFillDQMStore();
~DummyFillDQMStore() override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

virtual void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
virtual void analyze(edm::Event const&, edm::EventSetup const&) override;
virtual void dqmEndRun(edm::Run const&, edm::EventSetup const&) override;
virtual void dqmBeginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
virtual void dqmEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
void analyze(edm::Event const&, edm::EventSetup const&) override;
void dqmEndRun(edm::Run const&, edm::EventSetup const&) override;
void dqmBeginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
void dqmEndLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;

private:
// ----------member data ---------------------------
Expand Down
26 changes: 13 additions & 13 deletions DQMServices/FwkIO/test/DummyReadDQMStore.cc
Expand Up @@ -48,7 +48,7 @@ namespace {
public:
TH1Reader(const edm::ParameterSet& iPSet, DQMStore& iStore, bool iSetLumiFlag)
: m_store(&iStore),
m_element(0),
m_element(nullptr),
m_runs(iPSet.getUntrackedParameter<std::vector<int> >("runs")),
m_lumis(iPSet.getUntrackedParameter<std::vector<int> >("lumis")),
m_means(iPSet.getUntrackedParameter<std::vector<double> >("means")),
Expand All @@ -61,9 +61,9 @@ namespace {
m_name = iPSet.getUntrackedParameter<std::string>("name") + extension;
}

virtual ~TH1Reader(){};
~TH1Reader() override{};

void read(int run, int lumi) {
void read(int run, int lumi) override {
double expected_mean = -1, expected_entries = -1;
for (unsigned int i = 0; i < m_runs.size(); i++) {
if (m_runs[i] == run && m_lumis[i] == lumi) {
Expand All @@ -74,7 +74,7 @@ namespace {
assert(expected_entries != -1 || !"Unexpected run/lumi!");

m_element = m_store->get(m_name);
if (0 == m_element) {
if (nullptr == m_element) {
throw cms::Exception("MissingElement") << "The element: " << m_name << " was not found";
}
TH1* hist = m_element->getTH1();
Expand Down Expand Up @@ -107,19 +107,19 @@ namespace {
class DummyReadDQMStore : public edm::EDAnalyzer {
public:
explicit DummyReadDQMStore(const edm::ParameterSet&);
~DummyReadDQMStore();
~DummyReadDQMStore() override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
virtual void beginJob();
virtual void analyze(const edm::Event&, const edm::EventSetup&);
virtual void endJob();

virtual void beginRun(edm::Run const&, edm::EventSetup const&);
virtual void endRun(edm::Run const&, edm::EventSetup const&);
virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
void beginJob() override;
void analyze(const edm::Event&, const edm::EventSetup&) override;
void endJob() override;

void beginRun(edm::Run const&, edm::EventSetup const&) override;
void endRun(edm::Run const&, edm::EventSetup const&) override;
void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;

// ----------member data ---------------------------
std::vector<std::shared_ptr<ReaderBase> > m_runReaders;
Expand Down
1 change: 0 additions & 1 deletion DQMServices/StreamerIO/plugins/BuildFile.xml
Expand Up @@ -4,7 +4,6 @@
<use name="IOPool/Output"/>
<use name="DQMServices/Core"/>
<use name="DQMServices/Components"/>
<use name="stdcxx-fs"/>
<library file="*.cc" name="DQMServicesStreamerIOPlugins">
<flags EDM_PLUGIN="1"/>
<flags REM_CXXFLAGS="-Werror=unused-variable"/>
Expand Down
14 changes: 7 additions & 7 deletions DQMServices/StreamerIO/plugins/DQMFileIterator.cc
Expand Up @@ -5,7 +5,7 @@
#include <boost/regex.hpp>
#include <boost/format.hpp>
#include <boost/range.hpp>
#include <filesystem>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string/predicate.hpp>

#include <memory>
Expand Down Expand Up @@ -45,7 +45,7 @@ namespace dqmservices {
if (boost::starts_with(datafn, "/"))
return datafn;

std::filesystem::path p(run_path);
boost::filesystem::path p(run_path);
p /= datafn;
return p.string();
}
Expand Down Expand Up @@ -183,10 +183,10 @@ namespace dqmservices {
std::time_t mtime_now = 0;

for (auto path : runPath_) {
if (!std::filesystem::exists(path))
if (!boost::filesystem::exists(path))
continue;

mtime_now = mtime_now ^ std::chrono::system_clock::to_time_t(std::filesystem::last_write_time(path));
mtime_now = mtime_now ^ boost::filesystem::last_write_time(path);
}

return mtime_now;
Expand Down Expand Up @@ -217,13 +217,13 @@ namespace dqmservices {
runPathMTime_ = mtime_now;
runPathLastCollect_ = now;

using std::filesystem::directory_entry;
using std::filesystem::directory_iterator;
using boost::filesystem::directory_entry;
using boost::filesystem::directory_iterator;

std::string fn_eor;

for (auto runPath : runPath_) {
if (!std::filesystem::exists(runPath)) {
if (!boost::filesystem::exists(runPath)) {
logFileAction("Directory does not exist: ", runPath);

continue;
Expand Down
2 changes: 1 addition & 1 deletion DQMServices/StreamerIO/plugins/DQMFileIterator.h
Expand Up @@ -5,7 +5,7 @@
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

#include <filesystem>
#include "boost/filesystem.hpp"

#include <map>
#include <unordered_set>
Expand Down
4 changes: 2 additions & 2 deletions DQMServices/StreamerIO/plugins/DQMMonitoringService.h
Expand Up @@ -12,7 +12,7 @@
#include "FWCore/ServiceRegistry/interface/StreamContext.h"
#include "FWCore/ServiceRegistry/interface/GlobalContext.h"
#include "FWCore/Utilities/interface/StreamID.h"
#include <filesystem>
#include "boost/filesystem.hpp"

#include <string>
#include <vector>
Expand All @@ -22,7 +22,7 @@
#include <chrono>
#include <unordered_map>

#include <filesystem>
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
Expand Down
2 changes: 1 addition & 1 deletion DQMServices/StreamerIO/plugins/DQMProtobufReader.cc
Expand Up @@ -134,7 +134,7 @@ void DQMProtobufReader::beginLuminosityBlock(edm::LuminosityBlock& lb) {
lb.put(std::move(json_product), "sourceJsonPath");

if (flagLoadFiles_) {
if (!std::filesystem::exists(path)) {
if (!boost::filesystem::exists(path)) {
fiterator_.logFileAction("Data file is missing ", path);
fiterator_.logLumiState(currentLumi_, "error: data file missing");
return;
Expand Down
4 changes: 2 additions & 2 deletions DQMServices/StreamerIO/plugins/DQMStreamerReader.cc
Expand Up @@ -16,7 +16,7 @@
#include <boost/regex.hpp>
#include <boost/format.hpp>
#include <boost/range.hpp>
#include <filesystem>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>

#include <IOPool/Streamer/interface/DumpTools.h>
Expand Down Expand Up @@ -158,7 +158,7 @@ namespace dqmservices {
DQMFileIterator::LumiEntry currentLumi = fiterator_.open();
std::string p = currentLumi.get_data_path();

if (std::filesystem::exists(p)) {
if (boost::filesystem::exists(p)) {
try {
openFileImp_(currentLumi);
return true;
Expand Down
2 changes: 1 addition & 1 deletion DQMServices/StreamerIO/plugins/DQMStreamerReader.h
Expand Up @@ -10,7 +10,7 @@
#include "DQMMonitoringService.h"
#include "TriggerSelector.h"

#include <filesystem>
#include "boost/filesystem.hpp"

#include <memory>
#include <string>
Expand Down
Expand Up @@ -4,7 +4,7 @@
#include "DQMServices/Components/interface/fillJson.h"

#include <boost/format.hpp>
#include <filesystem>
#include <boost/filesystem.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>

Expand All @@ -24,7 +24,7 @@ namespace dqmservices {

std::string base = str(boost::format("run%06d_ls%04d_%s") % runNumber_ % sequence_ % streamLabel_);

std::filesystem::path p(outputPath_);
boost::filesystem::path p(outputPath_);

currentFileName_ = (p / base).string() + ".root";
currentJsonName_ = (p / base).string() + ".jsn";
Expand Down
6 changes: 3 additions & 3 deletions DQMServices/StreamerIO/plugins/RamdiskMonitor.cc
Expand Up @@ -18,7 +18,7 @@
#include <boost/regex.hpp>
#include <boost/format.hpp>
#include <boost/range.hpp>
#include <filesystem>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string/predicate.hpp>

namespace dqm {
Expand Down Expand Up @@ -176,8 +176,8 @@ namespace dqm {
std::shared_ptr<dqm::rdm::Empty> RamdiskMonitor::globalBeginLuminosityBlock(edm::LuminosityBlock const &,
edm::EventSetup const &eSetup) const {
// search filesystem to find available lumi section files
using std::filesystem::directory_entry;
using std::filesystem::directory_iterator;
using boost::filesystem::directory_entry;
using boost::filesystem::directory_iterator;

directory_iterator dend;
for (directory_iterator di(runPath_); di != dend; ++di) {
Expand Down
1 change: 0 additions & 1 deletion DQMServices/StreamerIO/test/BuildFile.xml
Expand Up @@ -2,7 +2,6 @@
<use name="IOPool/Streamer"/>
<use name="EventFilter/Utilities"/>
<use name="DQMServices/Components"/>
<use name="stdcxx-fs"/>
<library file="*.cc" name="DQMServicesStreamerIOTestPlugins">
<flags EDM_PLUGIN="1"/>
</library>
Expand Down
24 changes: 12 additions & 12 deletions DQMServices/StreamerIO/test/DQMStreamerOutputRepackerTest.cc
Expand Up @@ -4,8 +4,8 @@

#include <zlib.h>
#include <boost/algorithm/string.hpp>
#include <filesystem>
#include <filesystem>
#include <boost/filesystem.hpp>
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
Expand Down Expand Up @@ -33,17 +33,17 @@ namespace dqmservices {
class DQMStreamerOutputRepackerTest : public edm::StreamerOutputModuleBase {
public:
explicit DQMStreamerOutputRepackerTest(edm::ParameterSet const& ps);
virtual ~DQMStreamerOutputRepackerTest();
~DQMStreamerOutputRepackerTest() override;
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
virtual void start() override;
virtual void stop() override;
virtual void doOutputHeader(InitMsgBuilder const& init_message) override;
virtual void doOutputEvent(EventMsgBuilder const& msg) override;
void start() override;
void stop() override;
void doOutputHeader(InitMsgBuilder const& init_message) override;
void doOutputEvent(EventMsgBuilder const& msg) override;

virtual void beginLuminosityBlock(edm::LuminosityBlockForOutput const&) override{};
virtual void endLuminosityBlock(edm::LuminosityBlockForOutput const&) override{};
void beginLuminosityBlock(edm::LuminosityBlockForOutput const&) override{};
void endLuminosityBlock(edm::LuminosityBlockForOutput const&) override{};

private:
void openFile_(uint32_t run, uint32_t lumi);
Expand Down Expand Up @@ -86,10 +86,10 @@ namespace dqmservices {

currentFileBase_ = str(boost::format("run%06d_ls%04d_stream%s_local") % run % lumi % streamLabel_);

std::filesystem::path p = outputPath_;
boost::filesystem::path p = outputPath_;
p /= str(boost::format("run%06d") % run);

std::filesystem::create_directories(p);
boost::filesystem::create_directories(p);

currentFilePath_ = (p / currentFileBase_).string() + ".dat";
currentJsonPath_ = (p / currentFileBase_).string() + ".jsn";
Expand All @@ -110,7 +110,7 @@ namespace dqmservices {

void DQMStreamerOutputRepackerTest::closeFile() {
edm::LogAbsolute("DQMStreamerOutputRepackerTest") << "Writing json: " << currentJsonPath_;
size_t fsize = std::filesystem::file_size(currentFilePath_);
size_t fsize = boost::filesystem::file_size(currentFilePath_);

using namespace boost::property_tree;
ptree pt;
Expand Down

0 comments on commit cb7971c

Please sign in to comment.