00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TH2Poly
00013 #define ROOT_TH2Poly
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef ROOT_TH2
00024 #include "TH2.h"
00025 #endif
00026
00027 #include "TList.h"
00028
00029 class TH2PolyBin: public TObject{
00030
00031 public:
00032 TH2PolyBin();
00033 TH2PolyBin(TObject *poly, Int_t bin_number);
00034 virtual ~TH2PolyBin();
00035
00036 void ClearContent(){fContent = 0;}
00037 void Fill(Double_t w) {fContent = fContent+w; SetChanged(true);}
00038 Double_t GetArea();
00039 Double_t GetContent() const{return fContent;}
00040 Bool_t GetChanged() const{return fChanged;}
00041 Int_t GetBinNumber() const {return fNumber;}
00042 TObject *GetPolygon() const {return fPoly;}
00043 Double_t GetXMax();
00044 Double_t GetXMin();
00045 Double_t GetYMax();
00046 Double_t GetYMin();
00047 Bool_t IsInside(Double_t x, Double_t y) const;
00048 void SetChanged(Bool_t flag){fChanged = flag;}
00049 void SetContent(Double_t content){fContent = content; SetChanged(true);}
00050
00051 protected:
00052 Bool_t fChanged;
00053 Int_t fNumber;
00054 TObject *fPoly;
00055 Double_t fArea;
00056 Double_t fContent;
00057 Double_t fXmin;
00058 Double_t fYmin;
00059 Double_t fXmax;
00060 Double_t fYmax;
00061
00062 ClassDef(TH2PolyBin,1)
00063 };
00064
00065 class TList;
00066 class TGraph;
00067 class TMultiGraph;
00068 class TPad;
00069
00070 class TH2Poly : public TH2 {
00071
00072 public:
00073 TH2Poly();
00074 TH2Poly(const char *name,const char *title, Double_t xlow, Double_t xup, Double_t ylow, Double_t yup);
00075 TH2Poly(const char *name,const char *title, Int_t nX, Double_t xlow, Double_t xup, Int_t nY, Double_t ylow, Double_t yup);
00076 virtual ~TH2Poly();
00077
00078 Int_t AddBin(TObject *poly);
00079 Int_t AddBin(Int_t n, const Double_t *x, const Double_t *y);
00080 Int_t AddBin(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
00081 void ClearBinContents();
00082 void ChangePartition(Int_t n, Int_t m);
00083 virtual TH1 *DrawCopy(Option_t *option="") const;
00084 Int_t Fill(Double_t x,Double_t y);
00085 Int_t Fill(Double_t x,Double_t y, Double_t w);
00086 Int_t Fill(const char* name, Double_t w);
00087 void FillN(Int_t ntimes, const Double_t* x, const Double_t* y, const Double_t* w, Int_t stride = 1);
00088 Int_t Fill(Double_t){return -1;}
00089 Int_t Fill(Double_t , const char *, Double_t){return -1;}
00090 Int_t Fill(const char *, Double_t , Double_t ){return -1;}
00091 Int_t Fill(const char *, const char *, Double_t ){return -1;}
00092 void FillN(Int_t, const Double_t*, const Double_t*, Int_t){return;}
00093 Int_t FindBin(Double_t x, Double_t y, Double_t z = 0);
00094 TList *GetBins(){return fBins;}
00095 Double_t GetBinContent(Int_t bin) const;
00096 Double_t GetBinContent(Int_t, Int_t) const {return 0;}
00097 Double_t GetBinContent(Int_t, Int_t, Int_t) const {return 0;}
00098 Bool_t GetBinContentChanged() const{return fBinContentChanged;}
00099 Double_t GetBinError(Int_t bin) const;
00100 Double_t GetBinError(Int_t , Int_t) const {return 0;}
00101 Double_t GetBinError(Int_t , Int_t , Int_t) const {return 0;}
00102 const char *GetBinName(Int_t bin) const;
00103 const char *GetBinTitle(Int_t bin) const;
00104 Bool_t GetFloat(){return fFloat;}
00105 Double_t GetMaximum() const;
00106 Double_t GetMaximum(Double_t maxval) const;
00107 Double_t GetMinimum() const;
00108 Double_t GetMinimum(Double_t minval) const;
00109 Bool_t GetNewBinAdded() const{return fNewBinAdded;}
00110 Int_t GetNumberOfBins() const{return fNcells;}
00111 void Honeycomb(Double_t xstart, Double_t ystart, Double_t a, Int_t k, Int_t s);
00112 Double_t Integral(Option_t* option = "") const;
00113 Double_t Integral(Int_t, Int_t, const Option_t*) const{return 0;}
00114 Double_t Integral(Int_t, Int_t, Int_t, Int_t, const Option_t*) const{return 0;}
00115 Double_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, const Option_t*) const{return 0;}
00116 void SavePrimitive(ostream& out, Option_t* option = "");
00117 void SetBinContent(Int_t bin, Double_t content);
00118 void SetBinContent(Int_t, Int_t, Double_t){return;}
00119 void SetBinContent(Int_t, Int_t, Int_t, Double_t){return;}
00120 void SetBinContentChanged(Bool_t flag){fBinContentChanged = flag;}
00121 void SetFloat(Bool_t flag = true);
00122 void SetNewBinAdded(Bool_t flag){fNewBinAdded = flag;}
00123
00124 protected:
00125 TList *fBins;
00126 Double_t fOverflow[9];
00127 Int_t fCellX;
00128 Int_t fCellY;
00129 Int_t fNCells;
00130 TList *fCells;
00131 Double_t fStepX, fStepY;
00132 Bool_t *fIsEmpty;
00133 Bool_t *fCompletelyInside;
00134 Bool_t fFloat;
00135 Bool_t fNewBinAdded;
00136 Bool_t fBinContentChanged;
00137
00138 void AddBinToPartition(TH2PolyBin *bin);
00139 void Initialize(Double_t xlow, Double_t xup, Double_t ylow, Double_t yup, Int_t n, Int_t m);
00140 Bool_t IsIntersecting(TH2PolyBin *bin, Double_t xclipl, Double_t xclipr, Double_t yclipb, Double_t yclipt);
00141 Bool_t IsIntersectingPolygon(Int_t bn, Double_t *x, Double_t *y, Double_t xclipl, Double_t xclipr, Double_t yclipb, Double_t yclipt);
00142
00143 ClassDef(TH2Poly,1)
00144 };
00145
00146 #endif