ROOT logo
// @(#)root/hist:$Id: TGraphErrors.h 24702 2008-07-08 12:01:46Z brun $
// Author: Rene Brun   15/09/96

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGraphErrors
#define ROOT_TGraphErrors


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGraphErrors                                                         //
//                                                                      //
// a Graph with error bars                                              //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGraph
#include "TGraph.h"
#endif

class TGraphErrors : public TGraph {

protected:
   Double_t    *fEX;        //[fNpoints] array of X errors
   Double_t    *fEY;        //[fNpoints] array of Y errors

   virtual void       SwapPoints(Int_t pos1, Int_t pos2);

   virtual Double_t** Allocate(Int_t size);
   virtual void       CopyAndRelease(Double_t **newarrays,
                                     Int_t ibegin, Int_t iend, Int_t obegin);
   virtual Bool_t     CopyPoints(Double_t **arrays, Int_t ibegin, Int_t iend,
                                 Int_t obegin);
   Bool_t             CtorAllocate();
   virtual void       FillZero(Int_t begin, Int_t end,
                               Bool_t from_ctor = kTRUE);

public:
   TGraphErrors();
   TGraphErrors(Int_t n);
   TGraphErrors(Int_t n, const Float_t *x, const Float_t *y, const Float_t *ex=0, const Float_t *ey=0);
   TGraphErrors(Int_t n, const Double_t *x, const Double_t *y, const Double_t *ex=0, const Double_t *ey=0);
   TGraphErrors(const TVectorF &vx, const TVectorF &vy, const TVectorF &vex, const TVectorF &vey);
   TGraphErrors(const TVectorD &vx, const TVectorD &vy, const TVectorD &vex, const TVectorD &vey);
   TGraphErrors(const TGraphErrors &gr);
   TGraphErrors& operator=(const TGraphErrors &gr);
   TGraphErrors(const TH1 *h);
   TGraphErrors(const char *filename, const char *format="%lg %lg %lg %lg", Option_t *option="");
   virtual ~TGraphErrors();
   virtual void    Apply(TF1 *f);
   static Int_t    CalculateScanfFields(const char *fmt);
   virtual void    ComputeRange(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) const;
   Double_t        GetErrorX(Int_t bin)     const;
   Double_t        GetErrorY(Int_t bin)     const;
   Double_t        GetErrorXhigh(Int_t bin) const;
   Double_t        GetErrorXlow(Int_t bin)  const;
   Double_t        GetErrorYhigh(Int_t bin) const;
   Double_t        GetErrorYlow(Int_t bin)  const;
   Double_t       *GetEX() const {return fEX;}
   Double_t       *GetEY() const {return fEY;}
   virtual void    Print(Option_t *chopt="") const;
   virtual void    SavePrimitive(ostream &out, Option_t *option = "");
   virtual void    SetPointError(Double_t ex, Double_t ey);  // *MENU
   virtual void    SetPointError(Int_t i, Double_t ex, Double_t ey);

   ClassDef(TGraphErrors,3)  //A graph with error bars
};

inline Double_t **TGraphErrors::Allocate(Int_t size) {
   return AllocateArrays(4, size);
}

#endif
 TGraphErrors.h:1
 TGraphErrors.h:2
 TGraphErrors.h:3
 TGraphErrors.h:4
 TGraphErrors.h:5
 TGraphErrors.h:6
 TGraphErrors.h:7
 TGraphErrors.h:8
 TGraphErrors.h:9
 TGraphErrors.h:10
 TGraphErrors.h:11
 TGraphErrors.h:12
 TGraphErrors.h:13
 TGraphErrors.h:14
 TGraphErrors.h:15
 TGraphErrors.h:16
 TGraphErrors.h:17
 TGraphErrors.h:18
 TGraphErrors.h:19
 TGraphErrors.h:20
 TGraphErrors.h:21
 TGraphErrors.h:22
 TGraphErrors.h:23
 TGraphErrors.h:24
 TGraphErrors.h:25
 TGraphErrors.h:26
 TGraphErrors.h:27
 TGraphErrors.h:28
 TGraphErrors.h:29
 TGraphErrors.h:30
 TGraphErrors.h:31
 TGraphErrors.h:32
 TGraphErrors.h:33
 TGraphErrors.h:34
 TGraphErrors.h:35
 TGraphErrors.h:36
 TGraphErrors.h:37
 TGraphErrors.h:38
 TGraphErrors.h:39
 TGraphErrors.h:40
 TGraphErrors.h:41
 TGraphErrors.h:42
 TGraphErrors.h:43
 TGraphErrors.h:44
 TGraphErrors.h:45
 TGraphErrors.h:46
 TGraphErrors.h:47
 TGraphErrors.h:48
 TGraphErrors.h:49
 TGraphErrors.h:50
 TGraphErrors.h:51
 TGraphErrors.h:52
 TGraphErrors.h:53
 TGraphErrors.h:54
 TGraphErrors.h:55
 TGraphErrors.h:56
 TGraphErrors.h:57
 TGraphErrors.h:58
 TGraphErrors.h:59
 TGraphErrors.h:60
 TGraphErrors.h:61
 TGraphErrors.h:62
 TGraphErrors.h:63
 TGraphErrors.h:64
 TGraphErrors.h:65
 TGraphErrors.h:66
 TGraphErrors.h:67
 TGraphErrors.h:68
 TGraphErrors.h:69
 TGraphErrors.h:70
 TGraphErrors.h:71
 TGraphErrors.h:72
 TGraphErrors.h:73
 TGraphErrors.h:74
 TGraphErrors.h:75
 TGraphErrors.h:76
 TGraphErrors.h:77
 TGraphErrors.h:78
 TGraphErrors.h:79
 TGraphErrors.h:80