Re: Histograms calculate Range

Rene Brun (Rene.Brun@cern.ch)
Thu, 03 Sep 1998 22:28:28 +0200


Constantinos Loizides wrote:
>
> Dear Rooters,
>
> I am looking for an easy (and fast) way to automatically adjust the range
> of the histogram's axes after I filled it with some data, of which I
> don't know exactly the range in the first place.
>
> Obviously there is one way: Before I create the histogram, I could check
> the whole data for min and max values, set the range of the histogram and
> fill it - but before I do that, I want to be
> sure that there is no better way.

The automatic binning is implemented in Root when creating histograms
from Ntuples/trees. The algorithm used is a naive algorithm storing
the first few thousand entries into a buffer, then compute the min/max
, fill the histogram. This technique does not work well in case
of data not randomly distributed.
In the Hbook package, I implemented a different technique consisting
in buffering also the first entries, then doubling the bin size
in case of under/overflow. This technique had also problems and was
not appropriate in case of 2-d histograms. It could be implemented
in Root for 1-d histograms.

Rene Brun