Logo ROOT   6.08/07
Reference Guide
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 /// \macro_image(nobatch)
8 ///
9 /// \author Olivier Couet
10 
11 void th2polyHoneycomb(){
13  TH2Poly *hc = new TH2Poly();
14  hc->Honeycomb(0,0,.1,25,25);
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:418
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:31
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
Definition: TStyle.h:332
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2851
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:878
Int_t Fill(Double_t x, Double_t y)
Increment the bin containing (x,y) by 1.
Definition: TH2Poly.cxx:580
2D Histogram with Polygonal Bins
Definition: TH2Poly.h:68