hyperfunk/mastercode-tools — pull request #41 by hyperfunk (2012-06-15 08:09:43+00:00)
Title: fix ranges to be histogram dependant

Hi Kees,

This should fix the plotting problems you've been having where the final bins for high Y values are not getting filled.

It was a problem with bin counting, as suspected, in several places.

The problem was that we used to just assume the following:
```python
first_bin = 0
l_bins = [n+1 for n in plot.nbins]
last_bin = reduce(mul,l_bins)
# last_bin is the reduction of hte list via multiplication, i.e. l[0]*[1]*...*l[len(l)-1].
```
For the example case of `nbins = [100, 100]` this would produce `first_bin = 0; last_bin =10201`.

However what we didn't realise is that the first bin should be 103, and the last bin should be 10403. Because ROOT has very sensible and intuitive histogram numbering (/sarcasm).

Anyway I should've worked this out earlier, and I've now fixed it to simply find the first bin and last bin from the histogram.

Hope this fixes it for you (I tested it on a small file).