Problem drawing TH1D with signed variable bins

Hi Guys

I have a problem when I draw a TH1D created with variable bins.

Firstly I create my histogram using using logarithmic bins of variable size:

TH1D *myhisto;

Double_t xbins[8]; //array of bin low edges
xbins[0] = -1.7;
xbins[1] = -1.0;
xbins[2] = -0.5;
xbins[3] = -0.3;
xbins[4] = 0.0;
xbins[5] = 0.3;
xbins[6] = 0.7;
xbins[7] = 2.3;

myhisto = new TH1D(“myhisto”,“myhisto;x_axis_title;y_axis_title”,7,xbins);

TCanvas *c123 = new TCanvas(“c123”,“c123”,900,600);

Now if I simply draw “myhisto” filled or unfilled (with data/events etc.) the drawn histogram doesn’t seem to follow xup given in xbins. How do I get “myhisto” to display the appropriate xlabels as given in xbins or at least to adhere to the upper x limit? When I draw “myhisto” as shown above the x-axis ranges from -1.7 to 5.25, instead of -1.7 to 2.3.

Any help with this small problem will be much appreciated, thanks.

I cannot reproduce your problem. Coukd you post a running small script reproducing what you see?


Thanks for having a look Rene, but I found my error and as ever its always something so ridiculously small!!! For my last bin I accidently declared log(200.0) rather than log10(200.0) DOH!!!
Hence an upper limit of around 5 and not 2.