TGraph2D.h

Go to the documentation of this file.
00001 // @(#)root/hist:$Id: TGraph2D.h,v 1.00
00002 // Author: Olivier Couet
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGraph2D
00013 #define ROOT_TGraph2D
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TGraph2D                                                             //
00019 //                                                                      //
00020 // Graph 2D graphics class.                                             //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TNamed
00025 #include "TNamed.h"
00026 #endif
00027 #ifndef ROOT_TVirtualHistPainter
00028 #include "TVirtualHistPainter.h"
00029 #endif
00030 #ifndef ROOT_TAttLine
00031 #include "TAttLine.h"
00032 #endif
00033 #ifndef ROOT_TAttFill
00034 #include "TAttFill.h"
00035 #endif
00036 #ifndef ROOT_TAttMarker
00037 #include "TAttMarker.h"
00038 #endif
00039 
00040 class TAxis;
00041 class TList;
00042 class TF2;
00043 class TH2;
00044 class TH2D;
00045 class TView;
00046 class TDirectory;
00047 
00048 #include "TFitResultPtr.h"
00049 
00050 class TGraph2D : public TNamed, public TAttLine, public TAttFill, public TAttMarker {
00051 
00052 protected:
00053 
00054    Int_t       fNpoints;     // Number of points in the data set
00055    Int_t       fNpx;         // Number of bins along X in fHistogram
00056    Int_t       fNpy;         // Number of bins along Y in fHistogram
00057    Int_t       fMaxIter;     // Maximum number of iterations to find Delaunay t>
00058    Int_t       fSize;        //!Real size of fX, fY and fZ
00059    Double_t   *fX;           //[fNpoints]
00060    Double_t   *fY;           //[fNpoints] Data set to be plotted
00061    Double_t   *fZ;           //[fNpoints]
00062    Double_t    fMinimum;     // Minimum value for plotting along z
00063    Double_t    fMaximum;     // Maximum value for plotting along z
00064    Double_t    fMargin;      // Extra space (in %) around interpolated area for fHistogram
00065    Double_t    fZout;        // fHistogram bin height for points lying outside the interpolated area
00066    TList      *fFunctions;   // Pointer to list of functions (fits and user)
00067    TH2D       *fHistogram;   //!2D histogram of z values linearly interpolated
00068    TDirectory *fDirectory;   //!Pointer to directory holding this 2D graph
00069    TVirtualHistPainter *fPainter;  //!pointer to histogram painter
00070 
00071    void     Build(Int_t n);
00072 
00073 private:
00074 
00075    Bool_t      fUserHisto;   // True when SetHistogram has been called
00076 
00077 protected:
00078 
00079 public:
00080 
00081    TGraph2D();
00082    TGraph2D(Int_t n);
00083    TGraph2D(Int_t n, Int_t *x, Int_t *y, Int_t *z);
00084    TGraph2D(Int_t n, Float_t *x, Float_t *y, Float_t *z);
00085    TGraph2D(Int_t n, Double_t *x, Double_t *y, Double_t *z);
00086    TGraph2D(TH2 *h2);
00087    TGraph2D(const char *name, const char *title, Int_t n, Double_t *x, Double_t *y, Double_t *z);
00088    TGraph2D(const char *filename, const char *format="%lg %lg %lg", Option_t *option="");
00089    TGraph2D(const TGraph2D &);
00090 
00091    virtual ~TGraph2D();
00092 
00093    TGraph2D& operator=(const TGraph2D &);
00094 
00095    virtual void          Clear(Option_t *option="");
00096    virtual void          DirectoryAutoAdd(TDirectory *);
00097    Int_t                 DistancetoPrimitive(Int_t px, Int_t py);
00098    virtual void          Draw(Option_t *option="");
00099    void                  ExecuteEvent(Int_t event, Int_t px, Int_t py);
00100    virtual TObject      *FindObject(const char *name) const;
00101    virtual TObject      *FindObject(const TObject *obj) const;
00102    virtual TFitResultPtr Fit(const char *formula ,Option_t *option="" ,Option_t *goption=""); // *MENU*
00103    virtual TFitResultPtr Fit(TF2 *f2 ,Option_t *option="" ,Option_t *goption=""); // *MENU*
00104    virtual void          FitPanel(); // *MENU*
00105    TList                *GetContourList(Double_t contour);
00106    TDirectory           *GetDirectory() const {return fDirectory;}
00107    Int_t                 GetNpx() const {return fNpx;}
00108    Int_t                 GetNpy() const {return fNpy;}
00109    TH2D                 *GetHistogram(Option_t *option="");
00110    TList                *GetListOfFunctions() const { return fFunctions; }
00111    virtual Double_t      GetErrorX(Int_t bin) const;
00112    virtual Double_t      GetErrorY(Int_t bin) const;
00113    virtual Double_t      GetErrorZ(Int_t bin) const;
00114    Double_t              GetMargin() const {return fMargin;}
00115    TAxis                *GetXaxis() const ;
00116    TAxis                *GetYaxis() const ;
00117    TAxis                *GetZaxis() const ;
00118    Int_t                 GetN() const {return fNpoints;}
00119    Double_t             *GetX() const {return fX;}
00120    Double_t             *GetY() const {return fY;}
00121    Double_t             *GetZ() const {return fZ;}
00122    virtual Double_t     *GetEX() const {return 0;}
00123    virtual Double_t     *GetEY() const {return 0;}
00124    virtual Double_t     *GetEZ() const {return 0;}
00125    Double_t              GetXmax() const;
00126    Double_t              GetXmin() const;
00127    Double_t              GetYmax() const;
00128    Double_t              GetYmin() const;
00129    Double_t              GetZmax() const;
00130    Double_t              GetZmin() const;
00131    virtual Double_t      GetXmaxE() const {return GetXmax();};
00132    virtual Double_t      GetXminE() const {return GetXmin();};
00133    virtual Double_t      GetYmaxE() const {return GetYmax();};
00134    virtual Double_t      GetYminE() const {return GetYmin();};
00135    virtual Double_t      GetZmaxE() const {return GetZmax();};
00136    virtual Double_t      GetZminE() const {return GetZmin();};
00137    Double_t              Interpolate(Double_t x, Double_t y);
00138    void                  Paint(Option_t *option="");
00139    TH1                  *Project(Option_t *option="x") const; // *MENU*
00140    Int_t                 RemovePoint(Int_t ipoint); // *MENU*
00141    virtual void          SavePrimitive(ostream &out, Option_t *option = "");
00142    virtual void          Set(Int_t n);
00143    virtual void          SetDirectory(TDirectory *dir);
00144    virtual void          SetHistogram(TH2 *h);
00145    void                  SetMargin(Double_t m=0.1); // *MENU*
00146    void                  SetMarginBinsContent(Double_t z=0.); // *MENU*
00147    void                  SetMaximum(Double_t maximum=-1111); // *MENU*
00148    void                  SetMinimum(Double_t minimum=-1111); // *MENU*
00149    void                  SetMaxIter(Int_t n=100000) {fMaxIter = n;} // *MENU*
00150    virtual void          SetName(const char *name); // *MENU*
00151    virtual void          SetNameTitle(const char *name, const char *title);
00152    void                  SetNpx(Int_t npx=40); // *MENU*
00153    void                  SetNpy(Int_t npx=40); // *MENU*
00154    virtual void          SetPoint(Int_t point, Double_t x, Double_t y, Double_t z); // *MENU*
00155    virtual void          SetTitle(const char *title=""); // *MENU*
00156 
00157    ClassDef(TGraph2D,1)  //Set of n x[i],y[i],z[i] points with 3-d graphics including Delaunay triangulation
00158 };
00159 
00160 #endif

Generated on Tue Jul 5 14:22:50 2011 for ROOT_528-00b_version by  doxygen 1.5.1