Style

Hello
I am verry new with root and I spend a lot of time by try to solve this proplem. Without success:
I want to use a style with is called ATLASstyle. I load it every time when I start root by using the rootlogon.C file.
rootlogon.C:
void rootlogon()
{
gROOT->LoadMacro(“AtlasStyle.C”);
AtlasStyle();

}
I am producing my root files with a C++ compiler and not interactivity.
The problem is, that it is not possible to draw histograms in different colours. The command Hist->SetLineColor(x) in my C++ code has no effect. Every line of every histogram is still black when I star root an an TBrowser to view my histograms.
Can anybody help me with that?
Thanks a lot

Florian Kleine-Limberg

Here the code from my AtlasStyle.C file:

//
// ATLAS Style, based on a style file from BaBar
//

void AtlasStyle() {

std::cout << “\nApplying Florians style settings…\n” << std::endl ;

TGaxis::SetMaxDigits(3);

TStyle *atlasStyle = new TStyle(“ATLAS”,“Atlas style”);
// gROOT->SetStyle(“Plain”);
atlasStyle->SetPalette(1);
atlasStyle->SetOptFit(1);
atlasStyle->SetOptStat(0);
// use plain black on white colors
Int_t icol = 0; // WHITE
atlasStyle->SetFrameBorderMode(icol);
atlasStyle->SetFrameFillColor(icol);
atlasStyle->SetCanvasBorderMode(icol);
atlasStyle->SetCanvasColor(icol);
atlasStyle->SetPadBorderMode(icol);
atlasStyle->SetPadColor(icol);
atlasStyle->SetStatColor(icol);
//atlasStyle->SetFillColor(icol);

// set the paper & margin sizes
// atlasStyle->SetPaperSize(20,26);
// atlasStyle->SetPadTopMargin(0.05);
// atlasStyle->SetPadRightMargin(0.05);
// atlasStyle->SetPadBottomMargin(0.16);
// atlasStyle->SetPadLeftMargin(0.16);

// use large fonts
//Int_t font=72; // Helvetica italics
Int_t font = 42; // Helvetica
Double_t tsize = 0.03;
atlasStyle->SetTextFont(font);

atlasStyle->SetTextSize(tsize);
atlasStyle->SetLabelFont(font,“x”);
atlasStyle->SetTitleFont(font,“x”);
atlasStyle->SetLabelFont(font,“y”);
atlasStyle->SetTitleFont(font,“y”);
atlasStyle->SetLabelFont(font,“z”);
atlasStyle->SetTitleFont(font,“z”);

atlasStyle->SetLabelSize(tsize,“x”);
atlasStyle->SetTitleSize(tsize,“x”);
atlasStyle->SetLabelSize(tsize,“y”);
atlasStyle->SetTitleSize(tsize,“y”);
atlasStyle->SetLabelSize(tsize,“z”);
atlasStyle->SetTitleSize(tsize,“z”);

// use bold lines and markers
/* atlasStyle->SetMarkerStyle(20);
atlasStyle->SetMarkerSize(1.2);
atlasStyle->SetHistLineWidth(2.);
atlasStyle->SetLineStyleString(2,"[12 12]");*/ // postscript dashes

// get rid of X error bars and y error bar caps
//atlasStyle->SetErrorX(0.001);

// do not display any of the standard histogram decorations
atlasStyle->SetOptTitle(0);
//atlasStyle->SetOptStat(1111);
atlasStyle->SetOptStat(0);
//atlasStyle->SetOptFit(1111);
// atlasStyle->SetOptFit(0);

// put tick marks on top and RHS of plots
// atlasStyle->SetPadTickX(1);
// atlasStyle->SetPadTickY(1);

// reset plain style

gROOT->SetStyle("ATLAS");
gROOT->ForceStyle();

}

have you issued a:

gPad->Modified()

after changing the color ?

When I open the same rootfile without loading atlas style it is no problem and everything is right. So I hope that I don’t have to change my code. I think I somehow have to change my Style file.

Have you tried what I suggested ?
Also you can try to remove ForceStyle

Thank you very much for your fast answer. When I remove the ForceStyle line, nearly everything works fine. Every plots now use the ATLAS style, beside the plots with the different colours. Now the colours a correct but the rest of the plot is not in ATLAS style.
I am writhing my diploma theses so it is realy important, that the plots look nice.
Your other suggestion I did not understand completely. I think you mean TPad not gPat. And for my plots I use no TPats. I draw in every canvas only one Histogram.

Thanks a lot for your help.

I suggested that when you have modified any graphical attributes in a macro that at the end you do:

gPad->Modified();

(I really mean “gPad”…)