74 _pdf(
"pdf",
"PDF", this, pdf),
75 _n(
"n",
"Normalization",this,norm),
88 _pdf(
"pdf",this,other._pdf),
89 _n(
"n",this,other._n),
113 coutW(InputArguments) <<
"RooExtendPdf::expectedEvents(" <<
GetName() <<
") WARNING: RooExtendPdf needs non-null normalization set to calculate fraction in range "
114 <<
_rangeName <<
". Results may be nonsensical" << endl ;
125 if ( fracInt == 0. ||
_n == 0.) {
126 coutW(Eval) <<
"RooExtendPdf(" <<
GetName() <<
") WARNING: nExpected = " <<
_n <<
" / "
127 << fracInt <<
" for nset = " << (nset?*nset:
RooArgSet()) << endl ;
148 std::unique_ptr<RooAbsReal> rangeFactor;
152 auto rangeFactorName = std::string(
"one_over_") + fracInteg->GetName();
153 rangeFactor = std::make_unique<RooRatio>(rangeFactorName.c_str(), rangeFactorName.c_str(),
RooFit::RooConst(1.0), *fracInteg);
154 rangeFactor->addOwnedComponents(std::move(fracInteg));
155 prodList.
add(*rangeFactor);
159 std::unique_ptr<RooAbsReal> pdfExpectedEvents;
162 prodList.
add(*pdfExpectedEvents);
165 auto name = std::string(
GetName()) +
"_expectedEvents";
166 auto out = std::make_unique<RooProduct>(
name.c_str(),
name.c_str(), prodList);
168 out->addOwnedComponents(std::move(rangeFactor));
170 if(pdfExpectedEvents) {
171 out->addOwnedComponents(std::move(pdfExpectedEvents));
std::string _rangeName
Name of range in which to calculate test statistic.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Abstract interface for all probability density functions.
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.
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...
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 ...
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.
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,...
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.
void translate(RooFit::Detail::CodeSquashContext &ctx) const override
This function defines a translation for each RooAbsReal based object that can be used to express the ...
A class to maintain the context for squashing of RooFit models into code.
void addResult(RooAbsArg const *key, std::string const &value)
A function to save an expression that includes/depends on the result of the input node.
std::string const & getResult(RooAbsArg const &arg)
Gets the result for the given node using the node name.
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)