85 Bool_t showProg) : _showProgress(showProg)
114 if(scaleFactor != 1) {
123 addPoints(*funcPtr,xlo,xhi,xbins+1,prec,resolution,wmode,nEvalError,doEEVal,eeVal,hint);
134 if(rawPtr)
delete rawPtr;
139 for (i=0 ; i<
GetN() ; i++) {
163 addPoints(func,xlo,xhi,minPoints+1,prec,resolution,wmode,nEvalError,doEEVal,eeVal);
169 for (i=0 ; i<
GetN() ; i++) {
192 deque<Double_t> pointList ;
197 for (i1=0 ; i1<n1 ; i1++) {
199 pointList.push_back(x) ;
204 for (i2=0 ; i2<n2 ; i2++) {
206 pointList.push_back(x) ;
210 sort(pointList.begin(),pointList.end()) ;
213 deque<double>::iterator
iter ;
215 for (iter=pointList.begin() ; iter!=pointList.end() ; ++
iter) {
217 if ((*iter-last)>1e-10) {
261 for (i=1 ; i<
GetN()-1 ; i++) {
264 if (y<minVal) minVal=
y ;
265 if (y>maxVal) maxVal=
y ;
269 for (i=1 ; i<
GetN()-1 ; i++) {
299 if(minPoints <= 0 || xhi <= xlo) {
309 minPoints = samplingHint->size() ;
313 Double_t dx= (xhi-xlo)/(minPoints-1.);
318 list<Double_t>* xval = samplingHint ;
320 xval =
new list<Double_t> ;
321 for(step= 0; step < minPoints; step++) {
322 xval->push_back(xlo + step*dx) ;
330 for(list<Double_t>::iterator
iter = xval->begin() ;
iter!=xval->end() ; ++
iter,++step) {
333 if (step==minPoints-1) xx-=1e-15 ;
335 yval[step]=
func(&xx);
353 if (yval[step]>
ymax)
ymax=yval[step] ;
354 if (yval[step]<ymin) ymin=yval[step] ;
359 Double_t minDx= resolution*(xhi-xlo);
371 list<Double_t>::iterator iter2 = xval->begin() ;
377 if (iter2==xval->end()) {
385 addRange(func,x1,x2,yval[step-1],yval[step],prec*yrangeEst,minDx,numee,doEEVal,eeVal);
392 addPoint(xhi+dx,yval[minPoints-1]) ;
400 if (xval != samplingHint) {
418 if (
fabs(x2-x1)<1e-20) {
443 if((xmid - x1 >= minDx) &&
fabs(dy)>0 &&
fabs(dy) >= minDy) {
445 addRange(func,x1,xmid,y1,ymid,minDy,minDx,numee,doEEVal,eeVal);
446 addRange(func,xmid,x2,ymid,y2,minDy,minDx,numee,doEEVal,eeVal);
530 os << indent <<
"--- RooCurve ---" << endl ;
532 os << indent <<
" Contains " << n <<
" points" << endl;
533 os << indent <<
" Graph points:" << endl;
534 for(
Int_t i= 0; i <
n; i++) {
535 os << indent << setw(3) << i <<
") x = " <<
fX[i] <<
" , y = " <<
fY[i] << endl;
554 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
565 for (i=0 ; i<
np ; i++) {
568 ((
RooHist&)hist).GetPoint(i,x,y) ;
583 Double_t pull = (y>avg) ? ((y-avg)/eyl) : ((y-avg)/eyh) ;
590 return chisq / (nbin-nFitParam) ;
603 <<
") invalid range (" << xFirst <<
"," << xLast <<
")" << endl ;
614 Double_t xFirstPt,yFirstPt,xLastPt,yLastPt ;
618 Double_t tolerance=1e-3*(xLast-xFirst) ;
621 if (ilast-ifirst==1 &&(xFirstPt-xFirst)<-1*tolerance && (xLastPt-xLast)>tolerance) {
622 return 0.5*(yFirst+yLast) ;
627 if ((xFirstPt-xFirst)<-1*tolerance) {
634 if ((xLastPt-xLast)>tolerance) {
642 sum += (xFirstPt-xFirst)*(yFirst+yFirstPt)/2 ;
646 for (i=ifirst ; i<ilast ; i++) {
649 sum += (x2-
x1)*(y1+y2)/2 ;
653 sum += (xLast-xLastPt)*(yLastPt+yLast)/2 ;
654 return sum/(xLast-xFirst) ;
668 for (i=0 ; i<
n ; i++) {
669 ((
RooCurve&)*
this).GetPoint(i,x,y) ;
670 if (
fabs(xvalue-x)<delta) {
671 delta =
fabs(xvalue-x) ;
676 return (delta<tolerance)?ibest:-1 ;
696 if (
fabs(xbest-xvalue)<tolerance) {
708 if (xother==xbest)
return ybest ;
709 retVal = ybest + (yother-ybest)*(xvalue-xbest)/(xother-xbest) ;
717 if (xother==xbest)
return ybest ;
718 retVal = yother + (ybest-yother)*(xvalue-xother)/(xbest-xother) ;
740 vector<double> bandLo(
GetN()) ;
741 vector<double> bandHi(
GetN()) ;
742 for (
int i=0 ; i<
GetN() ; i++) {
746 for (
int i=0 ; i<
GetN() ; i++) {
749 for (
int i=
GetN()-1 ; i>=0 ; i--) {
772 vector<double> bandLo(
GetN()) ;
773 vector<double> bandHi(
GetN()) ;
774 for (
int i=0 ; i<
GetN() ; i++) {
778 for (
int i=0 ; i<
GetN() ; i++) {
781 for (
int i=
GetN()-1 ; i>=0 ; i--) {
797 vector<double> y_plus(plusVar.size()), y_minus(minusVar.size()) ;
799 for (vector<RooCurve*>::const_iterator
iter=plusVar.begin() ;
iter!=plusVar.end() ;
iter++) {
800 y_plus[j++] = (*iter)->interpolate(
GetX()[i]) ;
803 for (vector<RooCurve*>::const_iterator
iter=minusVar.begin() ;
iter!=minusVar.end() ;
iter++) {
804 y_minus[j++] = (*iter)->interpolate(
GetX()[i]) ;
811 for (j=0 ; j<
n ; j++) {
812 F[j] = (y_plus[j]-y_minus[j])/2 ;
818 lo= y_cen +
sqrt(sum) ;
819 hi= y_cen -
sqrt(sum) ;
828 vector<double>
y(variations.size()) ;
830 for (vector<RooCurve*>::const_iterator
iter=variations.begin() ;
iter!=variations.end() ;
iter++) {
831 y[j++] = (*iter)->interpolate(
GetX()[i]) ;
838 sort(
y.begin(),
y.end()) ;
840 hi =
y[
y.size()-delta] ;
844 for (
unsigned int k=0 ; k<
y.size() ; k++) {
846 sum_ysq +=
y[k]*
y[k] ;
849 sum_ysq /=
y.size() ;
852 lo =
GetY()[i] - Z*rms ;
853 hi =
GetY()[i] + Z*rms ;
869 for(
Int_t i= 0; i <
n; i++) {
873 if (
fY[i]>ymax) ymax=
fY[i] ;
878 for(
Int_t i= 2; i < n-2; i++) {
886 cout <<
"RooCurve::isIdentical[" << i <<
"] Y tolerance exceeded (" << rdy <<
">" << tol
887 <<
"), X=" << other.
fX[i] <<
"(" <<
fX[i] <<
")" <<
" Ytest=" << yTest <<
" Yref=" << other.
fY[i] <<
" range = " << Yrange << endl ;
virtual const char * GetTitle() const
Returns title of object.
virtual void SetLineWidth(Width_t lwidth)
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
A RooCurve is a one-dimensional graphical representation of a real-valued function.
static int pull(FILE *fp, struct mg_connection *conn, char *buf, int len)
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Double_t * GetEYlow() const
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...
virtual void SetName(const char *name)
Change (i.e.
void shiftCurveToZero(Double_t prevYMax)
Find lowest point in curve and move all points in curve so that lowest point will go exactly through ...
Double_t * GetEXlow() const
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
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 SetTitle(const char *title="")
Set graph title.
virtual ~RooCurve()
Destructor.
ClassImp(RooCurve) RooCurve
Default constructor.
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.
A RooHist is a graphical representation of binned data based on the TGraphAsymmErrors class...
static const double x2[5]
void initialize()
Perform initialization that is common to all curves.
const Text_t * getUnit() const
std::map< std::string, std::string >::const_iterator iter
if on multiple lines(like in C++).**The" * configuration fragment. * * The "import myobject continue
Parses the configuration file.
void setYAxisLimits(Double_t ymin, Double_t ymax)
Double_t Erfc(Double_t x)
Compute the complementary error function erfc(x).
virtual void SetLineColor(Color_t lcolor)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Double_t getFitRangeNEvt() const
Return the number of events associated with the plotable object, it is always 1 for curves...
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
virtual void SetFillColor(Color_t fcolor)
Double_t getYAxisMax() const
char * Form(const char *fmt,...)
virtual void printClassName(std::ostream &os) const
Print the class name of this curve.
static Double_t infinity()
Return internal infinity representation.
void updateYAxisLimits(Double_t y)
static void printEvalErrors(std::ostream &os=std::cout, Int_t maxPerNode=10000000)
Print all outstanding logged evaluation error on the given ostream.
virtual const char * GetName() const
Returns name of object.
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
static void indent(ostringstream &buf, int indent_level)
Int_t findPoint(Double_t value, Double_t tolerance=1e-10) const
Find the nearest point to xvalue.
void addPoint(Double_t x, Double_t y)
Add a point with the specified coordinates. Update our y-axis limits.
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 ...
static const double x1[5]
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t * GetEYhigh() const
double func(double *x, double *p)
Double_t getYAxisMin() const
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).
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Get x and y values for point number i.
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...
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual void printTitle(std::ostream &os) const
Print the title of this curve.
void calcBandInterval(const std::vector< RooCurve * > &variations, Int_t i, Double_t Z, Double_t &lo, Double_t &hi, Bool_t approxGauss) const
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).
Double_t getFitRangeBinW() const
Get the bin width associated with this plotable object.
float type_of_call hi(const int &, const int &)
void setYAxisLabel(const char *label)
virtual void printName(std::ostream &os) const
Print name of object.
std::complex< float_v > Z
Lightweight RooAbsFunction implementation that applies a constant scale factor to another RooAbsFunc...
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Double_t * GetEXhigh() const
RooAbsFunc * bindVars(const RooArgSet &vars, const RooArgSet *nset=0, Bool_t clipInvalid=kFALSE) const
Create an interface adaptor f(vars) that binds us to the specified variables (in arbitrary order)...