Logo ROOT  
Reference Guide
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_hist
3/// \notebook -js
4/// This tutorial illustrates how to create an histogram with hexagonal
5/// bins (TH2Poly). The method TH2Poly::Honeycomb allows to build automatically
6/// an honeycomb binning.
8/// \macro_code
9/// \macro_image
11/// \author Olivier Couet
13void th2polyHoneycomb(){
14 TH2Poly *hc = new TH2Poly();
15 hc->SetTitle("Honeycomb example");
16 hc->Honeycomb(0,0,.1,25,25);
18 TRandom ran;
19 for (int i = 0; i<30000; i++) {
20 hc->Fill(ran.Gaus(2.,1), ran.Gaus(2.,1));
21 }
23 hc->Draw("colz");
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition: TH1.cxx:6678
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:3073
2D Histogram with Polygonal Bins
Definition: TH2Poly.h:66
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:938
virtual Int_t Fill(Double_t x, Double_t y)
Increment the bin containing (x,y) by 1.
Definition: TH2Poly.cxx:589
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
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:274