81 Bool_t showProg) : _showProgress(showProg)
85 TString
name(
f.GetName());
87 TString title(
f.GetTitle());
90 if(0 != strlen(
f.getUnit()) || 0 != strlen(
x.getUnit())) {
92 if(0 != strlen(
f.getUnit())) {
93 title.Append(
f.getUnit());
96 if(0 != strlen(
x.getUnit())) {
98 title.Append(
x.getUnit());
107 funcPtr=
f.bindVars(
x,normVars,
kTRUE);
110 if(scaleFactor != 1) {
114 assert(0 != funcPtr);
118 list<Double_t>* hint =
f.plotSamplingHint(
x,xlo,xhi) ;
119 addPoints(*funcPtr,xlo,xhi,xbins+1,prec,resolution,wmode,nEvalError,doEEVal,eeVal,hint);
130 if(rawPtr)
delete rawPtr;
135 for (i=0 ; i<
GetN() ; i++) {
159 addPoints(func,xlo,xhi,minPoints+1,prec,resolution,wmode,nEvalError,doEEVal,eeVal);
165 for (i=0 ; i<
GetN() ; i++) {
188 deque<Double_t> pointList ;
193 for (i1=0 ; i1<n1 ; i1++) {
195 pointList.push_back(
x) ;
200 for (i2=0 ; i2<n2 ; i2++) {
202 pointList.push_back(
x) ;
206 sort(pointList.begin(),pointList.end()) ;
209 deque<double>::iterator iter ;
211 for (iter=pointList.begin() ; iter!=pointList.end() ; ++iter) {
213 if ((*iter-last)>1
e-10) {
215 addPoint(*iter,scale1*
c1.interpolate(*iter)+scale2*
c2.interpolate(*iter)) ;
257 for (i=1 ; i<
GetN()-1 ; i++) {
260 if (
y<minVal) minVal=
y ;
261 if (
y>maxVal) maxVal=
y ;
265 for (i=1 ; i<
GetN()-1 ; i++) {
295 if(minPoints <= 0 || xhi <= xlo) {
305 minPoints = samplingHint->size() ;
309 Double_t dx= (xhi-xlo)/(minPoints-1.);
314 list<Double_t>* xval = samplingHint ;
316 xval =
new list<Double_t> ;
317 for(step= 0; step < minPoints; step++) {
318 xval->push_back(xlo + step*dx) ;
326 for(list<Double_t>::iterator iter = xval->begin() ; iter!=xval->end() ; ++iter,++step) {
329 if (step==minPoints-1) xx-=1
e-15 ;
331 yval[step]= func(&xx);
349 if (yval[step]>
ymax)
ymax=yval[step] ;
350 if (yval[step]<
ymin)
ymin=yval[step] ;
355 Double_t minDx= resolution*(xhi-xlo);
367 list<Double_t>::iterator iter2 = xval->begin() ;
373 if (iter2==xval->end()) {
381 addRange(func,
x1,
x2,yval[step-1],yval[step],prec*yrangeEst,minDx,numee,doEEVal,eeVal);
388 addPoint(xhi+dx,yval[minPoints-1]) ;
396 if (xval != samplingHint) {
439 if((xmid -
x1 >= minDx) &&
fabs(dy)>0 &&
fabs(dy) >= minDy) {
441 addRange(func,
x1,xmid,y1,ymid,minDy,minDx,numee,doEEVal,eeVal);
442 addRange(func,xmid,
x2,ymid,y2,minDy,minDx,numee,doEEVal,eeVal);
516 os << IsA()->GetName() ;
526 os << indent <<
"--- RooCurve ---" << endl ;
528 os << indent <<
" Contains " <<
n <<
" points" << endl;
529 os << indent <<
" Graph points:" << endl;
530 for(
Int_t i= 0; i <
n; i++) {
531 os << indent << setw(3) << i <<
") x = " <<
fX[i] <<
" , y = " <<
fY[i] << endl;
550#if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
561 for (i=0 ; i<np ; i++) {
567 if (x<xstart || x>xstop) continue ;
579 Double_t pull = (
y>avg) ? ((
y-avg)/eyl) : ((
y-avg)/eyh) ;
586 return chisq / (nbin-nFitParam) ;
599 <<
") invalid range (" << xFirst <<
"," << xLast <<
")" << endl ;
610 Double_t xFirstPt,yFirstPt,xLastPt,yLastPt ;
617 if (ilast-ifirst==1 &&(xFirstPt-xFirst)<-1*tolerance && (xLastPt-xLast)>tolerance) {
618 return 0.5*(yFirst+yLast) ;
623 if ((xFirstPt-xFirst)<-1*tolerance) {
630 if ((xLastPt-xLast)>tolerance) {
638 sum += (xFirstPt-xFirst)*(yFirst+yFirstPt)/2 ;
642 for (i=ifirst ; i<ilast ; i++) {
649 sum += (xLast-xLastPt)*(yLastPt+yLast)/2 ;
650 return sum/(xLast-xFirst) ;
661 Double_t delta(std::numeric_limits<double>::max()),
x,
y ;
664 for (i=0 ; i<
n ; i++) {
666 if (
fabs(xvalue-
x)<delta) {
667 delta =
fabs(xvalue-
x) ;
672 return (delta<tolerance)?ibest:-1 ;
692 if (
fabs(xbest-xvalue)<tolerance) {
704 if (xother==xbest)
return ybest ;
705 retVal = ybest + (yother-ybest)*(xvalue-xbest)/(xother-xbest) ;
713 if (xother==xbest)
return ybest ;
714 retVal = yother + (ybest-yother)*(xvalue-xother)/(xbest-xother) ;
736 vector<double> bandLo(
GetN()) ;
737 vector<double> bandHi(
GetN()) ;
738 for (
int i=0 ; i<
GetN() ; i++) {
742 for (
int i=0 ; i<
GetN() ; i++) {
745 for (
int i=
GetN()-1 ; i>=0 ; i--) {
768 vector<double> bandLo(
GetN()) ;
769 vector<double> bandHi(
GetN()) ;
770 for (
int i=0 ; i<
GetN() ; i++) {
774 for (
int i=0 ; i<
GetN() ; i++) {
777 for (
int i=
GetN()-1 ; i>=0 ; i--) {
793 vector<double> y_plus(plusVar.size()), y_minus(minusVar.size()) ;
795 for (vector<RooCurve*>::const_iterator iter=plusVar.begin() ; iter!=plusVar.end() ; ++iter) {
796 y_plus[j++] = (*iter)->interpolate(
GetX()[i]) ;
799 for (vector<RooCurve*>::const_iterator iter=minusVar.begin() ; iter!=minusVar.end() ; ++iter) {
800 y_minus[j++] = (*iter)->interpolate(
GetX()[i]) ;
807 for (j=0 ; j<
n ; j++) {
808 F[j] = (y_plus[j]-y_minus[j])/2 ;
824 vector<double>
y(variations.size()) ;
826 for (vector<RooCurve*>::const_iterator iter=variations.begin() ; iter!=variations.end() ; ++iter) {
827 y[j++] = (*iter)->interpolate(
GetX()[i]) ;
834 sort(
y.begin(),
y.end()) ;
836 hi =
y[
y.size()-delta] ;
840 for (
unsigned int k=0 ; k<
y.size() ; k++) {
842 sum_ysq +=
y[k]*
y[k] ;
845 sum_ysq /=
y.size() ;
848 lo =
GetY()[i] - Z*rms ;
865 for(
Int_t i= 0; i <
n; i++) {
874 for(
Int_t i= 2; i <
n-2; i++) {
882 cout <<
"RooCurve::isIdentical[" << i <<
"] Y tolerance exceeded (" << rdy <<
">" << tol
883 <<
"), X=" << other.
fX[i] <<
"(" <<
fX[i] <<
")" <<
" Ytest=" << yTest <<
" Yref=" << other.
fY[i] <<
" range = " << Yrange << endl ;
static const double x2[5]
static const double x1[5]
float type_of_call hi(const int &, const int &)
char * Form(const char *fmt,...)
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
static void printEvalErrors(std::ostream &os=std::cout, Int_t maxPerNode=10000000)
Print all outstanding logged evaluation error on the given ostream.
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
A RooCurve is a one-dimensional graphical representation of a real-valued function.
void addPoints(const RooAbsFunc &func, Double_t xlo, Double_t xhi, Int_t minPoints, Double_t prec, Double_t resolution, WingMode wmode, Int_t numee=0, Bool_t doEEVal=kFALSE, Double_t eeVal=0., std::list< Double_t > *samplingHint=0)
Add points calculated with the specified function, over the range (xlo,xhi).
void initialize()
Perform initialization that is common to all curves.
void addPoint(Double_t x, Double_t y)
Add a point with the specified coordinates. Update our y-axis limits.
Double_t chiSquare(const RooHist &hist, int nFitParam) const
Calculate the chi^2/NDOF of this curve with respect to the histogram 'hist' accounting nFitParam floa...
Double_t average(Double_t lo, Double_t hi) const
Return average curve value in [xFirst,xLast] by integrating curve between points and dividing by xLas...
void addRange(const RooAbsFunc &func, Double_t x1, Double_t x2, Double_t y1, Double_t y2, Double_t minDy, Double_t minDx, Int_t numee=0, Bool_t doEEVal=kFALSE, Double_t eeVal=0.)
Fill the range (x1,x2) with points calculated using func(&x).
void shiftCurveToZero(Double_t prevYMax)
Find lowest point in curve and move all points in curve so that lowest point will go exactly through ...
virtual ~RooCurve()
Destructor.
RooCurve * makeErrorBand(const std::vector< RooCurve * > &variations, Double_t Z=1) const
Construct filled RooCurve represented error band that captures alpha% of the variations of the curves...
virtual void printName(std::ostream &os) const
Print name of object.
RooCurve()
Default constructor.
Bool_t isIdentical(const RooCurve &other, Double_t tol=1e-6) const
Return true if curve is identical to other curve allowing for given absolute tolerance on each point ...
Double_t getFitRangeNEvt() const
Return the number of events associated with the plotable object, it is always 1 for curves.
virtual void printClassName(std::ostream &os) const
Print the class name of this curve.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Print the details of this curve.
Double_t interpolate(Double_t x, Double_t tolerance=1e-10) const
Return linearly interpolated value of curve at xvalue.
virtual void printTitle(std::ostream &os) const
Print the title of this curve.
Int_t findPoint(Double_t value, Double_t tolerance=1e-10) const
Find the nearest point to xvalue.
Double_t getFitRangeBinW() const
Get the bin width associated with this plotable object.
void calcBandInterval(const std::vector< RooCurve * > &variations, Int_t i, Double_t Z, Double_t &lo, Double_t &hi, Bool_t approxGauss) const
A RooHist is a graphical representation of binned data based on the TGraphAsymmErrors class.
static Double_t infinity()
Return internal infinity representation.
Double_t getYAxisMin() const
void updateYAxisLimits(Double_t y)
Double_t getYAxisMax() const
void setYAxisLimits(Double_t ymin, Double_t ymax)
void setYAxisLabel(const char *label)
Lightweight RooAbsFunction implementation that applies a constant scale factor to another RooAbsFunc.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Double_t * GetEXhigh() const
Double_t * GetEYlow() const
Double_t * GetEXlow() const
Double_t * GetEYhigh() const
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
virtual void SetName(const char *name="")
Set graph name.
virtual void SetTitle(const char *title="")
Set graph title.
Double_t * fY
[fNpoints] array of Y points
Double_t * fX
[fNpoints] array of X points
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Get x and y values for point number i.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
std::string GetName(const std::string &scope_name)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Double_t Erfc(Double_t x)
Compute the complementary error function erfc(x).
static long int sum(long int i)