Re: [ROOT] Problem with variable bin histograms

From: Natalia Kuznetsova (natalia@SLAC.stanford.edu)
Date: Mon Sep 09 2002 - 16:53:59 MEST


Hi Rene,

  Thank you for your comment!

  As a matter of fact, Lower does have N = 8 values, so I thought
specifying 7 in the constructor would be correct as the array is then
of size N+1.  Is that not the case?

  I did follow your suggestion in any case, however, and it didn't solve
the problem -- the only thing it did was to remove the outermost bin, so
the histogram now ends at 10 as opposed to 14.  Is there something else I
am missing?

  Regards,

  Natalia

______________________
Natalia Kuznetsova
Fermilab/CDF
P.O. Box 500, MS 318
Batavia, IL 60510
(630) 840-5115
______________________

On Mon, 9 Sep 2002, Rene Brun wrote:

> Hi Natalia,
> instead of
>    TH1F* hist = new TH1F("hist","", 7, Lower);
> do
>    TH1F* hist = new TH1F("hist","", 6, Lower);
>
> see comments in TH1 constructor. In case of variable bins histogram,
> you must specify an array with N+1 bin values.
>
> Rene Brun
>
>
> On Sun, 8 Sep 2002, Natalia Kuznetsova wrote:
>
> > Dear ROOTers,
> >
> >   I would like to create a variable bin histogram with the following array
> > of low edges:
> >
> >   Float_t Lower[8];
> >
> >   Lower[0] = 2;
> >   Lower[1] = 3;
> >   Lower[2] = 4;
> >   Lower[3] = 5;
> >   Lower[4] = 6;
> >   Lower[5] = 8;
> >   Lower[6] = 10;
> >   Lower[7] = 14;
> >
> >   I used TH1F* hist = new TH1F("hist","", 7, Lower);
> >
> >   The resulting histogram appears to be skewed by 1 bin.  When I print out
> > the bin content, it says:
> >
> > bin 0 = 0.005
> > bin 1 = 0.013
> >
> >    but the actual histogram's first point sits at 2.5 (the histogram
> > starts at 2), and it is the entry corresponding to bin 1 (0.013).
> >
> >    How do I make sure that bin 0 is plotted, and plotted exactly at 2?
> >
> >    Thanks for your help,
> >
> >    Natalia
> >
> > ______________________
> > Natalia Kuznetsova
> > Fermilab/CDF
> > P.O. Box 500, MS 318
> > Batavia, IL 60510
> > (630) 840-5115
> > ______________________
> >
>
>



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:09 MET