Warning, file /include/root/TH2Poly.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TH2Poly
0013 #define ROOT_TH2Poly
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include "TH2.h"
0024
0025 class TH2PolyBin: public TObject{
0026
0027 public:
0028 TH2PolyBin();
0029 TH2PolyBin(TObject *poly, Int_t bin_number);
0030 ~TH2PolyBin() override;
0031
0032 void ClearContent(){fContent = 0;}
0033 void Fill(Double_t w) {fContent = fContent+w; SetChanged(true);}
0034 Double_t GetArea();
0035 Double_t GetContent() const{return fContent;}
0036 Bool_t GetChanged() const{return fChanged;}
0037 Int_t GetBinNumber() const {return fNumber;}
0038 TObject *GetPolygon() const {return fPoly;}
0039 Double_t GetXMax();
0040 Double_t GetXMin();
0041 Double_t GetYMax();
0042 Double_t GetYMin();
0043 Bool_t IsInside(Double_t x, Double_t y) const;
0044 void SetChanged(Bool_t flag){fChanged = flag;}
0045 void SetContent(Double_t content){fContent = content; SetChanged(true);}
0046
0047 protected:
0048 Bool_t fChanged;
0049 Int_t fNumber;
0050 TObject *fPoly;
0051 Double_t fArea;
0052 Double_t fContent;
0053 Double_t fXmin;
0054 Double_t fYmin;
0055 Double_t fXmax;
0056 Double_t fYmax;
0057
0058 ClassDefOverride(TH2PolyBin,1)
0059 };
0060
0061 class TList;
0062 class TGraph;
0063 class TMultiGraph;
0064 class TPad;
0065
0066 class TH2Poly : public TH2 {
0067
0068 public:
0069 TH2Poly();
0070 TH2Poly(const char *name,const char *title, Double_t xlow, Double_t xup, Double_t ylow, Double_t yup);
0071 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);
0072 ~TH2Poly() override;
0073 TH2Poly(const TH2Poly & rhs);
0074 TH2Poly & operator=(const TH2Poly & rhs);
0075
0076 virtual TH2PolyBin *CreateBin(TObject *poly);
0077 virtual Int_t AddBin(TObject *poly);
0078 Int_t AddBin(Int_t n, const Double_t *x, const Double_t *y);
0079 Int_t AddBin(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
0080 Bool_t Add(const TH1 *h1, Double_t c1) override;
0081 Bool_t Add(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1) override;
0082 Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="") override;
0083 void ClearBinContents();
0084 TObject *Clone(const char* newname = "") const override;
0085 void Copy(TObject & newth2p) const override;
0086 void ChangePartition(Int_t n, Int_t m);
0087 using TH2::Multiply;
0088 using TH2::Divide;
0089 using TH2::Interpolate;
0090 Bool_t Divide(TF1 *, Double_t) override;
0091 Bool_t Multiply(TF1 *, Double_t) override;
0092 Double_t ComputeIntegral(Bool_t) override;
0093 TH1 * FFT(TH1*, Option_t * ) override;
0094 virtual TH1 * GetAsymmetry(TH1* , Double_t, Double_t);
0095 virtual Double_t Interpolate(Double_t, Double_t);
0096 Int_t Fill(Double_t x,Double_t y) override;
0097 Int_t Fill(Double_t x,Double_t y, Double_t w) override;
0098 Int_t Fill(const char* name, Double_t w) override;
0099 void FillN(Int_t ntimes, const Double_t* x, const Double_t* y, const Double_t* w, Int_t stride = 1) override;
0100 Int_t FindBin(Double_t x, Double_t y, Double_t z = 0) override;
0101 TList *GetBins(){return fBins;}
0102 Double_t GetBinContent(Int_t bin) const override;
0103 Bool_t GetBinContentChanged() const{return fBinContentChanged;}
0104 Double_t GetBinError(Int_t bin) const override;
0105 const char *GetBinName(Int_t bin) const;
0106 const char *GetBinTitle(Int_t bin) const;
0107 Bool_t GetFloat(){return fFloat;}
0108 Double_t GetMaximum() const;
0109 Double_t GetMaximum(Double_t maxval) const override;
0110 Double_t GetMinimum() const;
0111 Double_t GetMinimum(Double_t minval) const override;
0112 Bool_t GetNewBinAdded() const{return fNewBinAdded;}
0113 Int_t GetNumberOfBins() const;
0114 void Honeycomb(Double_t xstart, Double_t ystart, Double_t a, Int_t k, Int_t s, Option_t* option = "v");
0115 Double_t Integral(Option_t* option = "") const override;
0116 Long64_t Merge(TCollection *) override;
0117 void Reset(Option_t *option) override;
0118 void Scale(Double_t c1 = 1, Option_t* option = "") override;
0119 void SavePrimitive(std::ostream& out, Option_t* option = "") override;
0120 void SetBinContent(Int_t bin, Double_t content) override;
0121 void SetBinError(Int_t bin, Double_t error) override;
0122 void SetBinContentChanged(Bool_t flag){fBinContentChanged = flag;}
0123 void SetFloat(Bool_t flag = true);
0124 void SetNewBinAdded(Bool_t flag){fNewBinAdded = flag;}
0125 Bool_t IsInsideBin(Int_t binnr, Double_t x, Double_t y);
0126 void GetStats(Double_t *stats) const override;
0127
0128
0129 protected:
0130
0131
0132
0133 Int_t Fill(Double_t) override{return -1;}
0134 Int_t Fill(Double_t , const char *, Double_t) override{return -1;}
0135 Int_t Fill(const char *, Double_t , Double_t ) override{return -1;}
0136 Int_t Fill(const char *, const char *, Double_t ) override{return -1;}
0137 void FillN(Int_t, const Double_t*, const Double_t*, Int_t) override{return;}
0138
0139 Double_t Integral(Int_t, Int_t, const Option_t*) const override{return 0;}
0140 Double_t Integral(Int_t, Int_t, Int_t, Int_t, const Option_t*) const override{return 0;}
0141 Double_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, const Option_t*) const override{return 0;}
0142
0143 Double_t GetBinContent(Int_t, Int_t) const override {return 0;}
0144 Double_t GetBinContent(Int_t, Int_t, Int_t) const override {return 0;}
0145
0146 Double_t GetBinError(Int_t , Int_t) const override {return 0;}
0147 Double_t GetBinError(Int_t , Int_t , Int_t) const override {return 0;}
0148
0149 void SetBinContent(Int_t, Int_t, Double_t) override{}
0150 void SetBinContent(Int_t, Int_t, Int_t, Double_t) override{}
0151 void SetBinError(Int_t, Int_t, Double_t) override {}
0152 void SetBinError(Int_t, Int_t, Int_t, Double_t) override {}
0153
0154
0155 protected:
0156 enum {
0157 kNOverflow = 9
0158 };
0159 Double_t fOverflow[kNOverflow];
0160 Int_t fCellX;
0161 Int_t fCellY;
0162 Int_t fNCells;
0163 TList *fCells;
0164 Double_t fStepX, fStepY;
0165 Bool_t *fIsEmpty;
0166 Bool_t *fCompletelyInside;
0167 Bool_t fFloat;
0168 Bool_t fNewBinAdded;
0169 Bool_t fBinContentChanged;
0170 TList *fBins;
0171
0172 void AddBinToPartition(TH2PolyBin *bin);
0173 void Initialize(Double_t xlow, Double_t xup, Double_t ylow, Double_t yup, Int_t n, Int_t m);
0174 Bool_t IsIntersecting(TH2PolyBin *bin, Double_t xclipl, Double_t xclipr, Double_t yclipb, Double_t yclipt);
0175 Bool_t IsIntersectingPolygon(Int_t bn, Double_t *x, Double_t *y, Double_t xclipl, Double_t xclipr, Double_t yclipb, Double_t yclipt);
0176
0177 Double_t RetrieveBinContent(Int_t bin) const override {
0178 return (bin>=kNOverflow) ? GetBinContent(bin-kNOverflow+1) : GetBinContent(-bin-1);
0179 }
0180 void UpdateBinContent(Int_t bin, Double_t content) override {
0181 return (bin>=kNOverflow) ? SetBinContent(bin-kNOverflow+1,content) : SetBinContent(-bin-1,content);
0182 }
0183
0184 ClassDefOverride(TH2Poly,3)
0185 };
0186
0187 #endif