Logo ROOT   6.08/07
Reference Guide
TGraphAsymmErrors.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: Rene Brun 03/03/99
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_TGraphAsymmErrors
13 #define ROOT_TGraphAsymmErrors
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGraphAsymmErrors //
19 // //
20 // a Graph with asymmetric error bars //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TGraph
25 #include "TGraph.h"
26 #endif
27 
28 class TGraphAsymmErrors : public TGraph {
29 
30 protected:
31  Double_t *fEXlow; //[fNpoints] array of X low errors
32  Double_t *fEXhigh; //[fNpoints] array of X high errors
33  Double_t *fEYlow; //[fNpoints] array of Y low errors
34  Double_t *fEYhigh; //[fNpoints] array of Y high errors
35 
36  virtual void SwapPoints(Int_t pos1, Int_t pos2);
37 
38  virtual Double_t** Allocate(Int_t size);
39  virtual void CopyAndRelease(Double_t **newarrays,
40  Int_t ibegin, Int_t iend, Int_t obegin);
41  virtual Bool_t CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend,
42  Int_t obegin);
44  virtual void FillZero(Int_t begin, Int_t end,
45  Bool_t from_ctor = kTRUE);
46  virtual Bool_t DoMerge(const TGraph * g);
47 
48 public:
51  TGraphAsymmErrors(Int_t n, const Float_t *x, const Float_t *y, const Float_t *exl=0, const Float_t *exh=0, const Float_t *eyl=0, const Float_t *eyh=0);
52  TGraphAsymmErrors(Int_t n, const Double_t *x, const Double_t *y, const Double_t *exl=0, const Double_t *exh=0, const Double_t *eyl=0, const Double_t *eyh=0);
53  TGraphAsymmErrors(const TVectorF &vx, const TVectorF &vy, const TVectorF &vexl, const TVectorF &vexh, const TVectorF &veyl, const TVectorF &veyh);
54  TGraphAsymmErrors(const TVectorD &vx, const TVectorD &vy, const TVectorD &vexl, const TVectorD &vexh, const TVectorD &veyl, const TVectorD &veyh);
57  TGraphAsymmErrors(const TH1 *h);
58  TGraphAsymmErrors(const TH1* pass, const TH1* total, Option_t *option="");
59  TGraphAsymmErrors(const char *filename, const char *format="%lg %lg %lg %lg %lg %lg", Option_t *option="");
60 
61  virtual ~TGraphAsymmErrors();
62 
63  virtual void Apply(TF1 *f);
64  virtual void BayesDivide(const TH1* pass, const TH1* total, Option_t *opt="");
65  virtual void Divide(const TH1* pass, const TH1* total, Option_t *opt="cp");
66  virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const;
67  Double_t GetErrorX(Int_t bin) const;
68  Double_t GetErrorY(Int_t bin) const;
69  Double_t GetErrorXlow(Int_t i) const;
70  Double_t GetErrorXhigh(Int_t i) const;
71  Double_t GetErrorYlow(Int_t i) const;
72  Double_t GetErrorYhigh(Int_t i) const;
73  Double_t *GetEXlow() const {return fEXlow;}
74  Double_t *GetEXhigh() const {return fEXhigh;}
75  Double_t *GetEYlow() const {return fEYlow;}
76  Double_t *GetEYhigh() const {return fEYhigh;}
77  virtual Int_t Merge(TCollection* list);
78  virtual void Print(Option_t *chopt="") const;
79  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
80  virtual void SetPointError(Double_t exl, Double_t exh, Double_t eyl, Double_t eyh); // *MENU*
81  virtual void SetPointError(Int_t i, Double_t exl, Double_t exh, Double_t eyl, Double_t eyh);
82  virtual void SetPointEXlow(Int_t i, Double_t exl);
83  virtual void SetPointEXhigh(Int_t i, Double_t exh);
84  virtual void SetPointEYlow(Int_t i, Double_t eyl);
85  virtual void SetPointEYhigh(Int_t i, Double_t eyh);
86 
87  ClassDef(TGraphAsymmErrors,3) //A graph with asymmetric error bars
88 };
89 
91  return AllocateArrays(6, size);
92 }
93 
94 #endif
Double_t * GetEXlow() const
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.
float xmin
Definition: THbookFile.cxx:93
virtual void ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const
Compute Range.
Double_t GetErrorY(Int_t bin) const
This function is called by GraphFitChisquare.
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
Double_t GetErrorX(Int_t bin) const
This function is called by GraphFitChisquare.
float ymin
Definition: THbookFile.cxx:93
Double_t GetErrorYlow(Int_t i) const
Get low error on Y.
virtual void CopyAndRelease(Double_t **newarrays, Int_t ibegin, Int_t iend, Int_t obegin)
Copy and release.
TH1 * h
Definition: legend2.C:5
TVectorT.
Definition: TMatrixTBase.h:89
Double_t GetErrorYhigh(Int_t i) const
Get high error on Y.
virtual Int_t Merge(TCollection *list)
Adds all graphs with asymmetric errors from the collection to this graph.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Bool_t CtorAllocate()
Should be called from ctors after fNpoints has been set Note: This function should be called only fro...
static std::string format(double x, double y, int digits, int width)
Double_t GetErrorXhigh(Int_t i) const
Get high error on X.
virtual Double_t ** Allocate(Int_t size)
TGraph with asymmetric error bars.
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void SetPointEXhigh(Int_t i, Double_t exh)
Set EXhigh for point i.
virtual void SetPointEYlow(Int_t i, Double_t eyl)
Set EYlow for point i.
virtual Bool_t DoMerge(const TGraph *g)
protected function to perform the merge operation of a graph with asymmetric errors ...
virtual void Apply(TF1 *f)
Apply a function to all data points y = f(x,y)
virtual ~TGraphAsymmErrors()
TGraphAsymmErrors default destructor.
virtual void BayesDivide(const TH1 *pass, const TH1 *total, Option_t *opt="")
This function is only kept for backward compatibility.
float ymax
Definition: THbookFile.cxx:93
virtual void SwapPoints(Int_t pos1, Int_t pos2)
Swap points.
Collection abstract base class.
Definition: TCollection.h:48
virtual void Divide(const TH1 *pass, const TH1 *total, Option_t *opt="cp")
Fill this TGraphAsymmErrors by dividing two 1-dimensional histograms pass/total.
float xmax
Definition: THbookFile.cxx:93
TGraphErrors * gr
Definition: legend1.C:25
Double_t GetErrorXlow(Int_t i) const
Get low error on X.
static unsigned int total
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)
TGraphAsymmErrors & operator=(const TGraphAsymmErrors &gr)
TGraphAsymmErrors assignment operator.
double f(double x)
TGraphAsymmErrors()
TGraphAsymmErrors default constructor.
double Double_t
Definition: RtypesCore.h:55
Double_t y[n]
Definition: legend1.C:17
The TH1 histogram class.
Definition: TH1.h:80
virtual void SetPointEXlow(Int_t i, Double_t exl)
Set EXlow for point i.
Double_t * GetEYlow() const
Double_t * GetEYhigh() const
1-Dim function class
Definition: TF1.h:149
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:53
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Double_t * GetEXhigh() const
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void Print(Option_t *chopt="") const
Print graph and errors values.
Double_t ** AllocateArrays(Int_t Narrays, Int_t arraySize)
Allocate arrays.
Definition: TGraph.cxx:529
const Int_t n
Definition: legend1.C:16
virtual void SetPointEYhigh(Int_t i, Double_t eyh)
Set EYhigh for point i.
virtual void SetPointError(Double_t exl, Double_t exh, Double_t eyl, Double_t eyh)
Set ex and ey values for point pointed by the mouse.