ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
th2polyHoneycomb.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_hist
3 /// This tutorial illustrates how to create an histogram with hexagonal
4 /// bins (TH2Poly), fill it and draw it using GL.
5 ///
6 /// \macro_code
7 ///
8 /// \author Olivier Couet
9 
10 void th2polyHoneycomb(){
12  TH2Poly *hc = new TH2Poly();
13  hc->Honeycomb(0,0,.1,25,25);
14  gStyle->SetPalette(1);
15 
16  TRandom ran;
17  for (int i = 0; i<30000; i++) {
18  hc->Fill(ran.Gaus(2.,1), ran.Gaus(2.,1));
19  }
20 
21  hc->Draw("gllego");
22 }
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
Definition: TRandom.cxx:235
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:29
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition: TStyle.h:337
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2878
void Honeycomb(Double_t xstart, Double_t ystart, Double_t a, Int_t k, Int_t s)
Bins the histogram using a honeycomb structure.
Definition: TH2Poly.cxx:862
void SetPalette(Int_t ncolors=kBird, Int_t *colors=0, Float_t alpha=1.)
See TColor::SetPalette.
Definition: TStyle.cxx:1445
Int_t Fill(Double_t x, Double_t y)
Increment the bin containing (x,y) by 1.
Definition: TH2Poly.cxx:564
2D Histogram with Polygonal Bins
Definition: TH2Poly.h:70