ROOT logo
// @(#)root/hist:$Id: TGraph2D.h,v 1.00
// Author: Olivier Couet

/*************************************************************************
 * 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_TGraph2D
#define ROOT_TGraph2D


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGraph2D                                                             //
//                                                                      //
// Graph 2D graphics class.                                             //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_TVirtualHistPainter
#include "TVirtualHistPainter.h"
#endif
#ifndef ROOT_TAttLine
#include "TAttLine.h"
#endif
#ifndef ROOT_TAttFill
#include "TAttFill.h"
#endif
#ifndef ROOT_TAttMarker
#include "TAttMarker.h"
#endif

class TAxis;
class TList;
class TF2;
class TH2;
class TH2D;
class TView;
class TDirectory;

#include "TFitResultPtr.h"

class TGraph2D : public TNamed, public TAttLine, public TAttFill, public TAttMarker {

protected:

   Int_t       fNpoints;          // Number of points in the data set
   Int_t       fNpx;              // Number of bins along X in fHistogram
   Int_t       fNpy;              // Number of bins along Y in fHistogram
   Int_t       fMaxIter;          // Maximum number of iterations to find Delaunay triangles
   Int_t       fSize;             //!Real size of fX, fY and fZ
   Double_t   *fX;                //[fNpoints]
   Double_t   *fY;                //[fNpoints] Data set to be plotted
   Double_t   *fZ;                //[fNpoints]
   Double_t    fMinimum;          // Minimum value for plotting along z
   Double_t    fMaximum;          // Maximum value for plotting along z
   Double_t    fMargin;           // Extra space (in %) around interpolated area for fHistogram
   Double_t    fZout;             // fHistogram bin height for points lying outside the interpolated area
   TList      *fFunctions;        // Pointer to list of functions (fits and user)
   TH2D       *fHistogram;        //!2D histogram of z values linearly interpolated on the triangles
   TDirectory *fDirectory;        //!Pointer to directory holding this 2D graph
   TVirtualHistPainter *fPainter; //!Pointer to histogram painter

   void     Build(Int_t n);

private:

   Bool_t      fUserHisto;   // True when SetHistogram has been called

protected:

public:

   TGraph2D();
   TGraph2D(Int_t n);
   TGraph2D(Int_t n, Int_t *x, Int_t *y, Int_t *z);
   TGraph2D(Int_t n, Float_t *x, Float_t *y, Float_t *z);
   TGraph2D(Int_t n, Double_t *x, Double_t *y, Double_t *z);
   TGraph2D(TH2 *h2);
   TGraph2D(const char *name, const char *title, Int_t n, Double_t *x, Double_t *y, Double_t *z);
   TGraph2D(const char *filename, const char *format="%lg %lg %lg", Option_t *option="");
   TGraph2D(const TGraph2D &);

   virtual ~TGraph2D();

   TGraph2D& operator=(const TGraph2D &);

   virtual void          Browse(TBrowser *);
   virtual void          Clear(Option_t *option="");
   virtual void          DirectoryAutoAdd(TDirectory *);
   Int_t                 DistancetoPrimitive(Int_t px, Int_t py);
   virtual void          Draw(Option_t *option="");
   void                  ExecuteEvent(Int_t event, Int_t px, Int_t py);
   virtual TObject      *FindObject(const char *name) const;
   virtual TObject      *FindObject(const TObject *obj) const;
   virtual TFitResultPtr Fit(const char *formula ,Option_t *option="" ,Option_t *goption=""); // *MENU*
   virtual TFitResultPtr Fit(TF2 *f2 ,Option_t *option="" ,Option_t *goption=""); // *MENU*
   virtual void          FitPanel(); // *MENU*
   TList                *GetContourList(Double_t contour);
   TDirectory           *GetDirectory() const {return fDirectory;}
   Int_t                 GetNpx() const {return fNpx;}
   Int_t                 GetNpy() const {return fNpy;}
   TH2D                 *GetHistogram(Option_t *option="");
   TList                *GetListOfFunctions() const { return fFunctions; }
   virtual Double_t      GetErrorX(Int_t bin) const;
   virtual Double_t      GetErrorY(Int_t bin) const;
   virtual Double_t      GetErrorZ(Int_t bin) const;
   Double_t              GetMargin() const {return fMargin;}
   Double_t              GetMaximum() const {return fMaximum;};
   Double_t              GetMinimum() const {return fMinimum;};
   TAxis                *GetXaxis() const ;
   TAxis                *GetYaxis() const ;
   TAxis                *GetZaxis() const ;
   Int_t                 GetN() const {return fNpoints;}
   Double_t             *GetX() const {return fX;}
   Double_t             *GetY() const {return fY;}
   Double_t             *GetZ() const {return fZ;}
   virtual Double_t     *GetEX() const {return 0;}
   virtual Double_t     *GetEY() const {return 0;}
   virtual Double_t     *GetEZ() const {return 0;}
   Double_t              GetXmax() const;
   Double_t              GetXmin() const;
   Double_t              GetYmax() const;
   Double_t              GetYmin() const;
   Double_t              GetZmax() const;
   Double_t              GetZmin() const;
   virtual Double_t      GetXmaxE() const {return GetXmax();};
   virtual Double_t      GetXminE() const {return GetXmin();};
   virtual Double_t      GetYmaxE() const {return GetYmax();};
   virtual Double_t      GetYminE() const {return GetYmin();};
   virtual Double_t      GetZmaxE() const {return GetZmax();};
   virtual Double_t      GetZminE() const {return GetZmin();};
   Double_t              Interpolate(Double_t x, Double_t y);
   void                  Paint(Option_t *option="");
   TH1                  *Project(Option_t *option="x") const; // *MENU*
   Int_t                 RemovePoint(Int_t ipoint); // *MENU*
   virtual void          SavePrimitive(ostream &out, Option_t *option = "");
   virtual void          Set(Int_t n);
   virtual void          SetDirectory(TDirectory *dir);
   virtual void          SetHistogram(TH2 *h);
   void                  SetMargin(Double_t m=0.1); // *MENU*
   void                  SetMarginBinsContent(Double_t z=0.); // *MENU*
   void                  SetMaximum(Double_t maximum=-1111); // *MENU*
   void                  SetMinimum(Double_t minimum=-1111); // *MENU*
   void                  SetMaxIter(Int_t n=100000) {fMaxIter = n;} // *MENU*
   virtual void          SetName(const char *name); // *MENU*
   virtual void          SetNameTitle(const char *name, const char *title);
   void                  SetNpx(Int_t npx=40); // *MENU*
   void                  SetNpy(Int_t npx=40); // *MENU*
   virtual void          SetPoint(Int_t point, Double_t x, Double_t y, Double_t z); // *MENU*
   virtual void          SetTitle(const char *title=""); // *MENU*

   ClassDef(TGraph2D,1)  //Set of n x[n],y[n],z[n] points with 3-d graphics including Delaunay triangulation
};

#endif
 TGraph2D.h:1
 TGraph2D.h:2
 TGraph2D.h:3
 TGraph2D.h:4
 TGraph2D.h:5
 TGraph2D.h:6
 TGraph2D.h:7
 TGraph2D.h:8
 TGraph2D.h:9
 TGraph2D.h:10
 TGraph2D.h:11
 TGraph2D.h:12
 TGraph2D.h:13
 TGraph2D.h:14
 TGraph2D.h:15
 TGraph2D.h:16
 TGraph2D.h:17
 TGraph2D.h:18
 TGraph2D.h:19
 TGraph2D.h:20
 TGraph2D.h:21
 TGraph2D.h:22
 TGraph2D.h:23
 TGraph2D.h:24
 TGraph2D.h:25
 TGraph2D.h:26
 TGraph2D.h:27
 TGraph2D.h:28
 TGraph2D.h:29
 TGraph2D.h:30
 TGraph2D.h:31
 TGraph2D.h:32
 TGraph2D.h:33
 TGraph2D.h:34
 TGraph2D.h:35
 TGraph2D.h:36
 TGraph2D.h:37
 TGraph2D.h:38
 TGraph2D.h:39
 TGraph2D.h:40
 TGraph2D.h:41
 TGraph2D.h:42
 TGraph2D.h:43
 TGraph2D.h:44
 TGraph2D.h:45
 TGraph2D.h:46
 TGraph2D.h:47
 TGraph2D.h:48
 TGraph2D.h:49
 TGraph2D.h:50
 TGraph2D.h:51
 TGraph2D.h:52
 TGraph2D.h:53
 TGraph2D.h:54
 TGraph2D.h:55
 TGraph2D.h:56
 TGraph2D.h:57
 TGraph2D.h:58
 TGraph2D.h:59
 TGraph2D.h:60
 TGraph2D.h:61
 TGraph2D.h:62
 TGraph2D.h:63
 TGraph2D.h:64
 TGraph2D.h:65
 TGraph2D.h:66
 TGraph2D.h:67
 TGraph2D.h:68
 TGraph2D.h:69
 TGraph2D.h:70
 TGraph2D.h:71
 TGraph2D.h:72
 TGraph2D.h:73
 TGraph2D.h:74
 TGraph2D.h:75
 TGraph2D.h:76
 TGraph2D.h:77
 TGraph2D.h:78
 TGraph2D.h:79
 TGraph2D.h:80
 TGraph2D.h:81
 TGraph2D.h:82
 TGraph2D.h:83
 TGraph2D.h:84
 TGraph2D.h:85
 TGraph2D.h:86
 TGraph2D.h:87
 TGraph2D.h:88
 TGraph2D.h:89
 TGraph2D.h:90
 TGraph2D.h:91
 TGraph2D.h:92
 TGraph2D.h:93
 TGraph2D.h:94
 TGraph2D.h:95
 TGraph2D.h:96
 TGraph2D.h:97
 TGraph2D.h:98
 TGraph2D.h:99
 TGraph2D.h:100
 TGraph2D.h:101
 TGraph2D.h:102
 TGraph2D.h:103
 TGraph2D.h:104
 TGraph2D.h:105
 TGraph2D.h:106
 TGraph2D.h:107
 TGraph2D.h:108
 TGraph2D.h:109
 TGraph2D.h:110
 TGraph2D.h:111
 TGraph2D.h:112
 TGraph2D.h:113
 TGraph2D.h:114
 TGraph2D.h:115
 TGraph2D.h:116
 TGraph2D.h:117
 TGraph2D.h:118
 TGraph2D.h:119
 TGraph2D.h:120
 TGraph2D.h:121
 TGraph2D.h:122
 TGraph2D.h:123
 TGraph2D.h:124
 TGraph2D.h:125
 TGraph2D.h:126
 TGraph2D.h:127
 TGraph2D.h:128
 TGraph2D.h:129
 TGraph2D.h:130
 TGraph2D.h:131
 TGraph2D.h:132
 TGraph2D.h:133
 TGraph2D.h:134
 TGraph2D.h:135
 TGraph2D.h:136
 TGraph2D.h:137
 TGraph2D.h:138
 TGraph2D.h:139
 TGraph2D.h:140
 TGraph2D.h:141
 TGraph2D.h:142
 TGraph2D.h:143
 TGraph2D.h:144
 TGraph2D.h:145
 TGraph2D.h:146
 TGraph2D.h:147
 TGraph2D.h:148
 TGraph2D.h:149
 TGraph2D.h:150
 TGraph2D.h:151
 TGraph2D.h:152
 TGraph2D.h:153
 TGraph2D.h:154
 TGraph2D.h:155
 TGraph2D.h:156
 TGraph2D.h:157
 TGraph2D.h:158
 TGraph2D.h:159
 TGraph2D.h:160
 TGraph2D.h:161
 TGraph2D.h:162
 TGraph2D.h:163