58using std::endl, std::istream, std::ostream;
96 bool isInRange(
true) ;
129 const double min = binning.
lowBound() ;
138 for(std::size_t i = 0; i < values.size(); ++i) {
139 const double eps = std::max(epsRel * std::abs(values[i]), epsAbs);
140 out[i] = out[i] && ((
infiniteMax | (values[i] <= (max+eps))) && (
infiniteMin | (values[i] >= (min-eps))));
153 coutI(InputArguments) <<
"RooRealVar::isValid(" <<
GetName() <<
"): value " <<
value <<
" out of range ("
242 pc.
defineMutex(
"Range",
"RangeWithName",
"AutoRange") ;
245 pc.
defineInt(
"rangeSym",
"AutoRange",0,0) ;
274 if (pc.
getInt(
"rangeSym")==0) {
298 const char* title = pc.
getString(
"title",
nullptr,
true) ;
322 return new RooPlot(*
this,xlo,xhi,nbins);
352 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: empty fit range, must specify plot range" << std::endl ;
356 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: open ended fit range, must specify plot range" << std::endl ;
377 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: empty fit range, must specify plot range" << std::endl ;
381 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: open ended fit range, must specify plot range" << std::endl ;
406 os <<
indent <<
"--- RooAbsRealLValue ---" << std::endl;
409 os <<
indent <<
" Fit range is [ ";
411 os <<
getMin() << unit <<
" , ";
417 os <<
getMax() << unit <<
" ]" << std::endl;
420 os <<
"+INF ]" << std::endl;
440 coutE(Generation) <<
fName <<
"::" <<
ClassName() <<
":randomize: fails with unbounded fit range" << std::endl;
454 coutE(InputArguments) <<
"RooAbsRealLValue::setBin(" <<
GetName() <<
") ERROR: bin index " <<
ibin
515 const double val =
getVal() ;
519 return minMax.first - epsilon <= val && val <=
minMax.second + epsilon;
523 return std::any_of(ranges.begin(), ranges.end(), [val,epsilon,
this](
const std::string&
range){
524 const auto minMax = this->getRange(range.c_str());
525 return minMax.first - epsilon <= val && val <= minMax.second + epsilon;
563 return createHistogram(
name,
l) ;
590 pc.
defineString(
"ybinningName",
"YVar::BinningName",0,
"") ;
591 pc.
defineInt(
"nybins",
"YVar::BinningSpec",0) ;
597 pc.
defineString(
"zbinningName",
"ZVar::BinningName",0,
"") ;
598 pc.
defineInt(
"nzbins",
"ZVar::BinningSpec",0) ;
615 bool ownBinning[3] = {
false,
false,
false } ;
639 binning[1] = &
yvar.getBinning(pc.
getString(
"ybinningName",
nullptr,
true)) ;
646 binning[1] = &
yvar.getBinning() ;
656 binning[2] = &
zvar.getBinning(pc.
getString(
"zbinningName",
nullptr,
true)) ;
663 binning[2] = &
zvar.getBinning() ;
690 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
691 <<
") ERROR: fit range empty or open ended, must explicitly specify range" << std::endl ;
745 double* xlo,
double* xhi,
Int_t* nBins)
const
747 if ((!xlo && xhi) || (xlo && !xhi)) {
748 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
749 <<
") ERROR must specify either no range, or both limits" << std::endl ;
764 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
765 <<
") ERROR: fit range empty or open ended, must explicitly specify range" << std::endl ;
768 if (!
yvar.fitRangeOKForPlotting()) {
769 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
770 <<
") ERROR: fit range of " <<
yvar.GetName() <<
" empty or open ended, must explicitly specify range" << std::endl ;
821 if ((!xlo && xhi) || (xlo && !xhi)) {
822 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
823 <<
") ERROR must specify either no range, or both limits" << std::endl ;
837 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
838 <<
") ERROR: fit range empty or open ended, must explicitly specify range" << std::endl ;
841 if (!
yvar.fitRangeOKForPlotting()) {
842 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
843 <<
") ERROR: fit range of " <<
yvar.GetName() <<
" empty or open ended, must explicitly specify range" << std::endl ;
846 if (!
zvar.fitRangeOKForPlotting()) {
847 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
848 <<
") ERROR: fit range of " <<
zvar.GetName() <<
" empty or open ended, must explicitly specify range" << std::endl ;
897 double* xlo,
double* xhi,
Int_t* nBins)
907 if (bin[0])
delete bin[0] ;
908 if (bin[1])
delete bin[1] ;
909 if (bin[2])
delete bin[2] ;
927 oocoutE(
nullptr,InputArguments) <<
"RooAbsReal::createHistogram: dimension not supported: " << dim << std::endl;
941 oocoutE(
nullptr,InputArguments) <<
"RooAbsRealLValue::createHistogram: variable is not real lvalue: " << arg->
GetName() << std::endl;
954 if (bins[0]->isUniform()) {
963 if (bins[0]->isUniform() && bins[1]->isUniform()) {
974 if (bins[0]->isUniform() && bins[1]->isUniform() && bins[2]->isUniform()) {
988 oocoutE(
nullptr,InputArguments) <<
"RooAbsReal::createHistogram: unable to create a new histogram" << std::endl;
1059 <<
"\", but integrating a RooAbsRealLValue is not allowed!";
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.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Abstract base class for RooRealVar binning definitions.
virtual double binCenter(Int_t bin) const =0
Int_t numBins() const
Return number of bins.
virtual double averageBinWidth() const =0
virtual double highBound() const =0
virtual double lowBound() const =0
virtual double * array() const =0
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
Abstract base class for binned and unbinned datasets.
Abstract base class for objects that are lvalues, i.e.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Int_t numBins(const char *rangeName=nullptr) const override
virtual Int_t getBins(const char *name=nullptr) const
Get number of bins of currently defined range.
RooFit::OwningPtr< RooAbsReal > createIntegral(const RooArgSet &iset, const RooArgSet *nset=nullptr, const RooNumIntConfig *cfg=nullptr, const char *rangeName=nullptr) const override
Create an object that represents the integral of the function over one or more observables listed in ...
virtual void setValFast(double value)
RooPlot * frame(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 a new RooPlot on the heap with a drawing frame initialized for this object,...
bool isValidReal(double value, bool printError=false) const override
Check if given value is valid.
virtual const RooAbsBinning & getBinning(const char *name=nullptr, bool verbose=true, bool createOnTheFly=false) const =0
Retrieve binning configuration with given name or default binning.
TH1 * createHistogram(const char *name, 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
virtual bool isJacobianOK(const RooArgSet &depList) const
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
RooPlot * frame() const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
bool hasMax(const char *name=nullptr) const
Check if variable has an upper bound.
void copyCache(const RooAbsArg *source, bool valueOnly=false, bool setValDirty=true) override
Copy cache of another RooAbsArg to our cache.
bool fitRangeOKForPlotting() const
Check if fit range is usable as plot range, i.e.
void setBin(Int_t ibin, const char *rangeName=nullptr) override
Set value to center of bin 'ibin' of binning 'rangeName' (or of default binning if no range is specif...
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to given stream.
void randomize(const char *rangeName=nullptr) override
Set a new value sampled from a uniform distribution over the fit range.
virtual void setVal(double value)=0
Set the current value of the object. Needs to be overridden by implementations.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
bool readFromStream(std::istream &is, bool compact, bool verbose=false) override
Read object contents from given stream.
bool inRange(const char *name) const override
Check if current value is inside range with given name.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Structure printing.
std::pair< double, double > getRange(const char *name=nullptr) const
Get low and high bound of the variable.
virtual RooAbsArg & operator=(double newValue)
Assignment operator from a double.
bool hasMin(const char *name=nullptr) const
Check if variable has a lower bound.
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.
TString _unit
Unit for objects value.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Structure printing.
void copyCache(const RooAbsArg *source, bool valueOnly=false, bool setValDirty=true) override
Copy the cached value of another RooAbsArg to our cache.
double _value
Cache for current value of object.
TString getTitle(bool appendUnit=false) const
Return this variable's title string.
const Text_t * getUnit() const
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.
Named container for two doubles, two integers two object points and three string pointers that can be...
Configurable parser for RooCmdArg named arguments.
void defineMutex(const char *head, Args_t &&... tail)
Define arguments where any pair is mutually exclusive.
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
bool hasProcessed(const char *cmdName) const
Return true if RooCmdArg with name 'cmdName' has been processed.
double getDouble(const char *name, double defaultValue=0.0) const
Return double property registered with name 'name'.
void defineDependency(const char *refArgName, const char *neededArgName)
Define that processing argument name refArgName requires processing of argument named neededArgName t...
bool defineDouble(const char *name, const char *argName, int doubleNum, double defValue=0.0)
Define double property name 'name' mapped to double in slot 'doubleNum' in RooCmdArg with name argNam...
bool ok(bool verbose) const
Return true of parsing was successful.
bool defineObject(const char *name, const char *argName, int setNum, const TObject *obj=nullptr, bool isArray=false)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
const char * getString(const char *name, const char *defaultValue="", bool convEmptyToNull=false) const
Return string property registered with name 'name'.
bool defineString(const char *name, const char *argName, int stringNum, const char *defValue="", bool appendMode=false)
Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argNam...
bool defineInt(const char *name, const char *argName, int intNum, int defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
int getInt(const char *name, int defaultValue=0) const
Return integer property registered with name 'name'.
TObject * getObject(const char *name, TObject *obj=nullptr) const
Return TObject property registered with name 'name'.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
static double rangeEpsRel()
Get the relative epsilon that is used by range checks in RooFit, e.g., in RooAbsRealLValue::inRange()...
static double rangeEpsAbs()
Get the absolute epsilon that is used by range checks in RooFit, e.g., in RooAbsRealLValue::inRange()...
static constexpr int isInfinite(double x)
Return true if x is infinite by RooNumber internal specification.
Plot frame and a container for graphics objects within that frame.
static double uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
Variable that can be changed from the outside.
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
2-D histogram with a float per channel (see TH1 documentation)
3-D histogram with a float per channel (see TH1 documentation)
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
const char * Data() const
TString & Prepend(const char *cs)
TString & Append(const char *cs)
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...