ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ECCEStyle.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ECCEStyle.C
1 //
2 // ECCE Style, based on a style file from BaBar, v0.1
3 //
4 
5 #include <iostream>
6 
7 #include "ECCEStyle.h"
8 
9 #include "TROOT.h"
10 
11 void SetECCEStyle ()
12 {
13  static TStyle* ecceStyle = 0;
14  std::cout << "ECCEStyle: Applying nominal settings." << std::endl ;
15  if ( ecceStyle==0 ) ecceStyle = ECCEStyle();
16  gROOT->SetStyle("ECCE");
17  gROOT->ForceStyle();
18 }
19 
20 TStyle* ECCEStyle()
21 {
22  TStyle *ECCEStyle = new TStyle("ECCE","ECCE style");
23 
24  // use plain black on white colors
25  Int_t icol=0; // WHITE
26  ECCEStyle->SetFrameBorderMode(icol);
27  ECCEStyle->SetFrameFillColor(icol);
28  ECCEStyle->SetCanvasBorderMode(icol);
29  ECCEStyle->SetCanvasColor(icol);
30  ECCEStyle->SetPadBorderMode(icol);
31  ECCEStyle->SetPadColor(icol);
32  ECCEStyle->SetStatColor(icol);
33  //ECCEStyle->SetFillColor(icol); // don't use: white fill color for *all* objects
34 
35  // set the paper & margin sizes
36  ECCEStyle->SetPaperSize(20,26);
37 
38  // set margin sizes
39  ECCEStyle->SetPadTopMargin(0.05);
40  ECCEStyle->SetPadRightMargin(0.05);
41  ECCEStyle->SetPadBottomMargin(0.16);
42  ECCEStyle->SetPadLeftMargin(0.16);
43 
44  // set title offsets (for axis label)
45  ECCEStyle->SetTitleXOffset(1.4);
46  ECCEStyle->SetTitleYOffset(1.4);
47 
48  // use large fonts
49  //Int_t font=72; // Helvetica italics
50  Int_t font=42; // Helvetica
51  Double_t tsize=0.05;
52  ECCEStyle->SetTextFont(font);
53 
54  ECCEStyle->SetTextSize(tsize);
55  ECCEStyle->SetLabelFont(font,"x");
56  ECCEStyle->SetTitleFont(font,"x");
57  ECCEStyle->SetLabelFont(font,"y");
58  ECCEStyle->SetTitleFont(font,"y");
59  ECCEStyle->SetLabelFont(font,"z");
60  ECCEStyle->SetTitleFont(font,"z");
61 
62  ECCEStyle->SetLabelSize(tsize,"x");
63  ECCEStyle->SetTitleSize(tsize,"x");
64  ECCEStyle->SetLabelSize(tsize,"y");
65  ECCEStyle->SetTitleSize(tsize,"y");
66  ECCEStyle->SetLabelSize(tsize,"z");
67  ECCEStyle->SetTitleSize(tsize,"z");
68 
69  // use bold lines and markers
70  ECCEStyle->SetMarkerStyle(20);
71  ECCEStyle->SetMarkerSize(1.2);
72  ECCEStyle->SetHistLineWidth(2.);
73  ECCEStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
74 
75  // get rid of X error bars
76  //ECCEStyle->SetErrorX(0.001);
77  // get rid of error bar caps
78  ECCEStyle->SetEndErrorSize(0.);
79 
80  // do not display any of the standard histogram decorations
81  ECCEStyle->SetOptTitle(0);
82  //ECCEStyle->SetOptStat(1111);
83  ECCEStyle->SetOptStat(0);
84  //ECCEStyle->SetOptFit(1111);
85  ECCEStyle->SetOptFit(0);
86 
87  // put tick marks on top and RHS of plots
88  ECCEStyle->SetPadTickX(1);
89  ECCEStyle->SetPadTickY(1);
90 
91  // legend modificatin
92  ECCEStyle->SetLegendBorderSize(0);
93  ECCEStyle->SetLegendFillColor(0);
94  ECCEStyle->SetLegendFont(font);
95 
96 
97 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
98  std::cout << "ECCEStyle: ROOT6 mode" << std::endl;
99  ECCEStyle->SetLegendTextSize(tsize);
100  ECCEStyle->SetPalette(kBird);
101 #else
102  std::cout << "ECCEStyle: ROOT5 mode" << std::endl;
103  // color palette - manually define 'kBird' palette only available in ROOT 6
104  Int_t alpha = 0;
105  Double_t stops[9] = { 0.0000, 0.1250, 0.2500, 0.3750, 0.5000, 0.6250, 0.7500, 0.8750, 1.0000};
106  Double_t red[9] = { 0.2082, 0.0592, 0.0780, 0.0232, 0.1802, 0.5301, 0.8186, 0.9956, 0.9764};
107  Double_t green[9] = { 0.1664, 0.3599, 0.5041, 0.6419, 0.7178, 0.7492, 0.7328, 0.7862, 0.9832};
108  Double_t blue[9] = { 0.5293, 0.8684, 0.8385, 0.7914, 0.6425, 0.4662, 0.3499, 0.1968, 0.0539};
109  TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
110 #endif
111 
112  ECCEStyle->SetNumberContours(80);
113 
114  return ECCEStyle;
115 
116 }