Re: [ROOT] Two problems

From: Bernard Andrieu (andrieu@in2p3.fr)
Date: Fri Nov 21 2003 - 02:21:55 MET


Dear Rene,

thanks for your answers. I have a few further questions.

Rene Brun a écrit :
> 
> Hi Bernard,
> 
> Bernard Andrieu wrote:
> >
> > Hello,
> >
> > I have two problems with root.
> >
> > Problem 1:
> >
> > I want to display an histogram with just its name in the stat box. According to
> > the manual, I should be able to do that with:
> >
> > gStyle->SetOptStat(1);
> >
> > but the stat box still displays, in addition to the name,  Entries, Mean and
> > RMS.
> > Note that this problem is specific to the value 1 as an argument (with 0, 10,
> > 11, and so on, it works as expected).
> 
> 1 is a special case setting the default options. The workaround is to call
>   gStyle->SetOptFit(10000001);
> 
Do you mean this is a special case for all option settings? May I suggest to
document it clearly in all relevant places, e.g. in the Users Guide p.32? 

> >
> > Problem 2:
> >
> > I want to use TPaveStats to chose the position of the stat box of an histogram,
> > ie:
> >
> > h->Draw();
> > TPaveStats *st = (TPaveStats*)h->GetListOfFunctions()->FindObject("stats");
> > st->SetX1NDC(0.6) ; st->SetX2NDC(0.9) ; st->SetY1NDC(0.6) ; st->SetY2NDC(0.9);
> >
> > At the command line, it works, but inside a macro, I get the following message:
> >
> > Error: illegal pointer to class object st 0x0 219  FILE:detptstudy.C LINE:154
> > *** Interpreter error recovered ***
> >
> 
> Read the principles of Draw/Paint for all objects.
>     http://root.cern.ch/root/HowtoDraw.html
> see also Users Guide at page 29 and 111.
> 
> When executing from the command line, the canvas is automatically Updated when
> pressing CR. In case of a macro, the canvas will be updated only
> when you will type CR. You can force an Update of the canvas that in turn
> will force the painting of your histogram and the stats box by calling
>   mycanvas.Update();
> after having drawn your histogram(s).
> 
Although I don't understand the (presumably good) reasons behind these features
of the program, may I then suggest to add a new functionality that would allow
the TPaveStats... command to be executed WITHOUT the histogram being actually
drawn? 

This is actually what I want to do, because, as you can imagine, I'm interested
in having the histogram displayed only when the position of the stat box has
been correctly defined.

Thanks for help.
-- 
                      Best regards,
                               Bernard Andrieu
-----------------------------------------------------------------------
                         ("-/")_.-'"-._                       
LPNHE, 4 pl. Jussieu      . . ; -._    )-;-,_)  email: andrieu@in2p3.fr
    Tour 33, RdC         (v_,)'  _  )-.\  -'    Tel: +33 (0)1 4427 2321
75252 PARIS CEDEX 05    _.- _..-_/ / ((.'       Fax: +33 (0)1 4427 4638
                      ((,.-'   ((,/                      
-----------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET