How to create TH1 with non equidistant bin

I need to create some Histograms (TH1) in which x axis bin dimension goes like 1/sin(x). How I can do that??

Thax to all.

See the TH1, TH2, TH3 constructors accepting arrays of bin low-edges.



Sorry but I’m just learning how to use ROOT, so if sameone can explain me more …


a small example below:


//file varbins.C
void varbins() {
const Int_t nbins=9;
Double_t xbins[nbins+1] = {20,40,50,60,70,78,86,88,90,100};
TH1F *h = new TH1F(“h”,“var bins”,nbins,xbins);
TRandom r;
for (Int_t i=0;i<1000;i++) h->Fill(r.Uniform(20,100));

In interactive ROOT, just do:
root > .x varbins.C