Skip to content

Commit

Permalink
added new constructor for RooExtendPdf
Browse files Browse the repository at this point in the history
  • Loading branch information
cburgard committed Jan 13, 2023
1 parent ec31a9e commit b243b04
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 3 additions & 1 deletion roofit/roofitcore/inc/RooExtendPdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class RooExtendPdf : public RooAbsPdf {

RooExtendPdf() ;
RooExtendPdf(const char *name, const char *title, RooAbsPdf& pdf,
RooAbsReal& norm, const char* rangeName=nullptr) ;
RooAbsReal& norm, const char* rangeName=nullptr) ;
RooExtendPdf(const char *name, const char *title, RooAbsPdf& pdf,
double norm, const char* rangeName=nullptr) ;
RooExtendPdf(const RooExtendPdf& other, const char* name=nullptr) ;
TObject* clone(const char* newname) const override { return new RooExtendPdf(*this,newname) ; }
~RooExtendPdf() override ;
Expand Down
25 changes: 24 additions & 1 deletion roofit/roofitcore/src/RooExtendPdf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ RooExtendPdf::RooExtendPdf() : _rangeName(0)
/// \param[in] rangeName If given, the number of events denoted by `norm` is interpreted as
/// the number of events in this range only
RooExtendPdf::RooExtendPdf(const char *name, const char *title, RooAbsPdf& pdf,
RooAbsReal& norm, const char* rangeName) :
RooAbsReal& norm, const char* rangeName) :
RooAbsPdf(name,title),
_pdf("pdf", "PDF", this, pdf),
_n("n","Normalization",this,norm),
Expand All @@ -81,6 +81,29 @@ RooExtendPdf::RooExtendPdf(const char *name, const char *title, RooAbsPdf& pdf,
setPlotLabel(_pdf->getPlotLabel()) ;
}

/// Constructor. The ExtendPdf behaves identical to the supplied input pdf,
/// but adds an extended likelihood term. expectedEvents() will return
/// `norm` if `rangeName` remains empty. If `rangeName` is not empty,
/// `norm` will refer to this range, and expectedEvents will return the
/// total number of events over the full range of the observables.
/// \param[in] name Name of the pdf
/// \param[in] title Title of the pdf (for plotting)
/// \param[in] pdf The pdf to be extended
/// \param[in] norm Expected number of events
/// \param[in] rangeName If given, the number of events denoted by `norm` is interpreted as
/// the number of events in this range only
RooExtendPdf::RooExtendPdf(const char *name, const char *title, RooAbsPdf& pdf,
double norm, const char* rangeName) :
RooAbsPdf(name,title),
_pdf("pdf", "PDF", this, pdf),
_n("n","Normalization",this,*new RooRealVar(TString::Format("%s_norm",name),TString::Format("%s_norm",title),norm),true, false, true),
_rangeName(RooNameReg::ptr(rangeName))
{
// Copy various setting from pdf
setUnit(_pdf->getUnit()) ;
setPlotLabel(_pdf->getPlotLabel()) ;
}



RooExtendPdf::RooExtendPdf(const RooExtendPdf& other, const char* name) :
Expand Down

0 comments on commit b243b04

Please sign in to comment.