59using std::endl, std::ostream, std::list, std::vector, std::cout, std::min;
130 std::unique_ptr<std::list<double>>
hint{
f.plotSamplingHint(
x,xlo,xhi)};
131 addPoints(*
funcPtr,xlo,xhi,xbins+1,
prec,
resolution,wmode,
nEvalError,
doEEVal,
eeVal,
hint.get());
133 ccoutP(Plotting) << endl ;
139 for(
int i=0; i<
nBinsX; ++i){
140 double xval =
x.getBinning().binCenter(i);
149 for (
int i=0 ; i<
GetN() ; i++) {
175 for (
int i=0 ; i<
GetN() ; i++) {
224 if ((point-last)>1
e-10) {
257 double minVal = std::numeric_limits<double>::infinity();
258 double maxVal = -std::numeric_limits<double>::infinity();
261 for (
int i = 1; i <
GetN() - 1; i++) {
263 minVal = std::min(
y, minVal);
264 maxVal = std::max(
y, maxVal);
268 for (
int i = 1; i <
GetN() - 1; i++) {
270 SetPoint(i, point.x, point.y - minVal);
290 coutE(InputArguments) <<
fName <<
"::addPoints: input function is not valid" << endl;
294 coutE(InputArguments) <<
fName <<
"::addPoints: bad input (nothing added)" << endl;
312 std::vector<double>
xval;
314 for(
int step= 0; step <
minPoints; step++) {
315 xval.push_back(xlo + step*
dx) ;
321 for (
unsigned int step=0; step <
xval.size(); ++step) {
323 if (step ==
static_cast<unsigned int>(
minPoints-1))
334 coutW(Plotting) <<
"At observable [x]=" <<
xx <<
" " ;
353 if (wmode==Extended) {
379 addRange(func,
x1,
x2,
yval[step-1],
yval[step],
prec*
yrangeEst,
minDx,numee,
doEEVal,
eeVal,epsilon);
385 if (wmode==Extended) {
407 if (std::abs(
x2-
x1) <= epsilon) {
421 coutW(Plotting) <<
"At observable [x]=" <<
xmid <<
" " ;
434 addRange(func,
x1,
xmid,
y1,
ymid,
minDy,
minDx,numee,
doEEVal,
eeVal,epsilon);
435 addRange(func,
xmid,
x2,
ymid,
y2,
minDy,
minDx,numee,
doEEVal,
eeVal,epsilon);
519 os <<
indent <<
"--- RooCurve ---" << endl ;
521 os <<
indent <<
" Contains " <<
n <<
" points" << endl;
522 os <<
indent <<
" Graph points:" << endl;
523 for(
Int_t i= 0; i <
n; i++) {
524 os <<
indent << std::setw(3) << i <<
") x = " <<
fX[i] <<
" , y = " <<
fY[i] << endl;
546 for (
int i=0 ; i<
np ; i++) {
583 coutE(InputArguments) <<
"RooCurve::average(" <<
GetName()
584 <<
") invalid range (" <<
xFirst <<
"," <<
xLast <<
")" << endl ;
635 double delta(std::numeric_limits<double>::max());
638 for (
int i=0 ; i<
n ; i++) {
640 if (std::abs(
xvalue-
x)<delta) {
704 band->SetName((std::string(
GetName()) +
"_errorband").c_str());
705 band->SetLineWidth(1) ;
711 for (
int i=0 ; i<
GetN() ; i++) {
715 for (
int i=0 ; i<
GetN() ; i++) {
718 for (
int i=
GetN()-1 ; i>=0 ; i--) {
744 band->SetName((std::string(
GetName()) +
"_errorband").c_str());
745 band->SetLineWidth(1) ;
751 for (
int i=0 ; i<
GetN() ; i++) {
755 for (
int i=0 ; i<
GetN() ; i++) {
758 for (
int i=
GetN()-1 ; i>=0 ; i--) {
797 for (
j=0 ;
j<
n ;
j++) {
802 double sum = F*(C*
F) ;
816 for (vector<RooCurve*>::const_iterator iter=variations.
begin() ; iter!=variations.
end() ; ++iter) {
817 y[
j++] = (*iter)->interpolate(
GetX()[i]) ;
824 sort(
y.begin(),
y.end()) ;
826 hi =
y[
y.size()-delta] ;
831 for (
unsigned int k=0 ; k<
y.size() ; k++) {
859 for(
Int_t i= 0; i <
n; i++) {
868 for(
Int_t i= 2; i <
n-2; i++) {
873 if(!verbose)
continue;
874 cout <<
"RooCurve::isIdentical[" << std::setw(3) << i <<
"] Y tolerance exceeded (" << std::setprecision(5) << std::setw(10) <<
rdy <<
">" <<
tol <<
"),";
875 cout <<
" x,y=(" << std::right << std::setw(10) <<
fX[i] <<
"," << std::setw(10) <<
fY[i] <<
")\tref: y="
876 << std::setw(10) <<
other.interpolate(
fX[i], 1.E-15) <<
". [Nearest point from ref: ";
877 auto j =
other.findPoint(
fX[i], 1.E10);
878 std::cout <<
"j=" <<
j <<
"\tx,y=(" << std::setw(10) <<
other.fX[
j] <<
"," << std::setw(10) <<
other.fY[
j] <<
") ]" <<
"\trange=" <<
Yrange << std::endl;
895 auto hint =
new std::list<double>;
904 hint->push_back(xlo + delta);
905 hint->push_back(xhi - delta);
909 for (
const double x : boundaries) {
910 if (
x - xlo > delta && xhi -
x > delta) {
911 hint->push_back(
x - delta);
912 hint->push_back(
x + delta);
static void indent(ostringstream &buf, int indent_level)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t SetLineWidth
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t SetLineColor
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
The Kahan summation is a compensated summation algorithm, which significantly reduces numerical error...
const_iterator begin() const
const_iterator end() const
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
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.
One-dimensional graphical representation of a real-valued function.
void addPoints(const RooAbsFunc &func, double xlo, double xhi, Int_t minPoints, double prec, double resolution, WingMode wmode, Int_t numee=0, bool doEEVal=false, double eeVal=0.0, std::list< double > *samplingHint=nullptr)
Add points calculated with the specified function, over the range (xlo,xhi).
void printTitle(std::ostream &os) const override
Print the title of this curve.
void initialize()
Perform initialization that is common to all curves.
double getFitRangeBinW() const override
Get the bin width associated with this plotable object.
static constexpr double relativeXEpsilon()
The distance between two points x1 and x2 relative to the full plot range below which two points are ...
void addRange(const RooAbsFunc &func, double x1, double x2, double y1, double y2, double minDy, double minDx, int numee, bool doEEVal, double eeVal, double epsilon)
Fill the range (x1,x2) with points calculated using func(&x).
void printName(std::ostream &os) const override
Print name of object.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print the details of this curve.
double interpolate(double x, double tolerance=1e-10) const
Return linearly interpolated value of curve at xvalue.
static std::list< double > * plotSamplingHintForBinBoundaries(std::span< const double > boundaries, double xlo, double xhi)
Returns sampling hints for a histogram with given boundaries.
void printClassName(std::ostream &os) const override
Print the class name of this curve.
RooCurve()
Default constructor.
bool _showProgress
! Show progress indication when adding points
RooCurve * makeErrorBand(const std::vector< RooCurve * > &variations, double Z=1) const
Construct filled RooCurve represented error band that captures alpha% of the variations of the curves...
double chiSquare(const RooHist &hist, int nFitParam) const
Calculate the chi^2/NDOF of this curve with respect to the histogram 'hist' accounting nFitParam floa...
void calcBandInterval(const std::vector< RooCurve * > &variations, Int_t i, double Z, double &lo, double &hi, bool approxGauss) const
double getFitRangeNEvt() const override
Return the number of events associated with the plotable object, it is always 1 for curves.
void shiftCurveToZero()
Find lowest point in curve and move all points in curve so that lowest point will go exactly through ...
void addPoint(double x, double y)
Add a point with the specified coordinates. Update our y-axis limits.
bool isIdentical(const RooCurve &other, double tol=1e-6, bool verbose=true) const
Return true if curve is identical to other curve allowing for given absolute tolerance on each point ...
Int_t findPoint(double value, double tolerance=1e-10) const
Find the nearest point to xvalue.
double average(double lo, double hi) const
Return average curve value in [xFirst,xLast] by integrating curve between points and dividing by xLas...
Graphical representation of binned data based on the TGraphAsymmErrors class.
static constexpr double infinity()
Return internal infinity representation.
void updateYAxisLimits(double y)
void setYAxisLimits(double ymin, double ymax)
void setYAxisLabel(const char *label)
Represents the product of a given set of RooAbsReal objects.
Bool_t IsAlphanumeric() const
const char * GetBinLabel(Int_t bin) const
Return label for bin.
virtual void Set(Int_t nbins, Double_t xmin, Double_t xmax)
Initialize axis with fix bins.
Double_t * GetEXlow() const override
Double_t * GetEYhigh() const override
Double_t * GetEXhigh() const override
Double_t * GetEYlow() const override
A TGraph is an object made of two arrays X and Y with npoints each.
virtual Double_t GetPointX(Int_t i) const
Get x value for point i.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Double_t * fY
[fNpoints] array of Y points
virtual void Sort(Bool_t(*greater)(const TGraph *, Int_t, Int_t)=&TGraph::CompareX, Bool_t ascending=kTRUE, Int_t low=0, Int_t high=-1111)
Sorts the points of this TGraph using in-place quicksort (see e.g.
void SetName(const char *name="") override
Set graph name.
TAxis * GetXaxis() const
Get x axis of the graph.
Double_t * fX
[fNpoints] array of X points
virtual Double_t GetPointY(Int_t i) const
Get y value for point i.
void SetTitle(const char *title="") override
Change (i.e.
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Get x and y values for point number i.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
const char * Data() const
TString & Append(const char *cs)
RooConstVar & RooConst(double val)
Double_t Erfc(Double_t x)
Computes the complementary error function erfc(x).
static uint64_t sum(uint64_t i)