40namespace TestStatistics {
58 paramTracker_ = std::make_unique<RooChangeTracker>(
"chtracker",
"change tracker", *params,
true);
66 auto dataSpans = RooFit::BatchModeDataHelpers::getDataSpans(*
data,
"",
nullptr,
false,
68 for (
auto const &item : dataSpans) {
69 evaluator_->setInput(item.first->GetName(), item.second,
false);
75 apply_weight_squared(other.apply_weight_squared),
76 lastSection_(other.lastSection_),
77 cachedResult_(other.cachedResult_),
78 evaluator_(other.evaluator_)
100using ComputeResult = std::pair<ROOT::Math::KahanSum<double>,
double>;
108ComputeResult computeBatchFunc(std::span<const double> probas,
RooAbsData *dataClone,
bool weightSq,
109 std::size_t firstEvent, std::size_t lastEvent, std::vector<double> &unitWeights,
112 const std::size_t nEvents = lastEvent - firstEvent;
114 std::span<const double> dataWeights = dataClone->
getWeightBatch(firstEvent, nEvents, weightSq);
117 const double *weightData =
nullptr;
118 std::size_t nWeights = 0;
119 if (dataWeights.empty()) {
120 if (unitWeights.size() < nEvents) {
121 unitWeights.assign(nEvents, 1.0);
123 weightData = unitWeights.data();
127 weightData = dataWeights.data();
128 nWeights = dataWeights.size();
131 std::span<const double> weights{weightData, nWeights};
133 std::span<const double> probasInRange{
probas.data() + firstEvent, nEvents};
165 std::span<const double> probas =
evaluator_->run();
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
The Kahan summation is a compensated summation algorithm, which significantly reduces numerical error...
RooFit::OwningPtr< RooArgSet > getParameters(const RooAbsData *data, bool stripDisconnected=true) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Abstract base class for binned and unbinned datasets.
virtual std::span< const double > getWeightBatch(std::size_t first, std::size_t len, bool sumW2=false) const =0
Return event weights of all events in range [first, first+len).
Abstract interface for all probability density functions.
static ErrorLoggingMode evalErrorLoggingMode()
Return current evaluation error logging mode.
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
Minimal configuration struct to steer the evaluation of a single node with the RooBatchCompute librar...
std::shared_ptr< RooAbsData > data_
std::shared_ptr< RooAbsPdf > pdf_
ROOT::Math::KahanSum< double > cachedResult_
std::vector< double > _unitWeights
! all-ones weights for unweighted data in batched evaluation
bool setApplyWeightSquared(bool flag)
Returns true if value was changed, false otherwise.
ROOT::Math::KahanSum< double > evaluatePartition(Section events, std::size_t components_begin, std::size_t components_end) override
Calculate and return likelihood on subset of data from firstEvent to lastEvent processed with a step ...
RooUnbinnedL(RooAbsPdf *pdf, RooAbsData *data, RooAbsL::Extended extended=RooAbsL::Extended::Auto, RooFit::EvalBackend evalBackend=RooFit::EvalBackend::Cpu())
std::unique_ptr< RooChangeTracker > paramTracker_
bool apply_weight_squared
Apply weights squared?
std::stack< std::vector< double > > _vectorBuffers
std::shared_ptr< RooFit::Evaluator > evaluator_
! For batched evaluation
double reduceSum(Config cfg, InputArr input, size_t n)
ReduceNLLOutput reduceNLL(Config cfg, std::span< const double > probas, std::span< const double > weights, std::span< const double > offsetProbas)
std::unique_ptr< T > compileForNormSet(T const &arg, RooArgSet const &normSet)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
void probas(TString dataset, TString fin="TMVA.root", Bool_t useTMVAStyle=kTRUE)
A part of some range delimited by two fractional points between 0 and 1 (inclusive).
std::size_t begin(std::size_t N_total) const
std::size_t end(std::size_t N_total) const