Re: [ROOT] Statistics Box

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Aug 16 2002 - 12:15:29 MEST


In ROOT version 3.03/07, the "stats" box mechanism has been
improved to facilitate the superimposition os several "stats" box.
With this version, each histogram may have its own box and a
reference to the box is added to the histogram list of functions.
To access the TPaveStats, you can do:
  TPaveStats *p = 
  (TPaveStats*)obj->GetListOfFunctions()->FindObject("stats");

In previous versions, one had to rename the current stats box 
in order to superimpose another one. This is not necessary
with the new version.
Access to the "stats" box with older versions and also supported
in 3.03/07 is;
  TPaveStats *p = 
  (TPaveStats*)gPad->GetListOfPrimitives()->FindObject("stats");

When using 3.03/07 or newer, the first access mode is recommended
and is documented as such.

In your case, you are probably using an older version.
Unfortunately, you do not indicate which version you use.

Rene Brun

On Fri, 16 Aug 2002, Thomas Bretz wrote:

> Hi,
> 
> what's wrong with this:
> TH1 *obj = (TH1*)myhist->DrawCopy();
> gPad->Modified();
> gPad->Update();
> TPaveStats *p = (TPaveStats*)obj->GetListOfFunctions()->FindObject("stats");
> if (s==NULL)
>    cout << "Is Null!" << endl;
> 
> Why don't I get a pointer to the TPaveStats object?
> 
> Thanks,
> Thomas.
> 



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