|
ROOT
Reference Guide |
|
Go to the documentation of this file.
114 if (clippedValPtr) *clippedValPtr=clippedValue ;
129 <<
" out of range (" <<
getMin() <<
" - " <<
getMax() <<
")" << endl ;
163 inRange(newValue,0,&clipValue) ;
208 return frame(cmdList) ;
220 pc.defineDouble(
"min",
"Range",0,
getMin()) ;
221 pc.defineDouble(
"max",
"Range",1,
getMax()) ;
222 pc.defineInt(
"nbins",
"Bins",0,
getBins()) ;
223 pc.defineString(
"rangeName",
"RangeWithName",0,
"") ;
224 pc.defineString(
"name",
"Name",0,
"") ;
225 pc.defineString(
"title",
"Title",0,
"") ;
226 pc.defineMutex(
"Range",
"RangeWithName",
"AutoRange") ;
227 pc.defineObject(
"rangeData",
"AutoRange",0,0) ;
228 pc.defineDouble(
"rangeMargin",
"AutoRange",0,0.1) ;
229 pc.defineInt(
"rangeSym",
"AutoRange",0,0) ;
232 pc.process(cmdList) ;
239 if (
pc.hasProcessed(
"Range")) {
240 xmin =
pc.getDouble(
"min") ;
241 xmax =
pc.getDouble(
"max") ;
246 }
else if (
pc.hasProcessed(
"RangeWithName")) {
247 const char* rangeName=
pc.getString(
"rangeName",0,
kTRUE) ;
250 }
else if (
pc.hasProcessed(
"AutoRange")) {
251 auto rangeData =
static_cast<RooAbsData*
>(
pc.getObject(
"rangeData")) ;
257 if (
pc.getInt(
"rangeSym")==0) {
269 xmin = dmean-ddelta ;
270 xmax = dmean+ddelta ;
279 Int_t nbins =
pc.getInt(
"nbins") ;
281 const char* title =
pc.getString(
"title",0,
kTRUE) ;
305 return new RooPlot(*
this,xlo,xhi,nbins);
335 coutE(
InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: empty fit range, must specify plot range" << endl ;
339 coutE(
InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: open ended fit range, must specify plot range" << endl ;
360 coutE(
InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: empty fit range, must specify plot range" << endl ;
364 coutE(
InputArguments) <<
"RooAbsRealLValue::frame(" <<
GetName() <<
") ERROR: open ended fit range, must specify plot range" << endl ;
389 os <<
indent <<
"--- RooAbsRealLValue ---" << endl;
392 os <<
indent <<
" Fit range is [ ";
394 os <<
getMin() << unit <<
" , ";
400 os <<
getMax() << unit <<
" ]" << endl;
403 os <<
"+INF ]" << endl;
436 if (ibin<0 || ibin>=
numBins(rangeName)) {
438 <<
" is out of range (0," <<
getBins(rangeName)-1 <<
")" << endl ;
506 const double val =
getVal() ;
509 const auto minMax =
getRange(
nullptr);
510 return minMax.first -
epsilon <= val && val <= minMax.second +
epsilon;
514 return std::any_of(ranges.begin(), ranges.end(), [val,
epsilon,
this](
const std::string& range){
515 const auto minMax = this->getRange(range.c_str());
516 return minMax.first - epsilon <= val && val <= minMax.second + epsilon;
554 return createHistogram(
name,
l) ;
573 pc.defineObject(
"xbinning",
"Binning",0,0) ;
574 pc.defineString(
"xbinningName",
"BinningName",0,
"") ;
575 pc.defineInt(
"nxbins",
"BinningSpec",0) ;
576 pc.defineDouble(
"xlo",
"BinningSpec",0,0) ;
577 pc.defineDouble(
"xhi",
"BinningSpec",1,0) ;
579 pc.defineObject(
"yvar",
"YVar",0,0) ;
580 pc.defineObject(
"ybinning",
"YVar::Binning",0,0) ;
581 pc.defineString(
"ybinningName",
"YVar::BinningName",0,
"") ;
582 pc.defineInt(
"nybins",
"YVar::BinningSpec",0) ;
583 pc.defineDouble(
"ylo",
"YVar::BinningSpec",0,0) ;
584 pc.defineDouble(
"yhi",
"YVar::BinningSpec",1,0) ;
586 pc.defineObject(
"zvar",
"ZVar",0,0) ;
587 pc.defineObject(
"zbinning",
"ZVar::Binning",0,0) ;
588 pc.defineString(
"zbinningName",
"ZVar::BinningName",0,
"") ;
589 pc.defineInt(
"nzbins",
"ZVar::BinningSpec",0) ;
590 pc.defineDouble(
"zlo",
"ZVar::BinningSpec",0,0) ;
591 pc.defineDouble(
"zhi",
"ZVar::BinningSpec",1,0) ;
593 pc.defineString(
"axisLabel",
"AxisLabel",0,
"Events") ;
595 pc.defineDependency(
"ZVar",
"YVar") ;
598 pc.process(cmdList) ;
604 const char* axisLabel =
pc.getString(
"axisLabel") ;
611 if (
pc.hasProcessed(
"Binning")) {
613 }
else if (
pc.hasProcessed(
"BinningName")) {
615 }
else if (
pc.hasProcessed(
"BinningSpec")) {
619 ownBinning[0] =
kTRUE ;
624 if (
pc.hasProcessed(
"YVar")) {
627 if (
pc.hasProcessed(
"YVar::Binning")) {
629 }
else if (
pc.hasProcessed(
"YVar::BinningName")) {
631 }
else if (
pc.hasProcessed(
"YVar::BinningSpec")) {
635 ownBinning[1] =
kTRUE ;
641 if (
pc.hasProcessed(
"ZVar")) {
644 if (
pc.hasProcessed(
"ZVar::Binning")) {
646 }
else if (
pc.hasProcessed(
"ZVar::BinningName")) {
648 }
else if (
pc.hasProcessed(
"ZVar::BinningSpec")) {
652 ownBinning[2] =
kTRUE ;
661 if (ownBinning[0])
delete binning[0] ;
662 if (ownBinning[1])
delete binning[1] ;
663 if (ownBinning[2])
delete binning[2] ;
682 <<
") ERROR: fit range empty or open ended, must explicitly specify range" << endl ;
738 if ((!xlo && xhi) || (xlo && !xhi)) {
740 <<
") ERROR must specify either no range, or both limits" << endl ;
750 Int_t *nBins2 = nBins;
756 <<
") ERROR: fit range empty or open ended, must explicitly specify range" << endl ;
761 <<
") ERROR: fit range of " << yvar.
GetName() <<
" empty or open ended, must explicitly specify range" << endl ;
768 xlo_fit[1] = yvar.
getMin() ;
769 xhi_fit[1] = yvar.
getMax() ;
777 nbins_fit[1] = yvar.
getBins() ;
812 if ((!xlo && xhi) || (xlo && !xhi)) {
814 <<
") ERROR must specify either no range, or both limits" << endl ;
824 Int_t* nBins2 = nBins;
829 <<
") ERROR: fit range empty or open ended, must explicitly specify range" << endl ;
834 <<
") ERROR: fit range of " << yvar.
GetName() <<
" empty or open ended, must explicitly specify range" << endl ;
839 <<
") ERROR: fit range of " << zvar.
GetName() <<
" empty or open ended, must explicitly specify range" << endl ;
846 xlo_fit[1] = yvar.
getMin() ;
847 xhi_fit[1] = yvar.
getMax() ;
849 xlo_fit[2] = zvar.
getMin() ;
850 xhi_fit[2] = zvar.
getMax() ;
858 nbins_fit[1] = yvar.
getBins() ;
859 nbins_fit[2] = zvar.
getBins() ;
898 if (bin[0])
delete bin[0] ;
899 if (bin[1])
delete bin[1] ;
900 if (bin[2])
delete bin[2] ;
917 if(dim < 1 || dim > 3) {
928 for(index= 0; index < dim; index++) {
939 histTitle.
Prepend(
"Histogram of ");
945 if (bins[0]->isUniform()) {
954 if (bins[0]->isUniform() && bins[1]->isUniform()) {
965 if (bins[0]->isUniform() && bins[1]->isUniform() && bins[2]->isUniform()) {
984 for(index= 0; index < dim; index++) {
1003 if((0 != tAxisLabel) && (0 != strlen(tAxisLabel))) {
1004 TString axisTitle(tAxisLabel);
1005 axisTitle.
Append(
" / ( ");
1006 for(
Int_t index2= 0; index2 < dim; index2++) {
1008 if(index2 > 0) axisTitle.
Append(
" x ");
1010 if(strlen(xyz[index2]->
getUnit())) {
std::pair< double, double > getRange(const char *name=0) const
Get low and high bound of the variable.
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 Bool_t inRange(const char *name) const
Check if current value is inside range with given name.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Int_t numBins() const
Return number of bins.
RooAbsData is the common abstract base class for binned and unbinned datasets.
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
TString & Prepend(const char *cs)
virtual Double_t highBound() const =0
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write object contents to given stream.
2-D histogram with a float per channel (see TH1 documentation)}
const char * Data() const
virtual ~RooAbsRealLValue()
Destructor.
char * Form(const char *fmt,...)
virtual void setValFast(Double_t value)
RooArgList is a container object that can hold multiple RooAbsArg objects.
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
virtual Double_t averageBinWidth() const =0
RooAbsRealLValue & operator=(const RooAbsRealLValue &)=default
static constexpr double pc
static void indent(ostringstream &buf, int indent_level)
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Bool_t hasMax(const char *name=0) const
Check if variable has an upper bound.
virtual void SetXTitle(const char *title)
virtual void SetYTitle(const char *title)
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
virtual void SetZTitle(const char *title)
virtual Double_t * array() const =0
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
virtual Double_t binCenter(Int_t bin) const =0
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from given stream.
virtual Bool_t isJacobianOK(const RooArgSet &depList) const
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...
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
virtual Int_t numBins(const char *rangeName=0) const
void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)
Copy cache of another RooAbsArg to our cache.
RooPlot * frame() const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
const Text_t * getUnit() const
static Int_t isInfinite(Double_t x)
Return true if x is infinite by RooNumBer internal specification.
TString & Append(const char *cs)
TString getTitle(Bool_t appendUnit=kFALSE) const
Return this variable's title string.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
void SetName(const char *name)
Set the name of the RooPlot to 'name'.
A RooPlot is a plot frame and a container for graphics objects within that frame.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual void Add(TObject *arg)
3-D histogram with a float per channel (see TH1 documentation)}
std::vector< std::string > tokenise(const std::string &str, const std::string &delims, bool returnEmptyToken=true)
Tokenise the string by splitting at the characters in delims.
Bool_t hasMin(const char *name=0) const
Check if variable has a lower bound.
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...
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
1-D histogram with a float per channel (see TH1 documentation)}
Mother of all ROOT objects.
TH1 is the base class of all histogram classes in ROOT.
virtual void randomize(const char *rangeName=0)
Set a new value sampled from a uniform distribution over the fit range.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
virtual Int_t getBins(const char *name=0) const
Get number of bins of currently defined range.
Abstract base class for objects that are lvalues, i.e.
virtual const char * GetName() const
Returns name of object.
virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const
Check if given value is valid.
RooRealVar represents a variable that can be changed from the outside.
virtual void setVal(Double_t value)=0
Set the current value of the object. Needs to be overridden by implementations.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
static Double_t uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
virtual Double_t lowBound() const =0
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
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.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
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...
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