Skip to content

Commit

Permalink
Avoid compiler warnings when building rootbench
Browse files Browse the repository at this point in the history
  • Loading branch information
guitargeek committed Nov 13, 2023
1 parent d075ff1 commit 3ad867f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion root/io/io/TBufferMergerBenchmarks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static void BM_TBufferFile_FillTreeWithRandomData(benchmark::State &state)
// Setup code here.
Merger = new TBufferMerger(std::make_unique<TMemFile>("virtual_file.root", "RECREATE"));
}
long size;
long size = 0;
int flush = state.range(0);
for (auto _ : state) {
FillTreeWithRandomData(*Merger, flush);
Expand Down
16 changes: 8 additions & 8 deletions root/roofit/roofit/RooFitBinnedBenchmarks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<RooStats::HistFactory::Channel> 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<RooStats::HistFactory::Channel>(channel_name);
gDirectory = nullptr;
auto Signal_Hist = new TH1F("Signal", "Signal", nbins, 0, nbins);
auto Background_Hist = new TH1F("Background", "Background", nbins, 0, nbins);
Expand All @@ -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);
Expand All @@ -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;
}

Expand All @@ -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<RooStats::HistFactory::Channel> 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);
}
Expand Down
8 changes: 4 additions & 4 deletions root/roofit/roofit/benchCodeSquashAD.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<RooRealVar>(obsName.c_str(), obsName.c_str(), 0, 10.);
x->setBins(20);

std::unique_ptr<RooAbsPdf> model{createModel(*x, std::to_string(i + 1))};
std::unique_ptr<RooAbsPdf> 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<RooAbsData>{model->generateBinned(*x, nEvents)}});

observables.addOwned(std::move(x));
Expand Down
8 changes: 0 additions & 8 deletions root/roofit/roofit/benchRooFitBackends.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ static void benchProdPdf(benchmark::State &state)
{
RooMsgService::instance().setGlobalKillBelow(RooFit::WARNING);

const RunConfig_t runConfig = static_cast<RunConfig_t>(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;
Expand Down Expand Up @@ -272,10 +268,6 @@ static void benchModel(benchmark::State &state)
{
RooMsgService::instance().setGlobalKillBelow(RooFit::WARNING);

const RunConfig_t runConfig = static_cast<RunConfig_t>(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;
Expand Down

0 comments on commit 3ad867f

Please sign in to comment.