Re: [ROOT] gStyle in standalone program?

From: Jiri Masik (Jiri.Masik@cern.ch)
Date: Wed Sep 03 2003 - 10:28:56 MEST


Christian.Hansen@cern.ch writes:

> Dear Rooters,
> 
> I would like to know how to change the default of
> showing fit-parameters in a standalone program.
> 
> In a macro program that I run directly from root
> (with .x) I have these lines
>     hist->Draw();
>     gStyle->SetOptStat(0111);
>     gStyle->SetOptFit(1111);
>     hist->Fit("gaus");
> where I decide what statistical and fit-parameters will be shown.
> And it works...
> 
> I would like to do the same in a standalone program
> for which I use the attached Makefile to compile. 
> 
> In a header file I've included
> 	#include "TStyle.h"
> and defined
> 	TStyle* m_gStyle;
> 
> And in the .C file I do 
> 	m_gStyle = new TStyle();
> and
> 	hist->Draw();
>     	m_gStyle->SetOptFit(1111);
>         m_gStyle->SetOptStat(0111);
>     	hist->Fit("gaus");
> but nothing changes on the plot.
> I guess I actually do not change the default
> values since I don't get hold of the real 'gStyle'.
> 
> How should I do this instead?
> 

Hi Christian,

you can manipulate gStyle in your standalone program the same way as
you do in the macro, the gStyle object should be ready. Also you can
use gStyle->SetOptStat("NE") to get the name and entries of the
histogram - it is more obvious than specifying the style by the octal
number 0111.

cheers
-- 
	Jiri



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