115 if (exl)
fEXlow[i] = exl[i];
119 if (eyl)
fEYlow[i] = eyl[i];
124 if (exld)
fEXlowd[i] = exld[i];
128 if (eyld)
fEYlowd[i] = eyld[i];
152 if (exl) memcpy(
fEXlow, exl, memsz);
153 else memset(
fEXlow, 0, memsz);
154 if (exh) memcpy(
fEXhigh, exh, memsz);
155 else memset(
fEXhigh, 0, memsz);
156 if (eyl) memcpy(
fEYlow, eyl, memsz);
157 else memset(
fEYlow, 0, memsz);
158 if (eyh) memcpy(
fEYhigh, eyh, memsz);
159 else memset(
fEYhigh, 0, memsz);
161 if (exld) memcpy(
fEXlowd, exld, memsz);
162 else memset(
fEXlowd, 0, memsz);
163 if (exhd) memcpy(
fEXhighd, exhd, memsz);
165 if (eyld) memcpy(
fEYlowd, eyld, memsz);
166 else memset(
fEYlowd, 0, memsz);
167 if (eyhd) memcpy(
fEYhighd, eyhd, memsz);
211 Double_t x,
y,exl,exh,eyl,eyh,eyl_new,eyh_new,fxy;
229 if (
f->Eval(
x,
y-eyl) <
f->Eval(
x,
y+eyh)) {
317 memmove(&arrays[0][obegin], &
fEXlow[ibegin],
n);
318 memmove(&arrays[1][obegin], &
fEXhigh[ibegin],
n);
319 memmove(&arrays[2][obegin], &
fEYlow[ibegin],
n);
320 memmove(&arrays[3][obegin], &
fEYhigh[ibegin],
n);
321 memmove(&arrays[4][obegin], &
fEXlowd[ibegin],
n);
322 memmove(&arrays[5][obegin], &
fEXhighd[ibegin],
n);
323 memmove(&arrays[6][obegin], &
fEYlowd[ibegin],
n);
324 memmove(&arrays[7][obegin], &
fEYhighd[ibegin],
n);
368 if (
g->GetN() == 0)
return kFALSE;
380 if (!exl || !exh || !eyl || !eyh ||
381 !exld || !exhd || !eyld || !eyhd) {
383 Warning(
"DoMerge",
"Merging a %s is not compatible with a TGraphBentErrors - errors will be ignored",
g->IsA()->GetName());
386 for (
Int_t i = 0 ; i <
g->GetN(); i++) {
392 exld[i], exhd[i], eyld[i], eyhd[i]);
403 if (i < 0 || i >=
fNpoints)
return -1;
417 if (i < 0 || i >=
fNpoints)
return -1;
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]);
564 TString::Format(
"%d, %s.data(), %s.data(), %s, %s, %s, %s, %s, %s, %s, %s",
565 fNpoints, xname.Data(), yname.Data(), exlname.Data(), exhname.Data(),
566 eylname.Data(), eyhname.Data(), exldname.Data(), exhdname.Data(),
567 eyldname.Data(), eyhdname.Data()),
581 Error(
"SetPointError",
"Cannot be used without gPad, requires last mouse position");
594 if (dpx*dpx+dpy*dpy < 25) {ipoint = i;
break;}
596 if (ipoint == -2)
return;
657 std::vector<Double_t> fEXlowSorted(numSortedPoints);
658 std::vector<Double_t> fEXhighSorted(numSortedPoints);
659 std::vector<Double_t> fEXlowdSorted(numSortedPoints);
660 std::vector<Double_t> fEXhighdSorted(numSortedPoints);
662 std::vector<Double_t> fEYlowSorted(numSortedPoints);
663 std::vector<Double_t> fEYhighSorted(numSortedPoints);
664 std::vector<Double_t> fEYlowdSorted(numSortedPoints);
665 std::vector<Double_t> fEYhighdSorted(numSortedPoints);
668 std::generate(fEXlowSorted.begin(), fEXlowSorted.end(),
669 [begin = low, &sorting_indices,
this]()
mutable { return fEXlow[sorting_indices[begin++]]; });
670 std::generate(fEXhighSorted.begin(), fEXhighSorted.end(),
671 [begin = low, &sorting_indices,
this]()
mutable { return fEXhigh[sorting_indices[begin++]]; });
672 std::generate(fEXlowdSorted.begin(), fEXlowdSorted.end(),
673 [begin = low, &sorting_indices,
this]()
mutable { return fEXlowd[sorting_indices[begin++]]; });
674 std::generate(fEXhighdSorted.begin(), fEXhighdSorted.end(),
675 [begin = low, &sorting_indices,
this]()
mutable { return fEXhighd[sorting_indices[begin++]]; });
677 std::generate(fEYlowSorted.begin(), fEYlowSorted.end(),
678 [begin = low, &sorting_indices,
this]()
mutable { return fEYlow[sorting_indices[begin++]]; });
679 std::generate(fEYhighSorted.begin(), fEYhighSorted.end(),
680 [begin = low, &sorting_indices,
this]()
mutable { return fEYhigh[sorting_indices[begin++]]; });
681 std::generate(fEYlowdSorted.begin(), fEYlowdSorted.end(),
682 [begin = low, &sorting_indices,
this]()
mutable { return fEYlowd[sorting_indices[begin++]]; });
683 std::generate(fEYhighdSorted.begin(), fEYhighdSorted.end(),
684 [begin = low, &sorting_indices,
this]()
mutable { return fEYhighd[sorting_indices[begin++]]; });
687 std::copy(fEXlowSorted.begin(), fEXlowSorted.end(),
fEXlow + low);
688 std::copy(fEXhighSorted.begin(), fEXhighSorted.end(),
fEXhigh + low);
689 std::copy(fEXlowdSorted.begin(), fEXlowdSorted.end(),
fEXlowd + low);
690 std::copy(fEXhighdSorted.begin(), fEXhighdSorted.end(),
fEXhighd + low);
692 std::copy(fEYlowSorted.begin(), fEYlowSorted.end(),
fEYlow + low);
693 std::copy(fEYhighSorted.begin(), fEYhighSorted.end(),
fEYhigh + low);
694 std::copy(fEYlowdSorted.begin(), fEYlowdSorted.end(),
fEYlowd + low);
695 std::copy(fEYhighdSorted.begin(), fEYhighdSorted.end(),
fEYhighd + low);
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
void UpdateArrays(const std::vector< Int_t > &sorting_indices, Int_t numSortedPoints, Int_t low) override
Update the fX, fY, fEXlow, fEXhigh, fEXlowd, fEXhighd, fEYlow, fEYhigh, fEYlowd, and fEYhighd arrays ...
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
TGraphBentErrors()
TGraphBentErrors default constructor.
Double_t * GetEXlow() const override
Double_t * fEYhigh
[fNpoints] array of Y high errors
Double_t * fEXlowd
[fNpoints] array of X low displacements
Double_t * fEYlowd
[fNpoints] array of Y low displacements
Bool_t CtorAllocate()
Should be called from ctors after fNpoints has been set.
Bool_t DoMerge(const TGraph *g) override
Protected function to perform the merge operation of a graph with asymmetric errors.
Double_t * GetEYhigh() const override
Double_t GetErrorXlow(Int_t bin) const override
Get low error on X[i].
Double_t * GetEYlow() const override
Double_t * GetEYhighd() const override
void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const override
Compute range.
Double_t * GetEXhigh() const override
Double_t * GetEYlowd() const override
Double_t * fEXhighd
[fNpoints] array of X high displacements
Double_t * GetEXhighd() const override
Double_t GetErrorXhigh(Int_t bin) const override
Get high error on X[i].
virtual void AddPointError(Double_t x, Double_t y, 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)
Add a point with bent errors to the graph.
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 * fEXlow
[fNpoints] array of X low errors
Double_t * fEXhigh
[fNpoints] array of X high errors
~TGraphBentErrors() override
TGraphBentErrors default destructor.
void Print(Option_t *chopt="") const override
Print graph and errors values.
void Scale(Double_t c1=1., Option_t *option="y") override
Multiply the values and errors of a TGraphBentErrors by a constant c1.
void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE) override
Set zero values for point arrays in the range [begin, end].
Double_t * GetEXlowd() const override
Double_t GetErrorY(Int_t bin) const override
It returns the error along Y at point i.
Double_t * fEYlow
[fNpoints] array of Y low errors
Double_t * fEYhighd
[fNpoints] array of Y high displacements
void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin) override
Copy and release.
void SwapPoints(Int_t pos1, Int_t pos2) override
Swap points.
Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend, Int_t obegin) override
Copy errors from fE*** to arrays[***] or to f*** Copy points.
Double_t GetErrorYlow(Int_t bin) const override
Get low error on Y[i].
Double_t GetErrorX(Int_t bin) const override
It returns the error along X at point i.
Double_t GetErrorYhigh(Int_t bin) const override
Get high error on Y[i].
void Apply(TF1 *f) override
Apply a function to all data points .
virtual void AddPoint(Double_t x, Double_t y)
Append a new point to the graph.
Int_t fNpoints
Number of points <= fMaxSize.
Int_t fMaxSize
!Current dimension of arrays fX and fY
virtual void FillZero(Int_t begin, Int_t end, Bool_t from_ctor=kTRUE)
TH1F * fHistogram
Pointer to histogram used for drawing axis.
virtual Bool_t DoMerge(const TGraph *g)
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
virtual void Scale(Double_t c1=1., Option_t *option="y")
Double_t * fY
[fNpoints] array of Y points
virtual void SwapPoints(Int_t pos1, Int_t pos2)
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y) const
virtual Bool_t CopyPoints(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
void SaveHistogramAndFunctions(std::ostream &out, const char *varname, Option_t *option)
Double_t * fX
[fNpoints] array of X points
static void SwapValues(Double_t *arr, Int_t pos1, Int_t pos2)
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
virtual void UpdateArrays(const std::vector< Int_t > &sorting_indices, Int_t numSortedPoints, Int_t low)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
static TString SavePrimitiveVector(std::ostream &out, const char *prefix, Int_t len, Double_t *arr, Int_t flag=0)
Save array in the output stream "out" as vector.
void ToLower()
Change string to lower-case.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.