75 _pdf(
"pdf",
"PDF", this, pdf),
76 _n(
"n",
"Normalization",this,norm),
89 _pdf(
"pdf",this,other._pdf),
90 _n(
"n",this,other._n),
91 _rangeName(other._rangeName)
114 coutW(InputArguments) <<
"RooExtendPdf::expectedEvents(" <<
GetName() <<
") WARNING: RooExtendPdf needs non-null normalization set to calculate fraction in range "
115 <<
_rangeName <<
". Results may be nonsensical" << std::endl ;
126 if ( fracInt == 0. ||
_n == 0.) {
127 coutW(Eval) <<
"RooExtendPdf(" <<
GetName() <<
") WARNING: nExpected = " <<
_n <<
" / "
128 << fracInt <<
" for nset = " << (nset?*nset:
RooArgSet()) << std::endl ;
157std::unique_ptr<RooAbsArg>
162 struct NormRangeGuard {
163 NormRangeGuard(
RooAbsPdf &pdf,
const char *rangeName)
166 _pdf.setNormRange(rangeName);
168 ~NormRangeGuard() { _pdf.setNormRange(_oldNormRange.empty() ?
nullptr : _oldNormRange.c_str()); }
170 std::string _oldNormRange;
190 std::unique_ptr<RooAbsReal> rangeFactor;
194 auto rangeFactorName = std::string(
"one_over_") + fracInteg->GetName();
195 rangeFactor = std::make_unique<RooRatio>(rangeFactorName.c_str(), rangeFactorName.c_str(),
RooFit::RooConst(1.0), *fracInteg);
196 rangeFactor->addOwnedComponents(std::move(fracInteg));
197 prodList.
add(*rangeFactor);
201 std::unique_ptr<RooAbsReal> pdfExpectedEvents;
204 prodList.
add(*pdfExpectedEvents);
207 auto name = std::string(
GetName()) +
"_expectedEvents";
211 auto out = std::make_unique<RooProduct>(
name.c_str(),
name.c_str(), prodList);
213 out->addOwnedComponents(std::move(rangeFactor));
215 if(pdfExpectedEvents) {
216 out->addOwnedComponents(std::move(pdfExpectedEvents));
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Abstract interface for all probability density functions.
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
const char * normRange() const
virtual std::unique_ptr< RooAbsReal > createExpectedEventsFunc(const RooArgSet *nset) const
Returns an object that represents the expected number of events for a given normalization set,...
virtual const RooAbsReal * getNormObj(const RooArgSet *set, const RooArgSet *iset, const TNamed *rangeName=nullptr) const
Return pointer to RooAbsReal object that implements calculation of integral over observables iset in ...
A RooAbsReal::Ref can be constructed from a RooAbsReal& or a double that will be implicitly converted...
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
void setUnit(const char *unit)
const char * getPlotLabel() const
Get the label associated with the variable.
const Text_t * getUnit() const
void setPlotLabel(const char *label)
Set the label associated with this variable.
RooFit::OwningPtr< RooAbsReal > createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create an object that represents the integral of the function over one or more observables listed in ...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooExtendPdf is a wrapper around an existing PDF that adds a parameteric extended likelihood term to ...
std::unique_ptr< RooAbsReal > createExpectedEventsFunc(const RooArgSet *nset) const override
Returns an object that represents the expected number of events for a given normalization set,...
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
RooExtendPdf is self-normalized (selfNormalized() returns true), which means it delegates the normali...
RooAbsPdf const & pdf() const
RooTemplateProxy< RooAbsPdf > _pdf
Input p.d.f.
double expectedEvents(const RooArgSet *nset) const override
Return the number of expected events over the full range of all variables.
const TNamed * _rangeName
Name of subset range.
RooTemplateProxy< RooAbsReal > _n
Number of expected events.
bool likelihoodMode() const
Registry for const char* names.
static const char * str(const TNamed *ptr)
Return C++ string corresponding to given TNamed pointer.
const char * GetName() const override
Returns name of object.
RooConstVar & RooConst(double val)
std::string getColonSeparatedNameString(RooArgSet const &argSet, char delim=':')