diff --git a/root/io/io/TBufferMergerBenchmarks.cxx b/root/io/io/TBufferMergerBenchmarks.cxx index 57b935737..e72aaeabe 100644 --- a/root/io/io/TBufferMergerBenchmarks.cxx +++ b/root/io/io/TBufferMergerBenchmarks.cxx @@ -92,7 +92,7 @@ static void BM_TBufferFile_FillTreeWithRandomData(benchmark::State &state) // Setup code here. Merger = new TBufferMerger(std::make_unique("virtual_file.root", "RECREATE")); } - long size; + long size = 0; int flush = state.range(0); for (auto _ : state) { FillTreeWithRandomData(*Merger, flush); diff --git a/root/roofit/roofit/RooFitBinnedBenchmarks.cxx b/root/roofit/roofit/RooFitBinnedBenchmarks.cxx index 06c60f171..b37d29dda 100644 --- a/root/roofit/roofit/RooFitBinnedBenchmarks.cxx +++ b/root/roofit/roofit/RooFitBinnedBenchmarks.cxx @@ -61,10 +61,10 @@ Sample addVariations(Sample asample, int nnps, bool channel_crosstalk, int chann return asample; } -Channel makeChannel(int channel, int nbins, int nnps) +std::unique_ptr makeChannel(int channel, int nbins, int nnps) { std::string channel_name = "Region" + std::to_string(channel); - Channel chan(channel_name); + auto chan = std::make_unique(channel_name); gDirectory = nullptr; auto Signal_Hist = new TH1F("Signal", "Signal", nbins, 0, nbins); auto Background_Hist = new TH1F("Background", "Background", nbins, 0, nbins); @@ -79,7 +79,7 @@ Channel makeChannel(int channel, int nbins, int nnps) Data_Hist->Fill(bin + 0.5); } } - chan.SetData(Data_Hist); + chan->SetData(Data_Hist); Sample background("background"); background.SetNormalizeByTheory(false); background.SetHisto(Background_Hist); @@ -94,8 +94,8 @@ Channel makeChannel(int channel, int nbins, int nnps) signal = addVariations(signal, nnps, true, channel); background = addVariations(background, nnps, false, channel); } - chan.AddSample(background); - chan.AddSample(signal); + chan->AddSample(background); + chan->AddSample(signal); return chan; } @@ -109,15 +109,15 @@ void buildBinnedTest(int n_channels = 1, int nbins = 10, int nnps = 1, const cha meas.SetLumi(1.0); meas.SetLumiRelErr(0.10); meas.AddConstantParam("Lumi"); - Channel chan; + std::unique_ptr chan; for (int channel = 0; channel < n_channels; ++channel) { chan = makeChannel(channel, nbins, nnps); - meas.AddChannel(chan); + meas.AddChannel(*chan); } HistoToWorkspaceFactoryFast hist2workspace(meas); RooWorkspace *ws; if (n_channels < 2) { - ws = hist2workspace.MakeSingleChannelModel(meas, chan); + ws = hist2workspace.MakeSingleChannelModel(meas, *chan); } else { ws = hist2workspace.MakeCombinedModel(meas); } diff --git a/root/roofit/roofit/benchCodeSquashAD.cxx b/root/roofit/roofit/benchCodeSquashAD.cxx index 426b4e700..0b5ca59c7 100644 --- a/root/roofit/roofit/benchCodeSquashAD.cxx +++ b/root/roofit/roofit/benchCodeSquashAD.cxx @@ -87,16 +87,16 @@ static void BM_RooFuncWrapper_ManyParams_Minimization(benchmark::State &state) auto nChannels = state.range(1); - for (std::size_t i = 0; i < nChannels; ++i) { - std::string suffix = "_" + std::to_string(i + 1); + for (int iChannel = 0; iChannel < nChannels; ++iChannel) { + std::string suffix = "_" + std::to_string(iChannel + 1); auto obsName = "x" + suffix; auto x = std::make_unique(obsName.c_str(), obsName.c_str(), 0, 10.); x->setBins(20); - std::unique_ptr model{createModel(*x, std::to_string(i + 1))}; + std::unique_ptr model{createModel(*x, std::to_string(iChannel + 1))}; pdfMap.insert({"channel" + suffix, model.get()}); - channelCat.defineType("channel" + suffix, i); + channelCat.defineType("channel" + suffix, iChannel); dataMap.insert({"channel" + suffix, std::unique_ptr{model->generateBinned(*x, nEvents)}}); observables.addOwned(std::move(x)); diff --git a/root/roofit/roofit/benchRooFitBackends.cxx b/root/roofit/roofit/benchRooFitBackends.cxx index 4513baee5..c0e2b3b98 100644 --- a/root/roofit/roofit/benchRooFitBackends.cxx +++ b/root/roofit/roofit/benchRooFitBackends.cxx @@ -56,10 +56,6 @@ static void benchProdPdf(benchmark::State &state) { RooMsgService::instance().setGlobalKillBelow(RooFit::WARNING); - const RunConfig_t runConfig = static_cast(state.range(0)); - // const int printLevel = state.range(1); - // const int nParamSets = 1; // state.range(2) > 1 : state.range(2) ? 1; - // Declare variables x,mean,sigma with associated name, title, initial value and allowed range RooWorkspace w; @@ -272,10 +268,6 @@ static void benchModel(benchmark::State &state) { RooMsgService::instance().setGlobalKillBelow(RooFit::WARNING); - const RunConfig_t runConfig = static_cast(state.range(0)); - // const int printLevel = state.range(1); - // const int nParamSets = 1; // state.range(2) > 1 : state.range(2) ? 1; - // Declare variables x,mean,sigma with associated name, title, initial value and allowed range RooWorkspace w;