Different bin size in 1D histogram

Hi,

Can we make a different bin size in one 1D histogram?

For example, for an arbitrary variable x[0,10] ranges, can we set the bin size like

0-2, 2-4, 4-6, 6-10, 4 bins?

I would like to fill this histogram using SetBinContent.

Thanks in advance!

1 Like

see the TH1 constructors accepting variable bin sizes

Rene

Thanks so much!
It works well as below,

[code]
{

Float_t Lower[5];

Lower[0] = 0;
Lower[1] = 2;
Lower[2] = 4;
Lower[3] = 6;
Lower[4] = 10;

TH1F* hist = new TH1F(“hist”,"", 4, Lower);

hist.SetBinContent(1, 1);
hist.SetBinContent(2, 2);
hist.SetBinContent(3, 3);
hist.SetBinContent(4, 4);

hist.SetMinimum(0);
hist.Draw();

}[/code]