Logo ROOT  
Reference Guide
TGraphErrors.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: Rene Brun 15/09/96
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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_TGraphErrors
13 #define ROOT_TGraphErrors
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGraphErrors //
19 // //
20 // a Graph with error bars //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TGraph.h"
25 
26 class TGraphErrors : public TGraph {
27 
28 protected:
29  Double_t *fEX; ///<[fNpoints] array of X errors
30  Double_t *fEY; ///<[fNpoints] array of Y errors
31 
32  virtual void SwapPoints(Int_t pos1, Int_t pos2);
33 
34  virtual Double_t** Allocate(Int_t size);
35  virtual void CopyAndRelease(Double_t **newarrays,
36  Int_t ibegin, Int_t iend, Int_t obegin);
37  virtual Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend,
38  Int_t obegin);
40  virtual void FillZero(Int_t begin, Int_t end,
41  Bool_t from_ctor = kTRUE);
42  virtual Bool_t DoMerge(const TGraph * g);
43 
44 
45 public:
46  TGraphErrors();
48  TGraphErrors(Int_t n, const Float_t *x, const Float_t *y, const Float_t *ex=0, const Float_t *ey=0);
49  TGraphErrors(Int_t n, const Double_t *x, const Double_t *y, const Double_t *ex=0, const Double_t *ey=0);
50  TGraphErrors(const TVectorF &vx, const TVectorF &vy, const TVectorF &vex, const TVectorF &vey);
51  TGraphErrors(const TVectorD &vx, const TVectorD &vy, const TVectorD &vex, const TVectorD &vey);
54  TGraphErrors(const TH1 *h);
55  TGraphErrors(const char *filename, const char *format="%lg %lg %lg %lg", Option_t *option="");
56  virtual ~TGraphErrors();
57  virtual void Apply(TF1 *f);
58  virtual void ApplyX(TF1 *f);
59  static Int_t CalculateScanfFields(const char *fmt);
60  virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const;
61  Double_t GetErrorX(Int_t bin) const;
62  Double_t GetErrorY(Int_t bin) const;
63  Double_t GetErrorXhigh(Int_t bin) const;
64  Double_t GetErrorXlow(Int_t bin) const;
65  Double_t GetErrorYhigh(Int_t bin) const;
66  Double_t GetErrorYlow(Int_t bin) const;
67  Double_t *GetEX() const {return fEX;}
68  Double_t *GetEY() const {return fEY;}
69  virtual Int_t Merge(TCollection* list);
70  virtual void Print(Option_t *chopt="") const;
71  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
72  virtual void SetPointError(Double_t ex, Double_t ey); // *MENU
73  virtual void SetPointError(Int_t i, Double_t ex, Double_t ey);
74 
75  ClassDef(TGraphErrors,3) //A graph with error bars
76 };
77 
79  return AllocateArrays(4, size);
80 }
81 
82 #endif
ex
Double_t ex[n]
Definition: legend1.C:17
n
const Int_t n
Definition: legend1.C:16
TGraphErrors::Allocate
virtual Double_t ** Allocate(Int_t size)
Allocate internal data structures for newsize points.
Definition: TGraphErrors.h:78
ymax
float ymax
Definition: THbookFile.cxx:95
TGraphErrors::Apply
virtual void Apply(TF1 *f)
apply function to all the data points y = f(x,y)
Definition: TGraphErrors.cxx:385
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGraphErrors::CopyPoints
virtual Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy errors from fEX and fEY to arrays[0] and arrays[1] or to fX and fY.
Definition: TGraphErrors.cxx:522
f
#define f(i)
Definition: RSha256.hxx:104
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGraphErrors::fEX
Double_t * fEX
[fNpoints] array of X errors
Definition: TGraphErrors.h:29
TGraphErrors::GetErrorY
Double_t GetErrorY(Int_t bin) const
This function is called by GraphFitChisquare.
Definition: TGraphErrors.cxx:614
TGraph.h
xmax
float xmax
Definition: THbookFile.cxx:95
TGraphErrors::GetEX
Double_t * GetEX() const
Definition: TGraphErrors.h:67
Float_t
float Float_t
Definition: RtypesCore.h:57
TGraphErrors::FillZero
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].
Definition: TGraphErrors.cxx:587
Int_t
int Int_t
Definition: RtypesCore.h:45
x
Double_t x[n]
Definition: legend1.C:17
TGraphErrors::~TGraphErrors
virtual ~TGraphErrors()
TGraphErrors default destructor.
Definition: TGraphErrors.cxx:365
TGraphErrors::GetErrorYhigh
Double_t GetErrorYhigh(Int_t bin) const
This function is called by GraphFitChisquare.
Definition: TGraphErrors.cxx:650
TGraphErrors::ComputeRange
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Compute range.
Definition: TGraphErrors.cxx:470
bool
TGraphErrors::fEY
Double_t * fEY
[fNpoints] array of Y errors
Definition: TGraphErrors.h:30
TGraphErrors::Print
virtual void Print(Option_t *chopt="") const
Print graph and errors values.
Definition: TGraphErrors.cxx:702
TGraphErrors::TGraphErrors
TGraphErrors()
TGraphErrors default constructor.
Definition: TGraphErrors.cxx:69
TGraphErrors::GetErrorXhigh
Double_t GetErrorXhigh(Int_t bin) const
This function is called by GraphFitChisquare.
Definition: TGraphErrors.cxx:626
TGraphErrors::GetEY
Double_t * GetEY() const
Definition: TGraphErrors.h:68
xmin
float xmin
Definition: THbookFile.cxx:95
h
#define h(i)
Definition: RSha256.hxx:106
gr
TGraphErrors * gr
Definition: legend1.C:25
TGraphErrors::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: TGraphErrors.cxx:713
TGraphErrors::GetErrorXlow
Double_t GetErrorXlow(Int_t bin) const
This function is called by GraphFitChisquare.
Definition: TGraphErrors.cxx:638
TGraphErrors::DoMerge
virtual Bool_t DoMerge(const TGraph *g)
protected function to perform the merge operation of a graph with errors
Definition: TGraphErrors.cxx:562
y
Double_t y[n]
Definition: legend1.C:17
ey
Double_t ey[n]
Definition: legend1.C:17
TGraphErrors::CtorAllocate
Bool_t CtorAllocate()
Constructor allocate.
Definition: TGraphErrors.cxx:546
TGraphErrors::GetErrorYlow
Double_t GetErrorYlow(Int_t bin) const
This function is called by GraphFitChisquare.
Definition: TGraphErrors.cxx:662
TGraphErrors::CalculateScanfFields
static Int_t CalculateScanfFields(const char *fmt)
Calculate scan fields.
Definition: TGraphErrors.cxx:439
ymin
float ymin
Definition: THbookFile.cxx:95
TGraphErrors::SetPointError
virtual void SetPointError(Double_t ex, Double_t ey)
Set ex and ey values for point pointed by the mouse.
Definition: TGraphErrors.cxx:792
TGraphErrors::operator=
TGraphErrors & operator=(const TGraphErrors &gr)
TGraphErrors assignment operator.
Definition: TGraphErrors.cxx:182
TVectorT
TVectorT.
Definition: TVectorT.h:27
Double_t
double Double_t
Definition: RtypesCore.h:59
TGraph::AllocateArrays
Double_t ** AllocateArrays(Int_t Narrays, Int_t arraySize)
Allocate arrays.
Definition: TGraph.cxx:544
TGraph
A TGraph is an object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
TGraphErrors
A TGraphErrors is a TGraph with error bars.
Definition: TGraphErrors.h:26
TGraphErrors::Merge
virtual Int_t Merge(TCollection *list)
Adds all graphs with errors from the collection to this graph.
Definition: TGraphErrors.cxx:673
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGraphErrors::SwapPoints
virtual void SwapPoints(Int_t pos1, Int_t pos2)
Swap points.
Definition: TGraphErrors.cxx:875
TH1
TH1 is the base class of all histogramm classes in ROOT.
Definition: TH1.h:58
TGraphErrors::CopyAndRelease
virtual void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy and release.
Definition: TGraphErrors.cxx:500
TGraphErrors::ApplyX
virtual void ApplyX(TF1 *f)
apply function to all the data points x = f(x,y)
Definition: TGraphErrors.cxx:416
TCollection
Collection abstract base class.
Definition: TCollection.h:63
TGraphErrors::GetErrorX
Double_t GetErrorX(Int_t bin) const
This function is called by GraphFitChisquare.
Definition: TGraphErrors.cxx:602
TF1
1-Dim function class
Definition: TF1.h:213
int
g
#define g(i)
Definition: RSha256.hxx:105