Skip to content
Snippets Groups Projects
Commit 7260764c authored by Olivier Couet's avatar Olivier Couet
Browse files

- Use the inherited Draw method from TH1

- Implement DrawCopy


git-svn-id: http://root.cern.ch/svn/root/trunk@37434 27541ba8-7e3a-0410-8455-c3a389f83636
parent 5f911c52
No related branches found
No related tags found
No related merge requests found
...@@ -75,51 +75,51 @@ public: ...@@ -75,51 +75,51 @@ public:
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); 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);
virtual ~TH2Poly(); virtual ~TH2Poly();
Int_t AddBin(TObject *poly); Int_t AddBin(TObject *poly);
Int_t AddBin(Int_t n, const Double_t *x, const Double_t *y); Int_t AddBin(Int_t n, const Double_t *x, const Double_t *y);
Int_t AddBin(Double_t x1, Double_t y1, Double_t x2, Double_t y2); Int_t AddBin(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
void ClearBinContents(); // Clears the content of all bins void ClearBinContents(); // Clears the content of all bins
void ChangePartition(Int_t n, Int_t m); // Sets the number of partition cells to another value void ChangePartition(Int_t n, Int_t m); // Sets the number of partition cells to another value
void Draw(Option_t *option=""); virtual TH1 *DrawCopy(Option_t *option="") const;
Int_t Fill(Double_t x,Double_t y); Int_t Fill(Double_t x,Double_t y);
Int_t Fill(Double_t x,Double_t y, Double_t w); Int_t Fill(Double_t x,Double_t y, Double_t w);
Int_t Fill(const char* name, Double_t w); Int_t Fill(const char* name, Double_t w);
void FillN(Int_t ntimes, const Double_t* x, const Double_t* y, const Double_t* w, Int_t stride = 1); void FillN(Int_t ntimes, const Double_t* x, const Double_t* y, const Double_t* w, Int_t stride = 1);
Int_t Fill(Double_t){return -1;} //MayNotUse Int_t Fill(Double_t){return -1;} //MayNotUse
Int_t Fill(Double_t , const char *, Double_t){return -1;} //MayNotUse Int_t Fill(Double_t , const char *, Double_t){return -1;} //MayNotUse
Int_t Fill(const char *, Double_t , Double_t ){return -1;} //MayNotUse Int_t Fill(const char *, Double_t , Double_t ){return -1;} //MayNotUse
Int_t Fill(const char *, const char *, Double_t ){return -1;} //MayNotUse Int_t Fill(const char *, const char *, Double_t ){return -1;} //MayNotUse
void FillN(Int_t, const Double_t*, const Double_t*, Int_t){return;} //MayNotUse void FillN(Int_t, const Double_t*, const Double_t*, Int_t){return;} //MayNotUse
Int_t FindBin(Double_t x, Double_t y, Double_t z = 0); Int_t FindBin(Double_t x, Double_t y, Double_t z = 0);
TList *GetBins(){return fBins;} // Returns the TList of all bins in the histogram TList *GetBins(){return fBins;} // Returns the TList of all bins in the histogram
Double_t GetBinContent(Int_t bin) const; Double_t GetBinContent(Int_t bin) const;
Double_t GetBinContent(Int_t, Int_t) const {return 0;} //MayNotUse Double_t GetBinContent(Int_t, Int_t) const {return 0;} //MayNotUse
Double_t GetBinContent(Int_t, Int_t, Int_t) const {return 0;} //MayNotUse Double_t GetBinContent(Int_t, Int_t, Int_t) const {return 0;} //MayNotUse
Bool_t GetBinContentChanged() const{return fBinContentChanged;} Bool_t GetBinContentChanged() const{return fBinContentChanged;}
Double_t GetBinError(Int_t bin) const; Double_t GetBinError(Int_t bin) const;
Double_t GetBinError(Int_t , Int_t) const {return 0;} //MayNotUse Double_t GetBinError(Int_t , Int_t) const {return 0;} //MayNotUse
Double_t GetBinError(Int_t , Int_t , Int_t) const {return 0;} //MayNotUse Double_t GetBinError(Int_t , Int_t , Int_t) const {return 0;} //MayNotUse
const char *GetBinName(Int_t bin) const; const char *GetBinName(Int_t bin) const;
const char *GetBinTitle(Int_t bin) const; const char *GetBinTitle(Int_t bin) const;
Bool_t GetFloat(){return fFloat;} Bool_t GetFloat(){return fFloat;}
Double_t GetMaximum() const; Double_t GetMaximum() const;
Double_t GetMaximum(Double_t maxval) const; Double_t GetMaximum(Double_t maxval) const;
Double_t GetMinimum() const; Double_t GetMinimum() const;
Double_t GetMinimum(Double_t minval) const; Double_t GetMinimum(Double_t minval) const;
Bool_t GetNewBinAdded() const{return fNewBinAdded;} Bool_t GetNewBinAdded() const{return fNewBinAdded;}
Int_t GetNumberOfBins() const{return fNcells;} Int_t GetNumberOfBins() const{return fNcells;}
void Honeycomb(Double_t xstart, Double_t ystart, Double_t a, Int_t k, Int_t s); // Bins the histogram using a honeycomb structure void Honeycomb(Double_t xstart, Double_t ystart, Double_t a, Int_t k, Int_t s); // Bins the histogram using a honeycomb structure
Double_t Integral(Option_t* option = "") const; Double_t Integral(Option_t* option = "") const;
Double_t Integral(Int_t, Int_t, const Option_t*) const{return 0;} //MayNotUse Double_t Integral(Int_t, Int_t, const Option_t*) const{return 0;} //MayNotUse
Double_t Integral(Int_t, Int_t, Int_t, Int_t, const Option_t*) const{return 0;} //MayNotUse Double_t Integral(Int_t, Int_t, Int_t, Int_t, const Option_t*) const{return 0;} //MayNotUse
Double_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, const Option_t*) const{return 0;} //MayNotUse Double_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, const Option_t*) const{return 0;} //MayNotUse
void SavePrimitive(ostream& out, Option_t* option = ""); void SavePrimitive(ostream& out, Option_t* option = "");
void SetBinContent(Int_t bin, Double_t content); void SetBinContent(Int_t bin, Double_t content);
void SetBinContent(Int_t, Int_t, Double_t){return;} //MayNotUse void SetBinContent(Int_t, Int_t, Double_t){return;} //MayNotUse
void SetBinContent(Int_t, Int_t, Int_t, Double_t){return;} //MayNotUse void SetBinContent(Int_t, Int_t, Int_t, Double_t){return;} //MayNotUse
void SetBinContentChanged(Bool_t flag){fBinContentChanged = flag;} void SetBinContentChanged(Bool_t flag){fBinContentChanged = flag;}
void SetFloat(Bool_t flag = true); void SetFloat(Bool_t flag = true);
void SetNewBinAdded(Bool_t flag){fNewBinAdded = flag;} void SetNewBinAdded(Bool_t flag){fNewBinAdded = flag;}
protected: protected:
TList *fBins; //List of bins. TList *fBins; //List of bins.
......
...@@ -402,29 +402,18 @@ void TH2Poly::ClearBinContents() ...@@ -402,29 +402,18 @@ void TH2Poly::ClearBinContents()
//______________________________________________________________________________ //______________________________________________________________________________
void TH2Poly::Draw(Option_t * option) TH1 *TH2Poly::DrawCopy(Option_t *option) const
{ {
// Draws the histogram on the canvas. // Draw copy.
// Options:
// "" 2D Color
// "gllego" Lego plot using OpenGL
if (fNcells==0) return;
TString opt = option; TString opt = option;
opt.ToLower(); opt.ToLower();
if (gPad && !opt.Contains("same")) gPad->Clear();
fZaxis.Set(100, GetMinimum(), GetMaximum()); TH2Poly *newth2 = (TH2Poly*)Clone();
newth2->SetDirectory(0);
if (opt.Contains("gllego")) { newth2->SetBit(kCanDelete);
gStyle->SetCanvasPreferGL(kTRUE); newth2->AppendPad(option);
} return newth2;
if (gPad) {
if (!gPad->IsEditable()) gROOT->MakeDefCanvas();
if (opt.Contains("a")) gPad->Clear();
}
AppendPad(opt);
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
//Author: Olivier Couet //Author: Olivier Couet
void th2polyHoneycomb(){ void th2polyHoneycomb(){
gStyle->SetCanvasPreferGL(true);
TH2Poly *hc = new TH2Poly(); TH2Poly *hc = new TH2Poly();
hc->Honeycomb(0,0,.1,25,25); hc->Honeycomb(0,0,.1,25,25);
gStyle->SetPalette(1); gStyle->SetPalette(1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment