Re: [ROOT] A couple TH1 troubles

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Apr 19 2000 - 17:36:50 MEST


Hi Gerco,
Thanks for sending these questions. I really appreciate this
kind of feedback.

Gerco Onderwater wrote:
> 
> Hi Rooters,
> 
> A few remarks:
> 
> (1) TH1::GetMaximum() returns the maximum bincontent as long as
>     TH1::SetMaximum() has not been used to set an upper limit on the
>     drawing range.  It would be handy to have the drawing range and
>     the actual min/max of the histogram content to be decoupled.  The
>     present behaviour is especially annoying if one tries to set the
>     drawing range by hand more than once.  The function
>     TH1::GetMaximumStored() seems to be intended to do just this, but
>     only returns -1111 in my version of root.
> 

If you have not yet set a maximum (via SetMaximum), GetMaximumStored
returns -1111. If SetMaximum has not been called, GetMaximum returns
the maximum bin content. Once you have called SetMaximum, GetMaximum
will return teh value specified in SetMaximum.


> (2) TH1::SetMaximum() takes a Float_t as an argument, even for a TH1D.
>     Likewise, TH1::GetMaximum() returns a Float_t.  That leads to
>     trouble for large values in a TH1D.

Good point. I will change Float to Double. This should be backward compatible.

> 
> (3) related to (2).  Actually having Double_t values in a TH1D (say
>     1e200), results in an undrawable histogram. The same holds for TF1.
> 
Yes, there are still many places where the visualisation classes use float
instead of double. I intend to revisit these classes.

> (4) if TH1::SetMaximum() has been used to set a maximum, drawing a 2D
>     histogram with the surf option ignores that maximum.  The "lego"
>     option works fine.
> 

I can reproduce this problem. I will fix this in the coming release.

> (5) after filling a histogram with TH1::Eval(TF1* f1), switching on
>     the weighted error calculation using TH1::Sumw2() does not work.
>     Also, setting TH1::Sumw2() before using TH1::Eval() has no effect.
>     This is inconsistent with the normal behaviour.
>

This was not implemented in TH1::Eval. I have added the filling of errors
in TH1::Eval if TH1::Sumw2 has been called before.
 
> (6) it would be very handy if TH1::Eval(TF1* f1, Option_t *option)
>     would also facilitate subtraction, multiplication and division and
>     not just addition.  An possible application is fitting a function
>     and then calculating the residuals, or dividing out phasespace.
> 

Good idea, I will add the options "+,-,*,/". Option "+" will replace current
option "A".

> (7) having the "I" option (for integration) in TH1::Eval(TF1* f1) to
>     store the integrated function would be nice.
> 

Good point. This is easy to add and it is more precise. I will support
this option only for 1-d histograms.

> (8) TH1::GetXaxis()->Set(Int_t nbins, Axis_t xmin, Axis_t xmax) allows
>     one to change the number of bins on the axis, without actually
>     changing the number of histogram bins.  Filling non-exisitent bins
>     will soon lead to a seg-fault.  This should either be implemented
>     properly, or somehow be prevented.  Although I have to admit that
>     I wouldn't know a legitimate reason to change the number of bins,
>     changing the upper and lower limit has many usefull applications.
> 

Use TH1::SetBins instead.  Only a TH1 object can call TAxis::Set.
TH1 should be declared friend of TAxis and the function protected.

Rene Brun


> I'm using version 2.23/12.
> 
> That's it for now,
> 
> -- Gerco



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:24 MET