121 if (exl)
fEXlow[i] = exl[i];
125 if (eyl)
fEYlow[i] = eyl[i];
130 if (exld)
fEXlowd[i] = exld[i];
134 if (eyld)
fEYlowd[i] = eyld[i];
158 if (exl) memcpy(
fEXlow, exl, n);
159 else memset(
fEXlow, 0, n);
160 if (exh) memcpy(
fEXhigh, exh, n);
162 if (eyl) memcpy(
fEYlow, eyl, n);
163 else memset(
fEYlow, 0, n);
164 if (eyh) memcpy(
fEYhigh, eyh, n);
167 if (exld) memcpy(
fEXlowd, exld, n);
169 if (exhd) memcpy(
fEXhighd, exhd, n);
171 if (eyld) memcpy(
fEYlowd, eyld, n);
173 if (eyhd) memcpy(
fEYhighd, eyhd, n);
208 Double_t x,
y,exl,exh,eyl,eyh,eyl_new,eyh_new,fxy;
226 if (f->
Eval(x,y-eyl)<f->
Eval(x,y+eyh)) {
315 memmove(&arrays[0][obegin], &
fEXlow[ibegin], n);
316 memmove(&arrays[1][obegin], &
fEXhigh[ibegin], n);
317 memmove(&arrays[2][obegin], &
fEYlow[ibegin], n);
318 memmove(&arrays[3][obegin], &
fEYhigh[ibegin], n);
319 memmove(&arrays[4][obegin], &
fEXlowd[ibegin], n);
320 memmove(&arrays[5][obegin], &
fEXhighd[ibegin], n);
321 memmove(&arrays[6][obegin], &
fEYlowd[ibegin], n);
322 memmove(&arrays[7][obegin], &
fEYhighd[ibegin], n);
378 if (exl == 0 || exh == 0 || eyl == 0 || eyh == 0 ||
379 exld == 0 || exhd == 0 || eyld == 0 || eyhd == 0) {
381 Warning(
"DoMerge",
"Merging a %s is not compatible with a TGraphBentErrors - errors will be ignored",g->IsA()->
GetName());
390 exld[i], exhd[i], eyld[i], eyhd[i] );
402 if (i < 0 || i >=
fNpoints)
return -1;
417 if (i < 0 || i >=
fNpoints)
return -1;
480 memset(
fEXlow + begin, 0, n);
482 memset(
fEYlow + begin, 0, n);
497 printf(
"x[%d]=%g, y[%d]=%g, exl[%d]=%g, exh[%d]=%g, eyl[%d]=%g, eyh[%d]=%g\n" 498 ,i,
fX[i],i,
fY[i],i,
fEXlow[i],i,
fEXhigh[i],i,
fEYlow[i],i,
fEYhigh[i]);
509 out <<
" " << std::endl;
510 static Int_t frameNumber = 2000;
524 out <<
" Double_t " << fXName <<
"[" <<
fNpoints <<
"] = {" << std::endl;
525 for (i = 0; i <
fNpoints-1; i++) out <<
" " <<
fX[i] <<
"," << std::endl;
526 out <<
" " <<
fX[fNpoints-1] <<
"};" << std::endl;
527 out <<
" Double_t " << fYName <<
"[" << fNpoints <<
"] = {" << std::endl;
528 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fY[i] <<
"," << std::endl;
529 out <<
" " <<
fY[fNpoints-1] <<
"};" << std::endl;
530 out <<
" Double_t " << fElXName <<
"[" << fNpoints <<
"] = {" << std::endl;
531 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fEXlow[i] <<
"," << std::endl;
532 out <<
" " <<
fEXlow[fNpoints-1] <<
"};" << std::endl;
533 out <<
" Double_t " << fElYName <<
"[" << fNpoints <<
"] = {" << std::endl;
534 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fEYlow[i] <<
"," << std::endl;
535 out <<
" " <<
fEYlow[fNpoints-1] <<
"};" << std::endl;
536 out <<
" Double_t " << fEhXName <<
"[" << fNpoints <<
"] = {" << std::endl;
537 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fEXhigh[i] <<
"," << std::endl;
538 out <<
" " <<
fEXhigh[fNpoints-1] <<
"};" << std::endl;
539 out <<
" Double_t " << fEhYName <<
"[" << fNpoints <<
"] = {" << std::endl;
540 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fEYhigh[i] <<
"," << std::endl;
541 out <<
" " <<
fEYhigh[fNpoints-1] <<
"};" << std::endl;
542 out <<
" Double_t " << fEldXName <<
"[" << fNpoints <<
"] = {" << std::endl;
543 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fEXlowd[i] <<
"," << std::endl;
544 out <<
" " <<
fEXlowd[fNpoints-1] <<
"};" << std::endl;
545 out <<
" Double_t " << fEldYName <<
"[" << fNpoints <<
"] = {" << std::endl;
546 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fEYlowd[i] <<
"," << std::endl;
547 out <<
" " <<
fEYlowd[fNpoints-1] <<
"};" << std::endl;
548 out <<
" Double_t " << fEhdXName <<
"[" << fNpoints <<
"] = {" << std::endl;
549 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fEXhighd[i] <<
"," << std::endl;
550 out <<
" " <<
fEXhighd[fNpoints-1] <<
"};" << std::endl;
551 out <<
" Double_t " << fEhdYName <<
"[" << fNpoints <<
"] = {" << std::endl;
552 for (i = 0; i < fNpoints-1; i++) out <<
" " <<
fEYhighd[i] <<
"," << std::endl;
553 out <<
" " <<
fEYhighd[fNpoints-1] <<
"};" << std::endl;
556 else out <<
" TGraphBentErrors *";
557 out <<
"grbe = new TGraphBentErrors("<< fNpoints <<
"," 558 << fXName <<
"," << fYName <<
"," 559 << fElXName <<
"," << fEhXName <<
"," 560 << fElYName <<
"," << fEhYName <<
"," 561 << fEldXName <<
"," << fEhdXName <<
"," 562 << fEldYName <<
"," << fEhdYName <<
");" 565 out <<
" grbe->SetName(" << quote <<
GetName() << quote <<
");" << std::endl;
566 out <<
" grbe->SetTitle(" << quote <<
GetTitle() << quote <<
");" << std::endl;
574 hname += frameNumber;
584 while ((obj = next())) {
587 out <<
" grbe->GetListOfFunctions()->Add(ptstats);" << std::endl;
588 out <<
" ptstats->SetParent(grbe->GetListOfFunctions());" << std::endl;
593 out <<
" " << objname <<
"->SetParent(grbe);\n";
595 out <<
" grbe->GetListOfFunctions()->Add(" 596 << objname <<
");" << std::endl;
600 const char *
l = strstr(option,
"multigraph");
602 out<<
" multigraph->Add(grbe,"<<quote<<l+10<<quote<<
");"<<std::endl;
604 out<<
" grbe->Draw("<<quote<<option<<quote<<
");"<<std::endl;
625 if (dpx*dpx+dpy*dpy < 25) {ipoint = i;
break;}
627 if (ipoint == -2)
return;
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Int_t fNpoints
Number of points <= fMaxSize.
virtual const char * GetName() const
Returns name of object.
virtual Bool_t DoMerge(const TGraph *g)
protected function to perform the merge operation of a graph with asymmetric errors ...
Double_t * fX
[fNpoints] array of X points
virtual void SetPointError(Double_t exl, Double_t exh, Double_t eyl, Double_t eyh, Double_t exld=0, Double_t exhd=0, Double_t eyld=0, Double_t eyhd=0)
Set ex and ey values for point pointed by the mouse.
Double_t * fEXhigh
[fNpoints] array of X high errors
virtual Double_t * GetEYlow() const
Double_t * fEYhighd
[fNpoints] array of Y high displacements
virtual Double_t * GetEXhighd() const
Double_t GetErrorYhigh(Int_t bin) const
Get high error on Y[i].
Short_t Min(Short_t a, Short_t b)
TList * fFunctions
Pointer to list of functions (fits and user)
TGraphBentErrors()
TGraphBentErrors default constructor.
TH1F * fHistogram
Pointer to histogram used for drawing axis.
virtual void SwapPoints(Int_t pos1, Int_t pos2)
Swap points.
virtual Bool_t CopyPoints(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy points from fX and fY to arrays[0] and arrays[1] or to fX and fY if arrays == 0 and ibegin != ie...
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
virtual void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE)
Set zero values for point arrays in the range [begin, end)
virtual void SaveMarkerAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1)
Save line attributes as C++ statement(s) on output stream out.
virtual ~TGraphBentErrors()
TGraphBentErrors default destructor.
Bool_t CtorAllocate()
Should be called from ctors after fNpoints has been set.
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Compute range.
virtual Double_t * GetEYhighd() const
Double_t * fEXlow
[fNpoints] array of X low errors
virtual void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy and release.
A TGraphBentErrors is a TGraph with bent, assymetric error bars.
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
Get x and y values for point number i.
virtual void SwapPoints(Int_t pos1, Int_t pos2)
Swap points.
static void SwapValues(Double_t *arr, Int_t pos1, Int_t pos2)
Swap values.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual Bool_t DoMerge(const TGraph *g)
protected function to perform the merge operation of a graph
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual void SaveFillAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001)
Save fill attributes as C++ statement(s) on output stream out.
char * Form(const char *fmt,...)
Double_t GetErrorY(Int_t bin) const
This function is called by GraphFitChisquare.
Double_t GetErrorYlow(Int_t bin) const
Get low error on Y[i].
Double_t * fEYlowd
[fNpoints] array of Y low displacements
virtual void Print(Option_t *chopt="") const
Print graph and errors values.
Double_t * fEYhigh
[fNpoints] array of Y high errors
virtual void SetName(const char *name)
Change the name of this histogram.
virtual Double_t * GetEXlowd() const
Double_t * fEYlow
[fNpoints] array of Y low errors
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
virtual Double_t * GetEYlowd() const
virtual Double_t * GetEXlow() const
Double_t GetErrorXhigh(Int_t bin) const
Get high error on X[i].
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Double_t GetErrorXlow(Int_t bin) const
Get low error on X[i].
Mother of all ROOT objects.
virtual void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE)
Set zero values for point arrays in the range [begin, end) Should be redefined in descendant classes...
Double_t * fEXhighd
[fNpoints] array of X high displacements
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
A Graph is a graphics object made of two arrays X and Y with npoints each.
virtual Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy errors from fE*** to arrays[] or to f Copy points.
Int_t fMaxSize
!Current dimension of arrays fX and fY
virtual void Apply(TF1 *f)
apply a function to all data points y = f(x,y)
Double_t Sqrt(Double_t x)
virtual Double_t * GetEYhigh() const
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Compute the x/y range of the points in this graph.
virtual const char * GetName() const
Returns name of object.
Double_t * fEXlowd
[fNpoints] array of X low displacements
virtual Double_t * GetEXhigh() const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual const char * GetTitle() const
Returns title of object.
Double_t GetErrorX(Int_t bin) const
This function is called by GraphFitChisquare.
const char * Data() const
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
static constexpr double g