106 double clippedValue(
value);
107 bool isInRange(
true) ;
126 if (clippedValPtr) *clippedValPtr=clippedValue ;
135 if(rangeName.empty()) {
140 const double min = binning.
lowBound() ;
149 for(std::size_t i = 0; i < values.size(); ++i) {
150 const double eps = std::max(epsRel * std::abs(values[i]), epsAbs);
151 out[i] = out[i] && ((infiniteMax | (values[i] <= (max+eps))) && (infiniteMin | (values[i] >= (min-eps))));
164 coutI(InputArguments) <<
"RooRealVar::isValid(" <<
GetName() <<
"): value " <<
value
165 <<
" out of range (" <<
getMin() <<
" - " <<
getMax() <<
")" << endl ;
199 inRange(newValue,
nullptr,&clipValue) ;
234 return frame(cmdList) ;
252 pc.
defineMutex(
"Range",
"RangeWithName",
"AutoRange") ;
255 pc.
defineInt(
"rangeSym",
"AutoRange",0,0) ;
273 const char* rangeName=pc.
getString(
"rangeName",
nullptr,
true) ;
283 if (pc.
getInt(
"rangeSym")==0) {
293 double dmean = rangeData->moment((
RooRealVar&)*
this,1) ;
295 xmin = dmean-ddelta ;
296 xmax = dmean+ddelta ;
307 const char* title = pc.
getString(
"title",
nullptr,
true) ;
331 return new RooPlot(*
this,xlo,xhi,nbins);
361 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: empty fit range, must specify plot range" << endl ;
365 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: open ended fit range, must specify plot range" << endl ;
386 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: empty fit range, must specify plot range" << endl ;
390 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: open ended fit range, must specify plot range" << endl ;
415 os <<
indent <<
"--- RooAbsRealLValue ---" << endl;
418 os <<
indent <<
" Fit range is [ ";
420 os <<
getMin() << unit <<
" , ";
426 os <<
getMax() << unit <<
" ]" << endl;
429 os <<
"+INF ]" << endl;
449 coutE(Generation) <<
fName <<
"::" <<
ClassName() <<
":randomize: fails with unbounded fit range" << endl;
462 if (ibin<0 || ibin>=
numBins(rangeName)) {
463 coutE(InputArguments) <<
"RooAbsRealLValue::setBin(" <<
GetName() <<
") ERROR: bin index " << ibin
464 <<
" is out of range (0," <<
getBins(rangeName)-1 <<
")" << endl ;
524 const double val =
getVal() ;
527 const auto minMax =
getRange(
nullptr);
528 return minMax.first -
epsilon <= val && val <= minMax.second +
epsilon;
532 return std::any_of(ranges.begin(), ranges.end(), [val,
epsilon,
this](
const std::string& range){
533 const auto minMax = this->getRange(range.c_str());
534 return minMax.first - epsilon <= val && val <= minMax.second + epsilon;
572 return createHistogram(
name,
l) ;
599 pc.
defineString(
"ybinningName",
"YVar::BinningName",0,
"") ;
600 pc.
defineInt(
"nybins",
"YVar::BinningSpec",0) ;
606 pc.
defineString(
"zbinningName",
"ZVar::BinningName",0,
"") ;
607 pc.
defineInt(
"nzbins",
"ZVar::BinningSpec",0) ;
622 const char* axisLabel = pc.
getString(
"axisLabel") ;
624 bool ownBinning[3] = {
false,
false,
false } ;
637 ownBinning[0] = true ;
653 ownBinning[1] = true ;
670 ownBinning[2] = true ;
679 if (ownBinning[0])
delete binning[0] ;
680 if (ownBinning[1])
delete binning[1] ;
681 if (ownBinning[2])
delete binning[2] ;
699 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
700 <<
") ERROR: fit range empty or open ended, must explicitly specify range" << endl ;
754 double* xlo,
double* xhi,
Int_t* nBins)
const
756 if ((!xlo && xhi) || (xlo && !xhi)) {
757 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
758 <<
") ERROR must specify either no range, or both limits" << endl ;
768 Int_t *nBins2 = nBins;
773 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
774 <<
") ERROR: fit range empty or open ended, must explicitly specify range" << endl ;
778 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
779 <<
") ERROR: fit range of " << yvar.
GetName() <<
" empty or open ended, must explicitly specify range" << endl ;
786 xlo_fit[1] = yvar.
getMin() ;
787 xhi_fit[1] = yvar.
getMax() ;
795 nbins_fit[1] = yvar.
getBins() ;
828 const char *tAxisLabel,
double* xlo,
double* xhi,
Int_t* nBins)
const
830 if ((!xlo && xhi) || (xlo && !xhi)) {
831 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
832 <<
") ERROR must specify either no range, or both limits" << endl ;
842 Int_t* nBins2 = nBins;
846 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
847 <<
") ERROR: fit range empty or open ended, must explicitly specify range" << endl ;
851 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
852 <<
") ERROR: fit range of " << yvar.
GetName() <<
" empty or open ended, must explicitly specify range" << endl ;
856 coutE(InputArguments) <<
"RooAbsRealLValue::createHistogram(" <<
GetName()
857 <<
") ERROR: fit range of " << zvar.
GetName() <<
" empty or open ended, must explicitly specify range" << endl ;
864 xlo_fit[1] = yvar.
getMin() ;
865 xhi_fit[1] = yvar.
getMax() ;
867 xlo_fit[2] = zvar.
getMin() ;
868 xhi_fit[2] = zvar.
getMax() ;
876 nbins_fit[1] = yvar.
getBins() ;
877 nbins_fit[2] = zvar.
getBins() ;
906 double* xlo,
double* xhi,
Int_t* nBins)
916 if (bin[0])
delete bin[0] ;
917 if (bin[1])
delete bin[1] ;
918 if (bin[2])
delete bin[2] ;
935 if(dim < 1 || dim > 3) {
936 oocoutE(
nullptr,InputArguments) <<
"RooAbsReal::createHistogram: dimension not supported: " << dim << endl;
950 oocoutE(
nullptr,InputArguments) <<
"RooAbsRealLValue::createHistogram: variable is not real lvalue: " << arg->
GetName() << endl;
957 histTitle.
Prepend(
"Histogram of ");
960 TH1 *histogram =
nullptr;
963 if (bins[0]->isUniform()) {
972 if (bins[0]->isUniform() && bins[1]->isUniform()) {
983 if (bins[0]->isUniform() && bins[1]->isUniform() && bins[2]->isUniform()) {
997 oocoutE(
nullptr,InputArguments) <<
"RooAbsReal::createHistogram: unable to create a new histogram" << endl;
1021 if((
nullptr != tAxisLabel) && (0 != strlen(tAxisLabel))) {
1022 TString axisTitle(tAxisLabel);
1023 axisTitle.
Append(
" / ( ");
1024 for(
Int_t index2= 0; index2 < dim; index2++) {
1026 if(index2 > 0) axisTitle.
Append(
" x ");
1028 if(strlen(xyz[index2]->
getUnit())) {
1066 std::stringstream errStream;
1067 errStream <<
"Attempting to integrate the " <<
ClassName() <<
" \"" <<
GetName()
1068 <<
"\", but integrating a RooAbsRealLValue is not allowed!";
1069 const std::string errString = errStream.str();
1070 coutE(InputArguments) << errString << std::endl;
1071 throw std::runtime_error(errString);
static void indent(ostringstream &buf, int indent_level)
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.
RooAbsBinning is the 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
Int_t getSize() const
Return the number of elements in the collection.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Abstract base class for binned and unbinned datasets.
bool getRange(const RooAbsRealLValue &var, double &lowest, double &highest, double marginFrac=0.0, bool symMode=false) const
Fill Doubles 'lowest' and 'highest' with the lowest and highest value of observable 'var' in this dat...
Abstract base class for objects that are lvalues, i.e.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
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)
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.
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.
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 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.
~RooAbsRealLValue() override
Destructor.
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 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...
Class RooCmdConfig is a 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'.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
virtual void Add(TObject *arg)
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
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.
A RooPlot is a plot frame and a container for graphics objects within that frame.
void SetName(const char *name) override
Set the name of the RooPlot to 'name'.
void SetTitle(const char *name) override
Set the title of the RooPlot to 'title'.
static double uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
RooRealVar represents a 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.
virtual void SetXTitle(const char *title)
virtual void SetZTitle(const char *title)
virtual void SetYTitle(const char *title)
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...