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

Apply clang-tidy suggestions #279

Merged
merged 1 commit into from
Nov 10, 2023
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 root/hist/hist/FitGradBenchmarks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ManyGausFit {
bool useCLAD = false;

public:
ManyGausFit(int ng = 30, int nbins = 1000, bool clad = false, bool debLevel = 0, int seed = 1111)
ManyGausFit(int ng = 30, int nbins = 1000, bool clad = false, bool debLevel = false, int seed = 1111)
{
useCLAD = clad;
debug = debLevel;
Expand Down
1 change: 0 additions & 1 deletion root/hist/hist/TFormulaBenchmarks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
class TFormulaTests : public TFormula {
public:
TFormulaTests(TString name, TString formula): TFormula(name,formula){}
virtual ~TFormulaTests(){}
Bool_t ParserNew();
Bool_t GetVarVal();
Bool_t GetParVal();
Expand Down
2 changes: 1 addition & 1 deletion root/hist/hist/THistFillBenchmarks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static void BM_THist_FillN(benchmark::State &state)
// FillN without weight
hist->FillN(nbOfDataPoints, &xCoords[0], &yCoords[0], &weights[0], 1);
// FillN with weights
hist->FillN(nbOfDataPoints, &xCoords[0], &yCoords[0], NULL, 1);
hist->FillN(nbOfDataPoints, &xCoords[0], &yCoords[0], nullptr, 1);
}
}
BENCHMARK(BM_THist_FillN) -> Apply(FillArguments);
Expand Down
7 changes: 4 additions & 3 deletions root/io/io/TBufferMergerBenchmarks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "benchmark/benchmark.h"

#include <memory>
#include <random>
#include <string>
#include <sstream>
Expand All @@ -23,7 +24,7 @@ static void BM_TBufferFile_CreateEmpty(benchmark::State &state)
{
const char *filename = "empty.root";
for (auto _ : state) {
TBufferMerger m(std::unique_ptr<TMemFile>(new TMemFile(filename, "RECREATE")));
TBufferMerger m(std::make_unique<TMemFile>(filename, "RECREATE"));
}
}
BENCHMARK(BM_TBufferFile_CreateEmpty)->Unit(benchmark::kMicrosecond);
Expand All @@ -37,7 +38,7 @@ static void BM_TBufferFile_GetFile(benchmark::State &state)
// FIXME: We should have a way to pass an externally constructed file or stream to
// TFile*, this would allow us to create in-memory files and avoid killing disks
// when we benchmark IO.
Merger = new TBufferMerger(std::unique_ptr<TMemFile>(new TMemFile("virtual_file.root", "RECREATE")));
Merger = new TBufferMerger(std::make_unique<TMemFile>("virtual_file.root", "RECREATE"));
}
for (auto _ : state) {
// Run the test as normal.
Expand Down Expand Up @@ -89,7 +90,7 @@ static void BM_TBufferFile_FillTreeWithRandomData(benchmark::State &state)
ROOT::EnableThreadSafety();
if (state.thread_index() == 0) {
// Setup code here.
Merger = new TBufferMerger(std::unique_ptr<TMemFile>(new TMemFile("virtual_file.root", "RECREATE")));
Merger = new TBufferMerger(std::make_unique<TMemFile>("virtual_file.root", "RECREATE"));
}
long size;
int flush = state.range(0);
Expand Down
2 changes: 1 addition & 1 deletion root/roofit/histfactory/benchHistFactory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TestData {
RooMinimizer m(*nll);
m.setPrintLevel(-1);
m.setStrategy(0);
m.setLoggingToDataSet(1);
m.setLoggingToDataSet(true);

m.minimize("Minuit2");

Expand Down
6 changes: 3 additions & 3 deletions root/roofit/roofit/RooFitBinnedBenchmarks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static void BM_RooFit_BinnedTestMigrad(benchmark::State &state)
RooMinimizer m(*nll);
m.setPrintLevel(-1);
m.setStrategy(0);
m.setProfile(0);
m.setProfile(false);
m.setLogFile("benchmigradnchannellog");
for (auto _ : state) {
m.migrad();
Expand Down Expand Up @@ -190,7 +190,7 @@ static void BM_RooFit_BinnedTestHesse(benchmark::State &state)
RooMinimizer m(*nll);
m.setPrintLevel(-1);
m.setStrategy(0);
m.setProfile(0);
m.setProfile(false);
m.setLogFile("benchhessenchannellog");
m.migrad();
w->loadSnapshot("no_fit");
Expand Down Expand Up @@ -227,7 +227,7 @@ static void BM_RooFit_BinnedTestMinos(benchmark::State &state)
RooMinimizer m(*nll);
m.setPrintLevel(-1);
m.setStrategy(0);
m.setProfile(0);
m.setProfile(false);
m.setLogFile("benchhessenchannellog");
m.migrad();
m.hesse();
Expand Down
9 changes: 5 additions & 4 deletions root/roofit/roofit/benchCodeSquashAD.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "benchmark/benchmark.h"

#include <limits>
#include <memory>

static int counter = 0;

Expand Down Expand Up @@ -125,13 +126,13 @@ static void BM_RooFuncWrapper_ManyParams_Minimization(benchmark::State &state)

int code = state.range(0);
if (code == RooFitADBenchmarksUtils::backend::Reference) {
m.reset(new RooMinimizer(*nllRef));
m = std::make_unique<RooMinimizer>(*nllRef);
} else if (code == RooFitADBenchmarksUtils::backend::CodeSquashNumDiff) {
m.reset(new RooMinimizer(*nllFuncNoGrad));
m = std::make_unique<RooMinimizer>(*nllFuncNoGrad);
} else if (code == RooFitADBenchmarksUtils::backend::BatchMode) {
m.reset(new RooMinimizer(*nllRefBatch));
m = std::make_unique<RooMinimizer>(*nllRefBatch);
} else if (code == RooFitADBenchmarksUtils::backend::CodeSquashAD) {
m.reset(new RooMinimizer(*nllFunc));
m = std::make_unique<RooMinimizer>(*nllFunc);
}

for (auto _ : state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ inline auto minDPhiDRLepJet(const bool showDR=false)
if (showDR) vDiff.push_back(lep.DeltaR(jet));
else vDiff.push_back(std::abs(lep.DeltaPhi(jet)));
}
if(vDiff.size()>0) minVal = *std::min_element(vDiff.begin(),vDiff.end());
if(!vDiff.empty()) minVal = *std::min_element(vDiff.begin(),vDiff.end());
return minVal;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,8 @@ inline auto GetXMLFF_Eta_Pt(const std::vector<TString> ele_systList, const std::
FFvalues["fakeWeight_statDown"] = -99.;

std::vector<TString> allSyst;
for (const auto &syst : ele_systList) allSyst.push_back(syst);
allSyst.reserve(ele_systList.size());
for (const auto &syst : ele_systList) allSyst.push_back(syst);
for(const auto &muSys: muon_systList){
bool exist = false;
for(const auto &syst : allSyst){
Expand Down
3 changes: 1 addition & 2 deletions root/tree/dataframe/wmass/inc/getWeights.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class getWeights : public Module {

public:

~getWeights() {};
RNode run(RNode) override;
std::vector<ROOT::RDF::RResultPtr<TH1D>> getTH1() override;
std::vector<ROOT::RDF::RResultPtr<TH2D>> getTH2() override;
Expand All @@ -46,4 +45,4 @@ class getWeights : public Module {

};

#endif
#endif
Loading