File indexing completed on 2025-01-18 10:12:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGraph2D
0013 #define ROOT_TGraph2D
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "TNamed.h"
0025 #include "TAttLine.h"
0026 #include "TAttFill.h"
0027 #include "TAttMarker.h"
0028
0029 class TAxis;
0030 class TList;
0031 class TF2;
0032 class TH1;
0033 class TH2;
0034 class TH2D;
0035 class TView;
0036 class TDirectory;
0037 class TVirtualHistPainter;
0038
0039 #include "TFitResultPtr.h"
0040
0041 class TGraph2D : public TNamed, public TAttLine, public TAttFill, public TAttMarker {
0042
0043 protected:
0044
0045 Int_t fNpoints;
0046 Int_t fNpx;
0047 Int_t fNpy;
0048 Int_t fMaxIter;
0049 Int_t fSize;
0050 Double_t *fX;
0051 Double_t *fY;
0052 Double_t *fZ;
0053 Double_t fMinimum;
0054 Double_t fMaximum;
0055 Double_t fMargin;
0056 Double_t fZout;
0057 TList *fFunctions;
0058 TH2D *fHistogram;
0059 TObject *fDelaunay;
0060 TDirectory *fDirectory;
0061 TVirtualHistPainter *fPainter;
0062
0063 void Build(Int_t n);
0064
0065 private:
0066
0067 Bool_t fUserHisto;
0068
0069 enum EStatusBits {
0070 kOldInterpolation = BIT(15)
0071 };
0072
0073 void CreateInterpolator(Bool_t oldInterp);
0074
0075 protected:
0076
0077 public:
0078
0079 TGraph2D();
0080 TGraph2D(Int_t n);
0081 TGraph2D(Int_t n, Int_t *x, Int_t *y, Int_t *z);
0082 TGraph2D(Int_t n, Float_t *x, Float_t *y, Float_t *z);
0083 TGraph2D(Int_t n, Double_t *x, Double_t *y, Double_t *z);
0084 TGraph2D(TH2 *h2);
0085 TGraph2D(const char *name, const char *title, Int_t n, Double_t *x, Double_t *y, Double_t *z);
0086 TGraph2D(const char *filename, const char *format="%lg %lg %lg", Option_t *option="");
0087 TGraph2D(const TGraph2D &);
0088
0089 ~TGraph2D() override;
0090
0091 TGraph2D& operator=(const TGraph2D &);
0092
0093 virtual void AddPoint(Double_t x, Double_t y, Double_t z) { SetPoint(fNpoints, x, y, z); }
0094 void Browse(TBrowser *) override;
0095 void Clear(Option_t *option="") override;
0096 virtual void DirectoryAutoAdd(TDirectory *);
0097 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
0098 void Draw(Option_t *option="P0") override;
0099 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0100 TObject *FindObject(const char *name) const override;
0101 TObject *FindObject(const TObject *obj) const override;
0102 virtual TFitResultPtr Fit(const char *formula ,Option_t *option="" ,Option_t *goption="");
0103 virtual TFitResultPtr Fit(TF2 *f2 ,Option_t *option="" ,Option_t *goption="");
0104 virtual void FitPanel();
0105 TList *GetContourList(Double_t contour);
0106 TDirectory *GetDirectory() const {return fDirectory;}
0107 Int_t GetNpx() const {return fNpx;}
0108 Int_t GetNpy() const {return fNpy;}
0109 TH2D *GetHistogram(Option_t *option="");
0110 TList *GetListOfFunctions() const { return fFunctions; }
0111 virtual Double_t GetErrorX(Int_t bin) const;
0112 virtual Double_t GetErrorY(Int_t bin) const;
0113 virtual Double_t GetErrorZ(Int_t bin) const;
0114 Double_t GetMargin() const {return fMargin;}
0115 Double_t GetMaximum() const {return fMaximum;};
0116 Double_t GetMinimum() const {return fMinimum;};
0117 TAxis *GetXaxis() const ;
0118 TAxis *GetYaxis() const ;
0119 TAxis *GetZaxis() const ;
0120 Int_t GetN() const {return fNpoints;}
0121 Double_t *GetX() const {return fX;}
0122 Double_t *GetY() const {return fY;}
0123 Double_t *GetZ() const {return fZ;}
0124 virtual Double_t *GetEX() const {return nullptr;}
0125 virtual Double_t *GetEY() const {return nullptr;}
0126 virtual Double_t *GetEZ() const {return nullptr;}
0127 virtual Double_t *GetEXlow() const {return nullptr;}
0128 virtual Double_t *GetEXhigh() const {return nullptr;}
0129 virtual Double_t *GetEYlow() const {return nullptr;}
0130 virtual Double_t *GetEYhigh() const {return nullptr;}
0131 virtual Double_t *GetEZlow() const {return nullptr;}
0132 virtual Double_t *GetEZhigh() const {return nullptr;}
0133 Double_t GetXmax() const;
0134 Double_t GetXmin() const;
0135 Double_t GetYmax() const;
0136 Double_t GetYmin() const;
0137 Double_t GetZmax() const;
0138 Double_t GetZmin() const;
0139 virtual Double_t GetXmaxE() const {return GetXmax();}
0140 virtual Double_t GetXminE() const {return GetXmin();}
0141 virtual Double_t GetYmaxE() const {return GetYmax();}
0142 virtual Double_t GetYminE() const {return GetYmin();}
0143 virtual Double_t GetZmaxE() const {return GetZmax();}
0144 virtual Double_t GetZminE() const {return GetZmin();}
0145 virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z) const;
0146 Double_t Interpolate(Double_t x, Double_t y);
0147 void Paint(Option_t *option="") override;
0148 void Print(Option_t *chopt="") const override;
0149 TH1 *Project(Option_t *option="x") const;
0150 Int_t RemovePoint(Int_t ipoint);
0151 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0152 virtual void Scale(Double_t c1=1., Option_t *option="z");
0153 virtual void Set(Int_t n);
0154 virtual void SetDirectory(TDirectory *dir);
0155 virtual void SetHistogram(TH2 *h, Option_t *option="");
0156 void SetMargin(Double_t m=0.1);
0157 void SetMarginBinsContent(Double_t z=0.);
0158 void SetMaximum(Double_t maximum=-1111);
0159 void SetMinimum(Double_t minimum=-1111);
0160 void SetMaxIter(Int_t n=100000) {fMaxIter = n;}
0161 void SetName(const char *name) override;
0162 void SetNameTitle(const char *name, const char *title) override;
0163 void SetNpx(Int_t npx=40);
0164 void SetNpy(Int_t npx=40);
0165 virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z);
0166 void SetTitle(const char *title="") override;
0167
0168
0169 ClassDefOverride(TGraph2D,1)
0170 };
0171
0172 #endif