31namespace TestStatistics {
47 throw std::logic_error(
"RooAbsL::isExtendedHelper got an unknown extended value!");
55 std::size_t N_components,
Extended extended)
56 : pdf_(std::move(pdf)),
57 data_(std::move(
data)),
59 N_components_(N_components),
60 extended_(isExtendedHelper(pdf_.get(), extended))
65 <<
"in RooAbsL ctor: p.d.f. provides expected number of events, including extended term in likelihood."
81 :
RooAbsL(in.ownedPdf ? std::move(in.ownedPdf)
101 :
RooAbsL({std::shared_ptr<RooAbsPdf>(
nullptr), inpdf}, {std::shared_ptr<RooAbsData>(
nullptr), indata}, N_events,
102 N_components, extended)
109 N_events_(other.N_events_),
110 N_components_(other.N_components_),
111 extended_(other.extended_),
112 sim_count_(other.sim_count_)
116 assert((
pdf_.use_count() != 1) && (
data_.use_count() != 1) && (
pdf_.use_count() ==
data_.use_count()));
117 if ((
pdf_.use_count() > 1) && (
data_.use_count() > 1)) {
131 auto _funcObsSet =
pdf_->getObservables(indata);
133 if (
pdf_->getAttribute(
"BinnedLikelihood")) {
134 pdf_->setAttribute(
"BinnedLikelihoodActive");
138 std::unique_ptr<RooArgSet> origParams{inpdf.
getParameters(indata)};
139 pdf_->recursiveRedirectServers(*origParams);
142 normSet_ = std::make_unique<RooArgSet>();
146 for (
const auto realDep : *_funcObsSet) {
148 if (realDepRLV && realDepRLV->isDerived()) {
150 realDepRLV->leafNodeServerList(&tmp2,
nullptr,
true);
151 _funcObsSet->
add(tmp2,
true);
161 for (
const auto arg : *_funcObsSet) {
164 auto realReal =
dynamic_cast<RooRealVar *
>(arg);
168 auto datReal =
dynamic_cast<RooRealVar *
>(dataDepSet->
find(realReal->GetName()));
175 if (!realReal->getBinning().lowBoundFunc() && realReal->getMin() < (datReal->getMin() - 1
e-6)) {
177 << realReal->getMin() <<
") is smaller than that of " << arg->GetName()
178 <<
" in the dataset (" << datReal->getMin() <<
")" << std::endl;
183 if (!realReal->getBinning().highBoundFunc() && realReal->getMax() > (datReal->getMax() + 1
e-6)) {
185 <<
"RooAbsL: ERROR maximum of FUNC observable " << arg->GetName() <<
" is larger than that of "
186 << arg->GetName() <<
" in the dataset" << std::endl;
213 data_->attachBuffers(*_funcObsSet);
229 pdf_->optimizeCacheMode(*_funcObsSet);
231 data_->setDirtyProp(
false);
239 return std::unique_ptr<RooArgSet>{
pdf_->getParameters(*
data_)};
253 std::string
output(
"likelihood of pdf ");
260 std::string
output(
"likelihood of pdf ");
267 return static_cast<std::size_t
>(
data_->numEntries());
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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...
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
Abstract interface for all probability density functions.
virtual ExtendMode extendMode() const
Returns ability of PDF to provide extended likelihood terms.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
static void softAbort()
Soft abort function that interrupts macro execution but doesn't kill ROOT.
Convenience wrapper class used to distinguish between pdf/data owning and non-owning constructors.
std::shared_ptr< RooAbsData > data_
static bool isExtendedHelper(RooAbsPdf *pdf, Extended extended)
virtual std::string GetName() const
virtual std::string GetTitle() const
std::unique_ptr< RooArgSet > normSet_
Pointer to set with observables used for normalization.
void initClones(RooAbsPdf &inpdf, RooAbsData &indata)
virtual std::unique_ptr< RooArgSet > getParameters()
virtual void constOptimizeTestStatistic(RooAbsArg::ConstOpCode opcode, bool doAlsoTrackingOpt)
Interface function signaling a request to perform constant term optimization.
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...
virtual std::size_t numDataEntries() const
Number of dataset entries.
std::shared_ptr< RooAbsPdf > pdf_
Variable that can be changed from the outside.
const char * GetName() const override
Returns name of object.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
static void enableConstantTermsOptimization(RooAbsReal *function, RooArgSet *norm_set, RooAbsData *dataset, bool applyTrackingOpt)