115 if (clippedValPtr) *clippedValPtr=clippedValue ;
122 if(rangeName.empty()) {
127 const double min = binning.
lowBound() ;
132 for(std::size_t i = 0; i < values.size(); ++i) {
133 out[i] = out[i] & ((infiniteMax | (values[i] <= (max+1
e-6))) && (infiniteMin | (values[i] >= (min-1
e-6))));
146 coutI(InputArguments) <<
"RooRealVar::isValid(" <<
GetName() <<
"): value " << value
147 <<
" out of range (" <<
getMin() <<
" - " <<
getMax() <<
")" << endl ;
181 inRange(newValue,0,&clipValue) ;
226 return frame(cmdList) ;
244 pc.
defineMutex(
"Range",
"RangeWithName",
"AutoRange") ;
247 pc.
defineInt(
"rangeSym",
"AutoRange",0,0) ;
275 if (pc.
getInt(
"rangeSym")==0) {
287 xmin = dmean-ddelta ;
288 xmax = dmean+ddelta ;
323 return new RooPlot(*
this,xlo,xhi,nbins);
353 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: empty fit range, must specify plot range" << endl ;
357 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: open ended fit range, must specify plot range" << endl ;
378 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: empty fit range, must specify plot range" << endl ;
382 coutE(InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: open ended fit range, must specify plot range" << endl ;
407 os <<
indent <<
"--- RooAbsRealLValue ---" << endl;
410 os <<
indent <<
" Fit range is [ ";
412 os <<
getMin() << unit <<
" , ";
418 os <<
getMax() << unit <<
" ]" << endl;
421 os <<
"+INF ]" << endl;
441 coutE(Generation) <<
fName <<
"::" <<
ClassName() <<
":randomize: fails with unbounded fit range" << endl;
454 if (ibin<0 || ibin>=
numBins(rangeName)) {
455 coutE(InputArguments) <<
"RooAbsRealLValue::setBin(" <<
GetName() <<
") ERROR: bin index " << ibin
456 <<
" is out of range (0," <<
getBins(rangeName)-1 <<
")" << endl ;
524 const double val =
getVal() ;
525 const double epsilon = 1
e-8 * fabs(val) ;
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") ;
637 ownBinning[0] =
kTRUE ;
653 ownBinning[1] =
kTRUE ;
670 ownBinning[2] =
kTRUE ;
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 ;
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() ;
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() ;
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((
TObject*)0,InputArguments) <<
"RooAbsReal::createHistogram: dimension not supported: " << dim << endl;
946 for(index= 0; index < dim; index++) {
950 oocoutE((
TObject*)0,InputArguments) <<
"RooAbsRealLValue::createHistogram: variable is not real lvalue: " << arg->
GetName() << endl;
957 histTitle.
Prepend(
"Histogram of ");
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((
TObject*)0,InputArguments) <<
"RooAbsReal::createHistogram: unable to create a new histogram" << endl;
1002 for(index= 0; index < dim; index++) {
1021 if((0 != 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)
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
virtual Double_t * array() const =0
Int_t numBins() const
Return number of bins.
virtual Double_t highBound() const =0
virtual Double_t binCenter(Int_t bin) const =0
virtual Double_t lowBound() const =0
virtual Double_t averageBinWidth() const =0
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Bool_t getRange(const RooAbsRealLValue &var, Double_t &lowest, Double_t &highest, Double_t marginFrac=0, Bool_t symMode=kFALSE) 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...
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
Bool_t hasMax(const char *name=0) const
Check if variable has an upper bound.
void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)
Copy cache of another RooAbsArg to our cache.
virtual const RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const =0
Retrive binning configuration with given name or default binning.
std::pair< double, double > getRange(const char *name=0) const
Get low and high bound of the variable.
virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const
Check if given value is valid.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
virtual void setBin(Int_t ibin, const char *rangeName=0)
Set value to center of bin 'ibin' of binning 'rangeName' (or of default binning if no range is specif...
virtual void setVal(Double_t value)=0
Set the current value of the object. Needs to be overridden by implementations.
virtual Int_t numBins(const char *rangeName=0) const
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from given stream.
virtual void randomize(const char *rangeName=0)
Set a new value sampled from a uniform distribution over the fit range.
RooPlot * frame() const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write object contents to given stream.
virtual Bool_t inRange(const char *name) const
Check if current value is inside range with given name.
virtual Bool_t isJacobianOK(const RooArgSet &depList) const
virtual Int_t getBins(const char *name=0) const
Get number of bins of currently defined range.
virtual void setValFast(Double_t value)
RooAbsReal * createIntegral(const RooArgSet &iset, const RooArgSet *nset=nullptr, const RooNumIntConfig *cfg=nullptr, const char *rangeName=nullptr) const
Create an object that represents the integral of the function over one or more observables listed in ...
RooAbsRealLValue & operator=(const RooAbsRealLValue &)=default
Bool_t hasMin(const char *name=0) const
Check if variable has a lower bound.
virtual ~RooAbsRealLValue()
Destructor.
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
TH1 * createHistogram(const char *name, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Bool_t fitRangeOKForPlotting() const
Check if fit range is usable as plot range, i.e.
virtual void setBinFast(Int_t ibin, const RooAbsBinning &binning)
Set value to center of bin 'ibin' of binning 'rangeName' (or of default binning if no range is specif...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
TString getTitle(Bool_t appendUnit=kFALSE) const
Return this variable's title string.
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)
Copy the cached value of another RooAbsArg to our cache.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
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.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
TObject * getObject(const char *name, TObject *obj=0)
Return TObject property registered with name 'name'.
Bool_t defineInt(const char *name, const char *argName, Int_t intNum, Int_t defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
void defineMutex(const char *argName1, const char *argName2)
Define arguments named argName1 and argName2 mutually exclusive.
Bool_t defineObject(const char *name, const char *argName, Int_t setNum, const TObject *obj=0, Bool_t isArray=kFALSE)
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_t convEmptyToNull=kFALSE)
Return string property registered with name 'name'.
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
Bool_t defineDouble(const char *name, const char *argName, Int_t doubleNum, Double_t defValue=0.)
Define Double_t property name 'name' mapped to Double_t in slot 'doubleNum' in RooCmdArg with name ar...
void defineDependency(const char *refArgName, const char *neededArgName)
Define that processing argument name refArgName requires processing of argument named neededArgName t...
Double_t getDouble(const char *name, Double_t defaultValue=0)
Return Double_t property registered with name 'name'.
Bool_t defineString(const char *name, const char *argName, Int_t stringNum, const char *defValue="", Bool_t appendMode=kFALSE)
Define Double_t property name 'name' mapped to Double_t in slot 'stringNum' in RooCmdArg with name ar...
Bool_t ok(Bool_t verbose) const
Return true of parsing was successful.
Bool_t process(const RooCmdArg &arg)
Process given RooCmdArg.
Bool_t hasProcessed(const char *cmdName) const
Return true if RooCmdArg with name 'cmdName' has been processed.
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 Int_t isInfinite(Double_t 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 SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
void SetName(const char *name)
Set the name of the RooPlot to 'name'.
static Double_t 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)}
virtual const char * GetName() const
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.