70 _pdf(
"pdf",
"PDF", this, pdf),
71 _n(
"n",
"Normalization",this,norm),
84 _pdf(
"pdf",this,other._pdf),
85 _n(
"n",this,other._n),
86 _rangeName(other._rangeName)
109 coutW(InputArguments) <<
"RooExtendPdf::expectedEvents(" <<
GetName() <<
") WARNING: RooExtendPdf needs non-null normalization set to calculate fraction in range "
110 <<
_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));
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
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 ...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooFit::OwningPtr< RooAbsReal > createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Create an object that represents the integral of the function over one or more observables std::liste...
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.
RooNameReg is a 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)