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

[Clang tidy] Apply checks for db #30789

Merged
merged 2 commits into from
Jul 21, 2020
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
40 changes: 20 additions & 20 deletions CaloOnlineTools/HcalOnlineDb/src/HcalLutManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@ std::map<int, std::shared_ptr<LutXml>> HcalLutManager::getLinearizationLutXmlFro
_cfg.depth = row->idepth;
_cfg.crate = row->crate;
_cfg.slot = row->slot;
if (row->topbottom.find("t") != std::string::npos)
if (row->topbottom.find('t') != std::string::npos)
_cfg.topbottom = 1;
else if (row->topbottom.find("b") != std::string::npos)
else if (row->topbottom.find('b') != std::string::npos)
_cfg.topbottom = 0;
else if (row->topbottom.find("u") != std::string::npos)
else if (row->topbottom.find('u') != std::string::npos)
_cfg.topbottom = 2;
else
edm::LogWarning("HcalLutManager") << "fpga out of range...";
Expand Down Expand Up @@ -561,11 +561,11 @@ std::map<int, std::shared_ptr<LutXml>> HcalLutManager::getCompressionLutXmlFromA
_cfg.depth = row->idepth;
_cfg.crate = row->crate;
_cfg.slot = row->slot;
if (row->topbottom.find("t") != std::string::npos)
if (row->topbottom.find('t') != std::string::npos)
_cfg.topbottom = 1;
else if (row->topbottom.find("b") != std::string::npos)
else if (row->topbottom.find('b') != std::string::npos)
_cfg.topbottom = 0;
else if (row->topbottom.find("u") != std::string::npos)
else if (row->topbottom.find('u') != std::string::npos)
_cfg.topbottom = 2;
else
edm::LogWarning("HcalLutManager") << "fpga out of range...";
Expand Down Expand Up @@ -782,11 +782,11 @@ std::map<int, std::shared_ptr<LutXml>> HcalLutManager::getLinearizationLutXmlFro
_cfg.depth = row->idepth;
_cfg.crate = row->crate;
_cfg.slot = row->slot;
if (row->topbottom.find("t") != std::string::npos)
if (row->topbottom.find('t') != std::string::npos)
_cfg.topbottom = 1;
else if (row->topbottom.find("b") != std::string::npos)
else if (row->topbottom.find('b') != std::string::npos)
_cfg.topbottom = 0;
else if (row->topbottom.find("u") != std::string::npos)
else if (row->topbottom.find('u') != std::string::npos)
_cfg.topbottom = 2;
else
edm::LogWarning("HcalLutManager") << "fpga out of range...";
Expand Down Expand Up @@ -862,11 +862,11 @@ std::map<int, std::shared_ptr<LutXml>> HcalLutManager::getHEFineGrainLUTs(std::s
_cfg.depth = row->idepth;
_cfg.crate = row->crate;
_cfg.slot = row->slot;
if (row->topbottom.find("t") != std::string::npos)
if (row->topbottom.find('t') != std::string::npos)
_cfg.topbottom = 1;
else if (row->topbottom.find("b") != std::string::npos)
else if (row->topbottom.find('b') != std::string::npos)
_cfg.topbottom = 0;
else if (row->topbottom.find("u") != std::string::npos)
else if (row->topbottom.find('u') != std::string::npos)
_cfg.topbottom = 2;
else
edm::LogWarning("HcalLutManager") << "fpga out of range...";
Expand Down Expand Up @@ -960,11 +960,11 @@ std::map<int, std::shared_ptr<LutXml>> HcalLutManager::getCompressionLutXmlFromC
_cfg.depth = row->idepth;
_cfg.crate = row->crate;
_cfg.slot = row->slot;
if (row->topbottom.find("t") != std::string::npos)
if (row->topbottom.find('t') != std::string::npos)
_cfg.topbottom = 1;
else if (row->topbottom.find("b") != std::string::npos)
else if (row->topbottom.find('b') != std::string::npos)
_cfg.topbottom = 0;
else if (row->topbottom.find("u") != std::string::npos)
else if (row->topbottom.find('u') != std::string::npos)
_cfg.topbottom = 2;
else
edm::LogWarning("HcalLutManager") << "fpga out of range...";
Expand Down Expand Up @@ -1042,11 +1042,11 @@ std::map<int, std::shared_ptr<LutXml>> HcalLutManager::getCompressionLutXmlFromC
_cfg.depth = row->idepth;
_cfg.crate = row->crate;
_cfg.slot = row->slot;
if (row->topbottom.find("t") != std::string::npos)
if (row->topbottom.find('t') != std::string::npos)
_cfg.topbottom = 1;
else if (row->topbottom.find("b") != std::string::npos)
else if (row->topbottom.find('b') != std::string::npos)
_cfg.topbottom = 0;
else if (row->topbottom.find("u") != std::string::npos)
else if (row->topbottom.find('u') != std::string::npos)
_cfg.topbottom = 2;
else
edm::LogWarning("HcalLutManager") << "fpga out of range...";
Expand Down Expand Up @@ -1741,9 +1741,9 @@ std::map<int, std::shared_ptr<LutXml>> HcalLutManager::getZdcLutXml(std::string
_cfg.depth = row->idepth; // int
_cfg.crate = row->crate;
_cfg.slot = row->slot;
if (row->topbottom.find("t") != std::string::npos)
if (row->topbottom.find('t') != std::string::npos)
_cfg.topbottom = 1;
else if (row->topbottom.find("b") != std::string::npos)
else if (row->topbottom.find('b') != std::string::npos)
_cfg.topbottom = 0;
else
edm::LogWarning("HcalLutManager") << "fpga out of range...";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ namespace {

std::string titleMap = "APE #sqrt{d_{" + getStringFromIndex(i) + "}} value (payload : " + std::get<1>(iov) + ")";

std::unique_ptr<TrackerMap> tmap = std::unique_ptr<TrackerMap>(new TrackerMap("APE_dii"));
std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>("APE_dii");
tmap->setTitle(titleMap);
tmap->setPalette(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ namespace {

//std::unique_ptr<TH1F> compare = std::unique_ptr<TH1F>(new TH1F("comparison",Form("Comparison of %s;DetId index; #Delta%s %s",s_coord.c_str(),s_coord.c_str(),unit.c_str()),ref_ali.size(),-0.5,ref_ali.size()-0.5));
std::unique_ptr<TH1F> compare =
std::unique_ptr<TH1F>(new TH1F("comparison",
Form(";Detector Id index; #Delta%s %s", s_coord.c_str(), unit.c_str()),
ref_ali.size(),
-0.5,
ref_ali.size() - 0.5));
std::make_unique<TH1F>("comparison",
Form(";Detector Id index; #Delta%s %s", s_coord.c_str(), unit.c_str()),
ref_ali.size(),
-0.5,
ref_ali.size() - 0.5);

std::vector<int> boundaries;
AlignmentPI::partitions currentPart = AlignmentPI::BPix;
Expand Down Expand Up @@ -446,7 +446,7 @@ namespace {

int c_index = 1;

auto legend = std::unique_ptr<TLegend>(new TLegend(0.14, 0.93, 0.55, 0.98));
auto legend = std::make_unique<TLegend>(0.14, 0.93, 0.55, 0.98);
legend->AddEntry(
diffs[AlignmentPI::t_x].get(),
("#DeltaIOV: " + std::to_string(std::get<0>(lastiov)) + "-" + std::to_string(std::get<0>(firstiov))).c_str(),
Expand Down Expand Up @@ -584,10 +584,10 @@ namespace {
canvas.SetGrid();

auto h2_BarycenterParameters =
std::unique_ptr<TH2F>(new TH2F("Parameters", "SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.));
std::make_unique<TH2F>("Parameters", "SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.);

auto h2_uncBarycenterParameters =
std::unique_ptr<TH2F>(new TH2F("Parameters2", "SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.));
std::make_unique<TH2F>("Parameters2", "SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.);

h2_BarycenterParameters->SetStats(false);
h2_BarycenterParameters->SetTitle(nullptr);
Expand Down Expand Up @@ -739,8 +739,8 @@ namespace {
canvas.Modified();
canvas.SetGrid();

auto h2_BarycenterDiff = std::unique_ptr<TH2F>(
new TH2F("Parameters diff", "SubDetector Barycenter Difference", 3, 0.0, 3.0, 6, 0, 6.));
auto h2_BarycenterDiff =
std::make_unique<TH2F>("Parameters diff", "SubDetector Barycenter Difference", 3, 0.0, 3.0, 6, 0, 6.);

h2_BarycenterDiff->SetStats(false);
h2_BarycenterDiff->SetTitle(nullptr);
Expand Down Expand Up @@ -896,15 +896,15 @@ namespace {
unsigned int index(0);
for (const auto &piece : structures) {
const char *name = piece.c_str();
histos[index] = std::unique_ptr<TH2F>(
new TH2F(name,
Form("%s x-y Barycenter Difference;x_{%s}-x_{TOB} [mm];y_{%s}-y_{TOB} [mm]", name, name, name),
100,
-3.,
3.,
100,
-3.,
3.));
histos[index] = std::make_unique<TH2F>(
name,
Form("%s x-y Barycenter Difference;x_{%s}-x_{TOB} [mm];y_{%s}-y_{TOB} [mm]", name, name, name),
100,
-3.,
3.,
100,
-3.,
3.);

histos[index]->SetStats(false);
histos[index]->SetTitle(nullptr);
Expand All @@ -918,8 +918,8 @@ namespace {
index++;
}

auto h2_ZBarycenterDiff = std::unique_ptr<TH2F>(new TH2F(
"Pixel_z_diff", "Pixel z-Barycenter Difference;; z_{Pixel-Ideal} -z_{TOB} [mm]", 3, -0.5, 2.5, 100, -10., 10.));
auto h2_ZBarycenterDiff = std::make_unique<TH2F>(
"Pixel_z_diff", "Pixel z-Barycenter Difference;; z_{Pixel-Ideal} -z_{TOB} [mm]", 3, -0.5, 2.5, 100, -10., 10.);
h2_ZBarycenterDiff->SetStats(false);
h2_ZBarycenterDiff->SetTitle(nullptr);
h2_ZBarycenterDiff->GetXaxis()->SetBinLabel(1, "FPIX -");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ namespace {
std::string titleMap =
"Surface deformation parameter " + std::to_string(par) + " value (payload : " + std::get<1>(iov) + ")";

std::unique_ptr<TrackerMap> tmap = std::unique_ptr<TrackerMap>(new TrackerMap("Surface Deformations"));
std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>("Surface Deformations");
tmap->setTitle(titleMap);
tmap->setPalette(1);

Expand Down Expand Up @@ -432,7 +432,7 @@ namespace {
" (IOV : " + std::to_string(std::get<0>(lastiov)) + "- " +
std::to_string(std::get<0>(firstiov)) + ")";

std::unique_ptr<TrackerMap> tmap = std::unique_ptr<TrackerMap>(new TrackerMap("Surface Deformations #Delta"));
std::unique_ptr<TrackerMap> tmap = std::make_unique<TrackerMap>("Surface Deformations #Delta");
tmap->setTitle(titleMap);
tmap->setPalette(1);

Expand Down
2 changes: 1 addition & 1 deletion CondCore/CondDB/src/DbConnectionString.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace cond {
if (startRefresh != std::string::npos) {
startRefresh += 3;
}
std::string::size_type endRefresh = finalConn.rfind("/", std::string::npos);
std::string::size_type endRefresh = finalConn.rfind('/', std::string::npos);
if (endRefresh == std::string::npos) {
refreshConn = finalConn;
} else {
Expand Down
2 changes: 1 addition & 1 deletion CondCore/CondDB/src/GTProxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace cond {
std::pair<std::string, std::string> parseTag(const std::string& tag) {
std::string pfn("");
std::string t(tag);
size_t pos = tag.rfind("[");
size_t pos = tag.rfind('[');
if (pos != std::string::npos && tag.size() >= pos + 2) {
if (tag[pos - 1] == '@' && tag[tag.size() - 1] == ']') {
pfn = tag.substr(pos + 1, tag.size() - pos - 2);
Expand Down
2 changes: 1 addition & 1 deletion CondCore/CondDB/src/GTSchema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace cond {
boost::posix_time::ptime& snapshotTime) {
Query<VALIDITY, DESCRIPTION, RELEASE, SNAPSHOT_TIME> q(m_schema);
q.addCondition<NAME>(name);
for (auto row : q)
for (const auto& row : q)
std::tie(validity, description, release, snapshotTime) = row;

return q.retrievedRows();
Expand Down
2 changes: 1 addition & 1 deletion CondCore/CondDB/src/IOVEditor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ namespace cond {
if (m_session->iovSchema().tagLogTable().exists()) {
std::string action("Tag header updated. Changes involve: ");
size_t i = 0;
for (auto c : m_data->changes) {
for (const auto& c : m_data->changes) {
action += c;
if (i == (m_data->changes.size() - 1))
action += ".";
Expand Down
6 changes: 4 additions & 2 deletions CondCore/CondDB/src/IOVProxy.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <memory>

#include "CondCore/CondDB/interface/IOVProxy.h"
#include "SessionImpl.h"

Expand Down Expand Up @@ -75,11 +77,11 @@ namespace cond {
IOVArray::IOVArray() : m_array(new IOVContainer) {}

IOVArray::IOVArray(const IOVArray& rhs) : m_array(), m_tagInfo(rhs.m_tagInfo) {
m_array.reset(new IOVContainer(*rhs.m_array));
m_array = std::make_unique<IOVContainer>(*rhs.m_array);
}

IOVArray& IOVArray::operator=(const IOVArray& rhs) {
m_array.reset(new IOVContainer(*rhs.m_array));
m_array = std::make_unique<IOVContainer>(*rhs.m_array);
m_tagInfo = rhs.m_tagInfo;
return *this;
}
Expand Down
6 changes: 3 additions & 3 deletions CondCore/CondDB/src/IOVSchema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace cond {
cond::Time_t& lastValidatedTime) {
Query<TIME_TYPE, OBJECT_TYPE, SYNCHRONIZATION, END_OF_VALIDITY, LAST_VALIDATED_TIME> q(m_schema);
q.addCondition<NAME>(name);
for (auto row : q)
for (const auto& row : q)
std::tie(timeType, objectType, synchronizationType, endOfValidity, lastValidatedTime) = row;

return q.retrievedRows();
Expand All @@ -83,7 +83,7 @@ namespace cond {
boost::posix_time::ptime& modificationTime) {
Query<DESCRIPTION, INSERTION_TIME, MODIFICATION_TIME> q(m_schema);
q.addCondition<NAME>(name);
for (auto row : q)
for (const auto& row : q)
std::tie(description, insertionTime, modificationTime) = row;
return q.retrievedRows();
}
Expand Down Expand Up @@ -379,7 +379,7 @@ namespace cond {
cond::Binary& streamerInfoData) {
Query<DATA, STREAMER_INFO, OBJECT_TYPE> q(m_schema);
q.addCondition<HASH>(payloadHash);
for (auto row : q) {
for (const auto& row : q) {
std::tie(payloadData, streamerInfoData, objectType) = row;
}
return q.retrievedRows();
Expand Down
11 changes: 7 additions & 4 deletions CondCore/CondDB/src/SessionImpl.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "CondCore/CondDB/interface/Exception.h"
#include "SessionImpl.h"

#include <memory>

#include "DbConnectionString.h"
//
//
Expand Down Expand Up @@ -48,10 +51,10 @@ namespace cond {
std::unique_lock<std::recursive_mutex> lock(transactionMutex);
if (!transaction.get()) {
coralSession->transaction().start(readOnly);
iovSchemaHandle.reset(new IOVSchema(coralSession->nominalSchema()));
gtSchemaHandle.reset(new GTSchema(coralSession->nominalSchema()));
runInfoSchemaHandle.reset(new RunInfoSchema(coralSession->nominalSchema()));
transaction.reset(new CondDBTransaction(coralSession));
iovSchemaHandle = std::make_unique<IOVSchema>(coralSession->nominalSchema());
gtSchemaHandle = std::make_unique<GTSchema>(coralSession->nominalSchema());
runInfoSchemaHandle = std::make_unique<RunInfoSchema>(coralSession->nominalSchema());
transaction = std::make_unique<CondDBTransaction>(coralSession);
} else {
if (!readOnly)
throwException("An update transaction is already active.", "SessionImpl::startTransaction");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ namespace {
canvas.Modified();
canvas.SetGrid();

auto Thresholds = std::unique_ptr<TH2F>(
new TH2F("Thresholds", "Alignment parameter thresholds", alignables.size(), 0, alignables.size(), 24, 0, 24));
auto Thresholds = std::make_unique<TH2F>(
"Thresholds", "Alignment parameter thresholds", alignables.size(), 0, alignables.size(), 24, 0, 24);
Thresholds->SetStats(false);

std::function<float(types, std::string, AlignPCLThresholds::coordType)> cutFunctor =
Expand Down
4 changes: 2 additions & 2 deletions CondCore/RunInfoPlugins/plugins/RunInfo_PayloadInspector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ namespace {
canvas.Modified();
canvas.SetGrid();

auto h2_RunInfoParameters = std::unique_ptr<TH2F>(new TH2F("Parameters", "", 1, 0.0, 1.0, 11, 0, 11.));
auto h2_RunInfoState = std::unique_ptr<TH2F>(new TH2F("State", "", 1, 0.0, 1.0, 11, 0, 11.));
auto h2_RunInfoParameters = std::make_unique<TH2F>("Parameters", "", 1, 0.0, 1.0, 11, 0, 11.);
auto h2_RunInfoState = std::make_unique<TH2F>("State", "", 1, 0.0, 1.0, 11, 0, 11.);
h2_RunInfoParameters->SetStats(false);
h2_RunInfoState->SetStats(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,11 @@ namespace {

TCanvas canvas("Canv", "Canv", 1200, 1000);
canvas.cd();
auto h1 = std::unique_ptr<TH1F>(
new TH1F("value",
"SiPixel LA value;SiPixel LorentzAngle #mu_{H}(tan#theta_{L}/B) [1/T];# modules",
50,
extrema.first * 0.9,
extrema.second * 1.1));
auto h1 = std::make_unique<TH1F>("value",
"SiPixel LA value;SiPixel LorentzAngle #mu_{H}(tan#theta_{L}/B) [1/T];# modules",
50,
extrema.first * 0.9,
extrema.second * 1.1);

SiPixelPI::adjustCanvasMargins(canvas.cd(), 0.06, 0.12, 0.12, 0.05);
canvas.Modified();
Expand Down Expand Up @@ -436,20 +435,20 @@ namespace {

TCanvas canvas("Canv", "Canv", 1200, 1000);
canvas.cd();
auto hfirst = std::unique_ptr<TH1F>(
new TH1F("value_first",
"SiPixel LA value;SiPixel LorentzAngle #mu_{H}(tan#theta_{L}/B) [1/T];# modules",
50,
min * 0.9,
max * 1.1));
auto hfirst =
std::make_unique<TH1F>("value_first",
"SiPixel LA value;SiPixel LorentzAngle #mu_{H}(tan#theta_{L}/B) [1/T];# modules",
50,
min * 0.9,
max * 1.1);
hfirst->SetStats(false);

auto hlast = std::unique_ptr<TH1F>(
new TH1F("value_last",
"SiPixel LA value;SiPixel LorentzAngle #mu_{H}(tan#theta_{L}/B) [1/T];# modules",
50,
min * 0.9,
max * 1.1));
auto hlast =
std::make_unique<TH1F>("value_last",
"SiPixel LA value;SiPixel LorentzAngle #mu_{H}(tan#theta_{L}/B) [1/T];# modules",
50,
min * 0.9,
max * 1.1);
hlast->SetStats(false);

SiPixelPI::adjustCanvasMargins(canvas.cd(), 0.06, 0.12, 0.12, 0.05);
Expand Down
Loading