Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGraphBentErrors.h
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Dave Morrison 30/06/2003
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGraphBentErrors
13#define ROOT_TGraphBentErrors
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TGraphBentErrors //
18// //
19// a Graph with bent, asymmetric error bars //
20// //
21//////////////////////////////////////////////////////////////////////////
22
23#include "TGraph.h"
24
25class TGraphBentErrors : public TGraph {
26
27protected:
28 Double_t *fEXlow; ///<[fNpoints] array of X low errors
29 Double_t *fEXhigh; ///<[fNpoints] array of X high errors
30 Double_t *fEYlow; ///<[fNpoints] array of Y low errors
31 Double_t *fEYhigh; ///<[fNpoints] array of Y high errors
32
33 Double_t *fEXlowd; ///<[fNpoints] array of X low displacements
34 Double_t *fEXhighd; ///<[fNpoints] array of X high displacements
35 Double_t *fEYlowd; ///<[fNpoints] array of Y low displacements
36 Double_t *fEYhighd; ///<[fNpoints] array of Y high displacements
37
38 void SwapPoints(Int_t pos1, Int_t pos2) override;
39 void UpdateArrays(const std::vector<Int_t> &sorting_indices, Int_t numSortedPoints, Int_t low) override;
40
41 Double_t** Allocate(Int_t size) override;
42 void CopyAndRelease(Double_t **newarrays,
43 Int_t ibegin, Int_t iend, Int_t obegin) override;
44 Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend,
45 Int_t obegin) override;
47 void FillZero(Int_t begin, Int_t end,
48 Bool_t from_ctor = kTRUE) override;
49 Bool_t DoMerge(const TGraph * g) override;
50
51
52public:
56 const Float_t *x, const Float_t *y,
57 const Float_t *exl=nullptr, const Float_t *exh=nullptr,
58 const Float_t *eyl=nullptr, const Float_t *eyh=nullptr,
59 const Float_t *exld=nullptr, const Float_t *exhd=nullptr,
60 const Float_t *eyld=nullptr, const Float_t *eyhd=nullptr);
62 const Double_t *x, const Double_t *y,
63 const Double_t *exl=nullptr, const Double_t *exh=nullptr,
64 const Double_t *eyl=nullptr, const Double_t *eyh=nullptr,
65 const Double_t *exld=nullptr, const Double_t *exhd=nullptr,
66 const Double_t *eyld=nullptr, const Double_t *eyhd=nullptr);
68 ~TGraphBentErrors() override;
69 virtual void AddPointError(Double_t x, Double_t y, Double_t exl, Double_t exh, Double_t eyl, Double_t eyh,
70 Double_t exld = 0, Double_t exhd = 0, Double_t eyld = 0, Double_t eyhd = 0);
71 void Apply(TF1 *f) override;
73 Double_t &xmax, Double_t &ymax) const override;
74 Double_t GetErrorX(Int_t bin) const override;
75 Double_t GetErrorY(Int_t bin) const override;
76 Double_t GetErrorXlow(Int_t bin) const override;
77 Double_t GetErrorXhigh(Int_t bin) const override;
78 Double_t GetErrorYlow(Int_t bin) const override;
79 Double_t GetErrorYhigh(Int_t bin) const override;
80 Double_t *GetEXlow() const override {return fEXlow;}
81 Double_t *GetEXhigh() const override {return fEXhigh;}
82 Double_t *GetEYlow() const override {return fEYlow;}
83 Double_t *GetEYhigh() const override {return fEYhigh;}
84 Double_t *GetEXlowd() const override {return fEXlowd;}
85 Double_t *GetEXhighd() const override {return fEXhighd;}
86 Double_t *GetEYlowd() const override {return fEYlowd;}
87 Double_t *GetEYhighd() const override {return fEYhighd;}
88 void Print(Option_t *chopt="") const override;
89 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
90 void Scale(Double_t c1=1., Option_t *option="y") override; // *MENU*
91 virtual void SetPointError(Double_t exl, Double_t exh,
92 Double_t eyl, Double_t eyh,
93 Double_t exld=0, Double_t exhd=0,
94 Double_t eyld=0, Double_t eyhd=0); // *MENU*
95 virtual void SetPointError(Int_t i,
96 Double_t exl, Double_t exh,
97 Double_t eyl, Double_t eyh,
98 Double_t exld=0, Double_t exhd=0,
99 Double_t eyld=0, Double_t eyhd=0);
100
101 ClassDefOverride(TGraphBentErrors,1) //A graph with bent, asymmetric error bars
102};
103
105 return AllocateArrays(10, size);
106}
107
108#endif
#define f(i)
Definition RSha256.hxx:104
#define g(i)
Definition RSha256.hxx:105
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
float xmin
float ymin
float xmax
float ymax
1-Dim function class
Definition TF1.h:233
A TGraphBentErrors is a TGraph with bent, asymmetric error bars.
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 array...
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.
Double_t ** Allocate(Int_t size) override
Allocate internal data structures for newsize 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 * 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 .
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
Double_t ** AllocateArrays(Int_t Narrays, Int_t arraySize)
Allocate arrays.
Definition TGraph.cxx:598
Double_t y[n]
Definition legend1.C:17
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
TGraphErrors * gr
Definition legend1.C:25