ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/jbabb/ScriptsAndMacros/tdrstyle.C
Revision: 1.1
Committed: Mon Aug 16 13:30:01 2010 UTC (14 years, 8 months ago) by jbabb
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
Initial Check-In

File Contents

# User Rev Content
1 jbabb 1.1 #include "TStyle.h"
2    
3    
4    
5     // tdrGrid: Turns the grid lines on (true) or off (false)
6    
7    
8    
9     void tdrGrid(bool gridOn) {
10    
11     tdrStyle->SetPadGridX(gridOn);
12    
13     tdrStyle->SetPadGridY(gridOn);
14    
15     }
16    
17    
18    
19     // fixOverlay: Redraws the axis
20    
21    
22    
23     void fixOverlay() {
24    
25     gPad->RedrawAxis();
26    
27     }
28    
29    
30    
31     void setTDRStyle() {
32    
33     TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");
34    
35    
36    
37     // For the canvas:
38    
39     tdrStyle->SetCanvasBorderMode(0);
40    
41     tdrStyle->SetCanvasColor(kWhite);
42    
43     tdrStyle->SetCanvasDefH(600); //Height of canvas
44    
45     tdrStyle->SetCanvasDefW(600); //Width of canvas
46    
47     tdrStyle->SetCanvasDefX(0); //POsition on screen
48    
49     tdrStyle->SetCanvasDefY(0);
50    
51    
52    
53     // For the Pad:
54    
55     tdrStyle->SetPadBorderMode(0);
56    
57     // tdrStyle->SetPadBorderSize(Width_t size = 1);
58    
59     tdrStyle->SetPadColor(kWhite);
60    
61     tdrStyle->SetPadGridX(false);
62    
63     tdrStyle->SetPadGridY(false);
64    
65     tdrStyle->SetGridColor(0);
66    
67     tdrStyle->SetGridStyle(3);
68    
69     tdrStyle->SetGridWidth(1);
70    
71    
72    
73     // For the frame:
74    
75     tdrStyle->SetFrameBorderMode(0);
76    
77     tdrStyle->SetFrameBorderSize(1);
78    
79     tdrStyle->SetFrameFillColor(0);
80    
81     tdrStyle->SetFrameFillStyle(0);
82    
83     tdrStyle->SetFrameLineColor(1);
84    
85     tdrStyle->SetFrameLineStyle(1);
86    
87     tdrStyle->SetFrameLineWidth(1);
88    
89    
90    
91     // For the histo:
92    
93     // tdrStyle->SetHistFillColor(1);
94    
95     // tdrStyle->SetHistFillStyle(0);
96    
97     tdrStyle->SetHistLineColor(1);
98    
99     tdrStyle->SetHistLineStyle(0);
100    
101     tdrStyle->SetHistLineWidth(1);
102    
103     // tdrStyle->SetLegoInnerR(Float_t rad = 0.5);
104    
105     // tdrStyle->SetNumberContours(Int_t number = 20);
106    
107    
108    
109     tdrStyle->SetEndErrorSize(2);
110    
111     //tdrStyle->SetErrorMarker(20);
112    
113     tdrStyle->SetErrorX(0.);
114    
115    
116    
117     tdrStyle->SetMarkerStyle(20);
118    
119    
120    
121     //For the fit/function:
122    
123     tdrStyle->SetOptFit(1);
124    
125     tdrStyle->SetFitFormat("5.4g");
126    
127     tdrStyle->SetFuncColor(2);
128    
129     tdrStyle->SetFuncStyle(1);
130    
131     tdrStyle->SetFuncWidth(1);
132    
133    
134    
135     //For the date:
136    
137     tdrStyle->SetOptDate(0);
138    
139     // tdrStyle->SetDateX(Float_t x = 0.01);
140    
141     // tdrStyle->SetDateY(Float_t y = 0.01);
142    
143    
144    
145     // For the statistics box:
146    
147     tdrStyle->SetOptFile(0);
148    
149     tdrStyle->SetOptStat(0); // To display the mean and RMS: SetOptStat("mr");
150    
151     tdrStyle->SetStatColor(kWhite);
152    
153     tdrStyle->SetStatFont(42);
154    
155     tdrStyle->SetStatFontSize(0.025);
156    
157     tdrStyle->SetStatTextColor(1);
158    
159     tdrStyle->SetStatFormat("6.4g");
160    
161     tdrStyle->SetStatBorderSize(1);
162    
163     tdrStyle->SetStatH(0.1);
164    
165     tdrStyle->SetStatW(0.15);
166    
167     // tdrStyle->SetStatStyle(Style_t style = 1001);
168    
169     // tdrStyle->SetStatX(Float_t x = 0);
170    
171     // tdrStyle->SetStatY(Float_t y = 0);
172    
173    
174    
175     // Margins:
176    
177     tdrStyle->SetPadTopMargin(0.05);
178    
179     tdrStyle->SetPadBottomMargin(0.13);
180    
181     tdrStyle->SetPadLeftMargin(0.16);
182    
183     tdrStyle->SetPadRightMargin(0.02);
184    
185    
186    
187     // For the Global title:
188    
189    
190    
191     tdrStyle->SetOptTitle(0);
192    
193     tdrStyle->SetTitleFont(42);
194    
195     tdrStyle->SetTitleColor(1);
196    
197     tdrStyle->SetTitleTextColor(1);
198    
199     tdrStyle->SetTitleFillColor(10);
200    
201     tdrStyle->SetTitleFontSize(0.05);
202    
203     // tdrStyle->SetTitleH(0); // Set the height of the title box
204    
205     // tdrStyle->SetTitleW(0); // Set the width of the title box
206    
207     // tdrStyle->SetTitleX(0); // Set the position of the title box
208    
209     // tdrStyle->SetTitleY(0.985); // Set the position of the title box
210    
211     // tdrStyle->SetTitleStyle(Style_t style = 1001);
212    
213     // tdrStyle->SetTitleBorderSize(2);
214    
215    
216    
217     // For the axis titles:
218    
219    
220    
221     tdrStyle->SetTitleColor(1, "XYZ");
222    
223     tdrStyle->SetTitleFont(42, "XYZ");
224    
225     tdrStyle->SetTitleSize(0.06, "XYZ");
226    
227     // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
228    
229     // tdrStyle->SetTitleYSize(Float_t size = 0.02);
230    
231     tdrStyle->SetTitleXOffset(0.9);
232    
233     tdrStyle->SetTitleYOffset(1.25);
234    
235     // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset
236    
237    
238    
239     // For the axis labels:
240    
241    
242    
243     tdrStyle->SetLabelColor(1, "XYZ");
244    
245     tdrStyle->SetLabelFont(42, "XYZ");
246    
247     tdrStyle->SetLabelOffset(0.007, "XYZ");
248    
249     tdrStyle->SetLabelSize(0.05, "XYZ");
250    
251    
252    
253     // For the axis:
254    
255    
256    
257     tdrStyle->SetAxisColor(1, "XYZ");
258    
259     tdrStyle->SetStripDecimals(kTRUE);
260    
261     tdrStyle->SetTickLength(0.03, "XYZ");
262    
263     tdrStyle->SetNdivisions(510, "XYZ");
264    
265     tdrStyle->SetPadTickX(1); // To get tick marks on the opposite side of the frame
266    
267     tdrStyle->SetPadTickY(1);
268    
269    
270    
271     // Change for log plots:
272    
273     tdrStyle->SetOptLogx(0);
274    
275     tdrStyle->SetOptLogy(0);
276    
277     tdrStyle->SetOptLogz(0);
278    
279    
280    
281     // Postscript options:
282    
283     tdrStyle->SetPaperSize(20.,20.);
284    
285     // tdrStyle->SetLineScalePS(Float_t scale = 3);
286    
287     // tdrStyle->SetLineStyleString(Int_t i, const char* text);
288    
289     // tdrStyle->SetHeaderPS(const char* header);
290    
291     // tdrStyle->SetTitlePS(const char* pstitle);
292    
293    
294    
295     // tdrStyle->SetBarOffset(Float_t baroff = 0.5);
296    
297     // tdrStyle->SetBarWidth(Float_t barwidth = 0.5);
298    
299     // tdrStyle->SetPaintTextFormat(const char* format = "g");
300    
301     // tdrStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
302    
303     // tdrStyle->SetTimeOffset(Double_t toffset);
304    
305     // tdrStyle->SetHistMinimumZero(kTRUE);
306    
307    
308    
309     tdrStyle->cd();
310    
311    
312    
313     }
314