Crombie Tools
tdrStyle.py
Go to the documentation of this file.
1 import sys, ROOT
2 from ROOT import gStyle
3 
4 ## @todo Check tdrStyle stuff out and consider making CrombieStyle
5 
6 def setTDRStyle():
7 
8  # For the canvas:
9  ROOT . gStyle . SetCanvasBorderMode(0)
10  ROOT . gStyle . SetCanvasColor(0) # must be kWhite but I dunno how to do that in PyROOT
11  ROOT . gStyle . SetCanvasDefH(600) #Height of canvas
12  ROOT . gStyle . SetCanvasDefW(600) #Width of canvas
13  ROOT . gStyle . SetCanvasDefX(0) #POsition on screen
14  ROOT . gStyle . SetCanvasDefY(0)
15 
16 
17 # For the Pad:
18  ROOT . gStyle . SetPadBorderMode(0);
19  # ROOT . gStyle . SetPadBorderSize(Width_t size = 1);
20  ROOT . gStyle . SetPadColor(0); # kWhite
21  ROOT . gStyle . SetPadGridX(0); #false
22  ROOT . gStyle . SetPadGridY(0); #false
23  ROOT . gStyle . SetGridColor(0);
24  ROOT . gStyle . SetGridStyle(3);
25  ROOT . gStyle . SetGridWidth(1);
26 
27 # For the frame:
28  ROOT . gStyle . SetFrameBorderMode(0);
29  ROOT . gStyle . SetFrameBorderSize(1);
30  ROOT . gStyle . SetFrameFillColor(0);
31  ROOT . gStyle . SetFrameFillStyle(0);
32  ROOT . gStyle . SetFrameLineColor(1);
33  ROOT . gStyle . SetFrameLineStyle(1);
34  ROOT . gStyle . SetFrameLineWidth(1);
35 
36 # For the histo:
37  # ROOT . gStyle . SetHistFillColor(1);
38  # ROOT . gStyle . SetHistFillStyle(0);
39  ROOT . gStyle . SetHistLineColor(1);
40  ROOT . gStyle . SetHistLineStyle(0);
41  ROOT . gStyle . SetHistLineWidth(1);
42  # ROOT . gStyle . SetLegoInnerR(Float_t rad = 0.5);
43  # ROOT . gStyle . SetNumberContours(Int_t number = 20);
44 
45  ROOT . gStyle . SetEndErrorSize(2);
46  #ROOT . gStyle . SetErrorMarker(20); #/ I COMMENTED THIS OUT
47  #ROOT . gStyle . SetErrorX(0.);
48 
49  #ROOT . gStyle . SetMarkerStyle(20);
50 
51 
52 #For the fit/function:
53  ROOT . gStyle . SetOptFit(1011);
54  ROOT . gStyle . SetFitFormat("5.4g");
55  ROOT . gStyle . SetFuncColor(2);
56  ROOT . gStyle . SetFuncStyle(1);
57  ROOT . gStyle . SetFuncWidth(1);
58 
59 #For the date:
60  ROOT . gStyle . SetOptDate(0);
61  # ROOT . gStyle . SetDateX(Float_t x = 0.01);
62  # ROOT . gStyle . SetDateY(Float_t y = 0.01);
63 
64 # For the statistics box:
65  ROOT . gStyle . SetOptFile(0);
66  ROOT . gStyle . SetOptStat(0); # To display the mean and RMS: SetOptStat("mr");
67  ROOT . gStyle . SetStatColor(0); # kWhite
68  ROOT . gStyle . SetStatFont(42);
69  #ROOT . gStyle . SetStatFontSize(0.025);
70  ROOT . gStyle . SetStatFontSize(0.04);
71  ROOT . gStyle . SetStatTextColor(1);
72  ROOT . gStyle . SetStatFormat("6.4g");
73  ROOT . gStyle . SetStatBorderSize(1);
74  ROOT . gStyle . SetStatH(0.1);
75  ROOT . gStyle . SetStatW(0.15);
76  # ROOT . gStyle . SetStatStyle(Style_t style = 1001);
77  # ROOT . gStyle . SetStatX(Float_t x = 0);
78  # ROOT . gStyle . SetStatY(Float_t y = 0);
79 
80 # Margins:
81  ROOT . gStyle . SetPadTopMargin(0.07);
82  ROOT . gStyle . SetPadBottomMargin(0.13);
83  ROOT . gStyle . SetPadLeftMargin(0.12);
84  #ROOT . gStyle . SetPadRightMargin(0.12);
85  ROOT . gStyle . SetPadRightMargin(0.05);
86 
87 # For the Global title:
88 
89  ROOT . gStyle . SetOptTitle(0);
90  ROOT . gStyle . SetTitleFont(42);
91  ROOT . gStyle . SetTitleColor(1);
92  ROOT . gStyle . SetTitleTextColor(1);
93  ROOT . gStyle . SetTitleFillColor(10);
94  ROOT . gStyle . SetTitleFontSize(0.05);
95  # ROOT . gStyle . SetTitleH(0); # Set the height of the title box
96  # ROOT . gStyle . SetTitleW(0); # Set the width of the title box
97  # ROOT . gStyle . SetTitleX(0); # Set the position of the title box
98  # ROOT . gStyle . SetTitleY(0.985); # Set the position of the title box
99  # ROOT . gStyle . SetTitleStyle(Style_t style = 1001);
100  # ROOT . gStyle . SetTitleBorderSize(2);
101 
102 # For the axis titles:
103 
104  ROOT . gStyle . SetTitleColor(1, "XYZ");
105  ROOT . gStyle . SetTitleFont(42, "XYZ");
106  ROOT . gStyle . SetTitleSize(0.05, "XYZ");
107  # ROOT . gStyle . SetTitleXSize(Float_t size = 0.02); # Another way to set the size?
108  # ROOT . gStyle . SetTitleYSize(Float_t size = 0.02);
109  ROOT . gStyle . SetTitleXOffset(0.9);
110  ROOT . gStyle . SetTitleYOffset(1.05);
111  # ROOT . gStyle . SetTitleOffset(1.1, "Y"); # Another way to set the Offset
112 
113 # For the axis labels:
114 
115  ROOT . gStyle . SetLabelColor(1, "XYZ");
116  ROOT . gStyle . SetLabelFont(42, "XYZ");
117  ROOT . gStyle . SetLabelOffset(0.007, "XYZ");
118  ROOT . gStyle . SetLabelSize(0.04, "XYZ");
119 
120 # For the axis:
121 
122  ROOT . gStyle . SetAxisColor(1, "XYZ");
123  ROOT . gStyle . SetStripDecimals(1); # kTRUE
124  ROOT . gStyle . SetTickLength(0.025, "XYZ");
125  ROOT . gStyle . SetNdivisions(510, "XYZ");
126  ROOT . gStyle . SetPadTickX(1); # To get tick marks on the opposite side of the frame
127  ROOT . gStyle . SetPadTickY(1);
128 
129 # Change for log plots:
130  ROOT . gStyle . SetOptLogx(0);
131  ROOT . gStyle . SetOptLogy(0);
132  ROOT . gStyle . SetOptLogz(0);
133 
134 # Postscript options:
135  ROOT . gStyle . SetPaperSize(20.,20.);
136  # ROOT . gStyle . SetLineScalePS(Float_t scale = 3);
137  # ROOT . gStyle . SetLineStyleString(Int_t i, const char* text);
138  # ROOT . gStyle . SetHeaderPS(const char* header);
139  # ROOT . gStyle . SetTitlePS(const char* pstitle);
140 
141  # ROOT . gStyle . SetBarOffset(Float_t baroff = 0.5);
142  # ROOT . gStyle . SetBarWidth(Float_t barwidth = 0.5);
143  # ROOT . gStyle . SetPaintTextFormat(const char* format = "g");
144  # ROOT . gStyle . SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
145  # ROOT . gStyle . SetTimeOffset(Double_t toffset);
146  # ROOT . gStyle . SetHistMinimumZero(kTRUE);