Skip to content

Commit

Permalink
[RF] Adapt roottest to new RooFit::Evaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
guitargeek committed Aug 24, 2023
1 parent cc428cc commit 6ab9b4e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions root/roofitstats/vectorisedPDFs/VectorisedPDFTests.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
#include "RooFitResult.h"
#include "RooAbsRealLValue.h"
#include "RooGaussian.h"
#include "TCanvas.h"
#include "RooPlot.h"
#include "RooRandom.h"
#include "RooConstVar.h"
#include "Math/Util.h"
#include "RooHelpers.h"
#include "RooFit/Evaluator.h"

#include "../src/RooFit/BatchModeDataHelpers.h"
#include "../src/RooFitDriver.h"

#include <Math/Util.h>
#include <TCanvas.h>

#include <numeric>
#include <ctime>
Expand All @@ -46,15 +47,15 @@ void __itt_pause() {}
std::vector<double> getValues(RooAbsReal const &real, RooAbsData const &data)
{
std::unique_ptr<RooAbsReal> clone = RooFit::Detail::compileForNormSet<RooAbsReal>(real, *data.get());
ROOT::Experimental::RooFitDriver driver(*clone, RooFit::BatchModeOption::Cpu);
RooFit::Evaluator evaluator(*clone);
std::stack<std::vector<double>> vectorBuffers;
auto dataSpans = RooFit::BatchModeDataHelpers::getDataSpans(data, "", nullptr, /*skipZeroWeights=*/false,
/*takeGlobalObservablesFromData=*/true, vectorBuffers);
for (auto const &item : dataSpans) {
driver.setInput(item.first->GetName(), item.second, false);
evaluator.setInput(item.first->GetName(), item.second, false);
}
std::vector<double> out;
std::span<const double> results = driver.run();
std::span<const double> results = evaluator.run();
out.assign(results.begin(), results.end());
return out;
}
Expand Down

0 comments on commit 6ab9b4e

Please sign in to comment.