Using global variables in macros

Hello!

I have a unnamed macro that calls other macros, and the first two statements are:

gStyle->SetPalette(1,0);
gStyle->SetErrorX(0);

But don’t have any effect on my histograms. Also I proved to put this in each macro I use but anything again.

Can you help me?

Hi,

You can use gROOT->ForceStyle(); for applying these TStyle settings when running different macros in a root session. Another way is after TStyle settings to have in your macromy_hist->UseCurrentStyle();
Cheers, Ilka

I’ve tried again correcting some errors, but nothing again:

The content of the macro is:


{

#include <TStyle>;
#include <TROOT>;

Float_t dx=0.0;
Int_t color[1]={0};
gStyle->SetErrorX(dx);
gStyle->SetPalette(1,color);
gROOT->ForceStyle();

//referencia_act

G__loadfile("almy.c");
G__loadfile("ref_antes_act.c");  
ref(1);
gROOT->Reset();

G__loadfile("almy.c");
G__loadfile("ref_despues_act.c");
ref(1);
gROOT->Reset();

//referencia_gla

G__loadfile("almy.c");
G__loadfile("ref_antes_gla.c");  
ref(1);
gROOT->Reset();

G__loadfile("almy.c");
G__loadfile("ref_despues_gla.c");
ref(1);
gROOT->Reset();

//scan_act

G__loadfile("almy.c");
G__loadfile("scan_act.c");  
ref(0);
ref(1);
gROOT->Reset();

//scan_gla

G__loadfile("almy.c");
G__loadfile("scan_gla.c");
ref(0);
ref(1);
gROOT->Reset();

//linealidad

G__loadfile("almy.c");
G__loadfile("lin_act.c");
lin();
gROOT->Reset();

G__loadfile("almy.c");
G__loadfile("lin_gla.c");
lin();
gROOT->Reset();

//deflexiones

G__loadfile("almy.c");
G__loadfile("def_act.c");
def();
gROOT->Reset();

G__loadfile("almy.c");
G__loadfile("def_gla.c");
def();
gROOT->Reset();

//transmitancias

G__loadfile("transm_act.c");
trm();
gROOT->Reset();

G__loadfile("transm_gla.c");
trm();
gROOT->Reset();

//Estabilidades

G__loadfile("estabil_act.c");
estabil();
gROOT->Reset();

G__loadfile("estabil_gla.c");
estabil();
gROOT->Reset();

//salidas

G__loadfile("resum_gla.c");
resum();
gROOT->Reset();

G__loadfile("resum_act.c");
resum();
gROOT->Reset();

}

Thanks!

Bye!

Hi,

The line gStyle->SetPalette(1,color); is diferent from gStyle->SetPalette(1,0); I cannot understand its purpose. Please read the documentation of root.cern.ch/root/htmldoc/TStyle … SetPalette . Replacing all colors with the white one looks strange. It might be helpful if you provide two of yours macros (as smaller as possible) that will help us to reproduce the problem.

Cheers, Ilka

I only was trying. For example, the first time I used


gStyle->SetErrorX(0)

but then I realised that is


Float_t dx=0.0;

gStyle->SetErrorX(dx);

Is the same reason. Trying to be right. But nothing.

I think could be of interest that I fill the histograms with SetBinContent and SetBinError.

Is needed any library or RPM to use gStyle or by default are installed?

Thanks!
Bye!