56using std::istream, std::ostream, std::endl;
72 _actualVars(
"actualVars",
"Variables used by PDF expression",
this),
92 _actualVars(
"actualVars",
"Variables used by PDF expression",
this),
111 _actualVars(
"actualVars",
this,
other._actualVars),
112 _formExpr(
other._formExpr)
114 for (
auto const &
item :
other._binnings) {
153 coutE(InputArguments) <<
"RooGenericPdf::setBinning(" <<
GetName() <<
") the observable " << obs.
GetName()
154 <<
" is not one of the formula variables of this pdf, nothing done." << std::endl;
163 std::span<const double> boundaries{binning.
array(),
static_cast<std::size_t
>(binning.
numBoundaries())};
165 coutE(InputArguments) <<
"RooGenericPdf::setBinning(" <<
GetName() <<
") the expression \"" <<
_formExpr
166 <<
"\" is not flat within the given bins of " << obs.
GetName()
167 <<
". The binning is not set. Pass checkFlatness=false to override this check."
280 os <<
" --- RooGenericPdf --- " << std::endl ;
294 os <<
"formula=\"" <<
_formExpr <<
"\" " ;
306 coutE(InputArguments) <<
"RooGenericPdf::readFromStream(" <<
GetName() <<
"): can't read" << std::endl;
317 os <<
getVal() << std::endl ;
325 return formula().getTFormula()->GetUniqueFuncName().Data();
static void indent(ostringstream &buf, int indent_level)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Abstract base class for RooRealVar binning definitions.
virtual Int_t numBoundaries() const =0
virtual double * array() const =0
virtual RooAbsBinning * clone(const char *name=nullptr) const =0
Abstract container object that can hold multiple RooAbsArg objects.
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in the collection.
Abstract interface for all probability density functions.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print multi line detailed information of this RooAbsPdf.
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
Hook function intercepting redirectServer calls.
const RooArgSet * nset() const
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
double _value
Cache for current value of object.
double traceEval(const RooArgSet *set) const
Calculate current value of object, with error tracing wrapper.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
static std::list< double > * plotSamplingHintForBinBoundaries(std::span< const double > boundaries, double xlo, double xhi)
Returns sampling hints for a histogram with given boundaries.
Implementation of a probability density function that takes a RooArgList of servers and a C++ express...
double evaluate() const override
Calculate current value of this object.
~RooGenericPdf() override
bool readFromStream(std::istream &is, bool compact, bool verbose=false) override
Read object contents from given stream.
const RooArgList & dependents() const
void printMetaArgs(std::ostream &os) const override
Add formula expression as meta argument in printing interface.
bool isBinnedDistribution(const RooArgSet &obs) const override
Return true if a binning was set with setBinning() for every observable in the integration set obs.
std::string getUniqueFuncName() const
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to given stream.
std::map< int, std::unique_ptr< RooAbsBinning > > _binnings
User-defined binnings, keyed by the observable's index in _actualVars, for a piecewise-flat distribut...
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Return sampling hints that draw the piecewise-flat shape exactly (a pair of points just left and righ...
std::list< double > * binBoundaries(RooAbsRealLValue &obs, double xlo, double xhi) const override
Return the boundaries of the binning set with setBinning() that fall within [xlo, xhi],...
RooFormula * _formula
! Formula engine
bool removeBinning(const RooAbsRealLValue &obs)
Remove a binning previously declared with setBinning() for observable obs, reverting to the generic n...
RooFormula & formula() const
TString _formExpr
Formula expression string.
void doEval(RooFit::EvalContext &) const override
Base function for computing multiple values of a RooAbsReal.
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Print info about this object to the specified stream.
void setBinning(const RooAbsRealLValue &obs, const RooAbsBinning &binning, bool checkFlatness=true)
Declare that this pdf is piecewise constant (flat) within the bins of the given binning of the observ...
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override
Propagate server changes to embedded formula object.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
const char * Data() const
bool isFunctionFlatInBins(const RooAbsReal &function, RooAbsRealLValue &obs, std::span< const double > boundaries, double relTol=1e-9)
Check that function is constant (flat) inside each bin defined by the sorted boundaries when scanning...
std::list< double > * binBoundariesInRange(std::span< const double > boundaries, double xlo, double xhi)
Return a newly allocated list with the subset of boundaries that lies strictly inside [xlo,...