39namespace TestStatistics {
46 throw std::logic_error(
"RooBinnedL can only be created from pdf of type RooRealSumPdf!");
56 paramTracker_ = std::make_unique<RooChangeTracker>(
"chtracker",
"change tracker", params,
true);
59 if (obs->size() != 1) {
60 throw std::logic_error(
61 "RooBinnedL can only be created from combination of pdf and data which has exactly one observable!");
63 RooRealVar *var = static_cast<RooRealVar *>(obs->first());
64 std::list<double> *boundaries = pdf->binBoundaries(*var, var->getMin(), var->getMax());
65 std::list<double>::iterator biter = boundaries->begin();
66 _binw.resize(boundaries->size() - 1);
67 double lastBound = (*biter);
70 while (biter != boundaries->end()) {
71 _binw[ibin] = (*biter) - lastBound;
79RooBinnedL::~RooBinnedL() =
default;
112 double eventWeight =
data_->weight();
115 double N = eventWeight;
118 if (mu <= 0 && N > 0) {
122 TString::Format(
"Observed %f events in bin %zu with zero event yield",
N, i));
124 }
else if (std::abs(mu) < 1
e-10 && std::abs(
N) < 1
e-10) {
133 sumWeight += eventWeight;
147 pdf_->wireAllCaches();
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...
RooFit::OwningPtr< RooArgSet > getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
Abstract base class for binned and unbinned datasets.
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.
void logEvalError(const char *message, const char *serverValueString=nullptr) const
Log evaluation error message.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Convenience wrapper class used to distinguish between pdf/data owning and non-owning constructors.
std::shared_ptr< RooAbsData > data_
virtual std::string GetName() const
RooAbsL(std::shared_ptr< RooAbsPdf > pdf, std::shared_ptr< RooAbsData > data, std::size_t N_events, std::size_t N_components, Extended extended)
After handling cloning (or not) of the pdf and dataset, the public constructors call this private con...
std::shared_ptr< RooAbsPdf > pdf_
ROOT::Math::KahanSum< double > evaluatePartition(Section bins, 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 ...
ROOT::Math::KahanSum< double > cachedResult_
std::unique_ptr< RooChangeTracker > paramTracker_
RooBinnedL(RooAbsPdf *pdf, RooAbsData *data)
std::vector< double > _binw
!
Implements a PDF constructed from a sum of functions:
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Double_t LnGamma(Double_t z)
Computation of ln[gamma(z)] for all z.
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