Logo ROOT  
Reference Guide
th2polyHoneycomb.C File Reference

Detailed Description

View in nbviewer Open in SWAN This tutorial illustrates how to create an histogram with hexagonal bins (TH2Poly). The method TH2Poly::Honeycomb allows to build automatically an honeycomb binning.

void th2polyHoneycomb(){
TH2Poly *hc = new TH2Poly();
hc->SetTitle("Honeycomb example");
hc->Honeycomb(0,0,.1,25,25);
TRandom ran;
for (int i = 0; i<30000; i++) {
hc->Fill(ran.Gaus(2.,1), ran.Gaus(2.,1));
}
hc->Draw("colz");
}
Author
Olivier Couet

Definition in file th2polyHoneycomb.C.

TRandom::Gaus
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:263
TH1::SetTitle
virtual void SetTitle(const char *title)
See GetStatOverflows for more information.
Definition: TH1.cxx:6344
TRandom
Definition: TRandom.h:27
TH2Poly::Honeycomb
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:934
TH2Poly::Fill
virtual Int_t Fill(Double_t x, Double_t y)
Increment the bin containing (x,y) by 1.
Definition: TH2Poly.cxx:589
TH2Poly
Definition: TH2Poly.h:66
TH1::Draw
virtual void Draw(Option_t *option="")
Draw this histogram with options.
Definition: TH1.cxx:2997