60#ifdef ROOFIT_LEGACY_EVAL_BACKEND
65using std::ostream, std::istream, std::list;
85 _actualVars(
"actualVars",
"Variables used by formula expression",
this),
108 _actualVars(
"actualVars",
"Variables used by formula expression",
this),
127 _actualVars(
"actualVars",
this,
other._actualVars),
128 _formExpr(
other._formExpr)
130 for (
auto const &
item :
other._binnings) {
209 os <<
"formula=\"" <<
_formExpr <<
"\" " ;
220 coutE(InputArguments) <<
"RooFormulaVar::readFromStream(" <<
GetName() <<
"): can't read" << std::endl ;
232 std::cout <<
getVal() << std::endl ;
250 coutE(InputArguments) <<
"RooFormulaVar::setBinning(" <<
GetName() <<
") the observable " << obs.
GetName()
251 <<
" is not one of the formula variables of this function, nothing done." << std::endl;
260 std::span<const double> boundaries{binning.
array(),
static_cast<std::size_t
>(binning.
numBoundaries())};
262 coutE(InputArguments) <<
"RooFormulaVar::setBinning(" <<
GetName() <<
") the expression \"" <<
_formExpr
263 <<
"\" is not flat within the given bins of " << obs.
GetName()
264 <<
". The binning is not set. Pass checkFlatness=false to override this check."
327 auto func =
static_cast<const RooAbsReal*
>(par);
330 if (func && (
binb = func->binBoundaries(obs,xlo,xhi)) ) {
353 auto func =
dynamic_cast<const RooAbsReal*
>(par);
356 if (func && (
hint = func->plotSamplingHint(obs,xlo,xhi)) ) {
380#ifdef ROOFIT_LEGACY_EVAL_BACKEND
385 if (
dynamic_cast<RooChi2Var*
>(arg)) {
392 coutI(Minimization) <<
"RooFormulaVar::defaultErrorLevel(" <<
GetName()
393 <<
") Formula contains a RooNLLVar, using its error level" << std::endl ;
394 return nllArg->defaultErrorLevel() ;
396 coutI(Minimization) <<
"RooFormulaVar::defaultErrorLevel(" <<
GetName()
397 <<
") Formula contains a RooChi2Var, using its error level" << std::endl ;
398 return chi2Arg->defaultErrorLevel() ;
400 coutI(Minimization) <<
"RooFormulaVar::defaultErrorLevel(" <<
GetName() <<
") WARNING: "
401 <<
"Formula contains neither RooNLLVar nor RooChi2Var server, using default level of 1.0" << std::endl ;
403 coutI(Minimization) <<
"RooFormulaVar::defaultErrorLevel(" <<
GetName() <<
") WARNING: "
404 <<
"Formula contains BOTH RooNLLVar and RooChi2Var server, using default level of 1.0" << std::endl ;
412 return getFormula().getTFormula()->GetUniqueFuncName().Data();
415std::unique_ptr<RooAbsArg>
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.
RooFit::OwningPtr< RooArgSet > getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
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.
const RooArgSet * nset() const
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
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 printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Structure printing.
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
Function that is called at the end of redirectServers().
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.
void markAsCompiled(RooAbsArg &arg) const
void compileServers(RooAbsArg &arg, RooArgSet const &normSet)
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
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,...