ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/wangdy/sys/rootlogon.C
Revision: 1.6
Committed: Thu Jul 15 16:22:47 2010 UTC (14 years, 9 months ago) by wangdy
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +4 -1 lines
Error occurred while calculating annotation data.
Log Message:
change the pad right margin to allow for COLZ;use palatte from R.Reece

File Contents

# Content
1 // Dayong's rootlogon file
2 //
3 // $Log: rootlogon.C,v $
4 // Revision 1.5 2010/05/18 17:20:12 wangdy
5 // small updates
6 //
7 // Revision 1.4 2009/06/30 08:59:19 wangdy
8 // add mitstyle and some style functions
9 //
10 // Revision 1.3 2009/06/26 10:13:31 wangdy
11 // first import ildstyle; add yastyle and ildstyle directly into root logon
12 //
13 // Revision 1.2 2008/03/11 13:32:26 wangdy
14 // some old modifications to deal with styles using title
15 //
16 // Revision 1.1 2008/01/18 10:58:00 wangdy
17 // first import several root style related scripts
18 //
19 //
20
21 {
22 //
23 // ATLAS stylebased on a style file from BaBar
24 //
25
26 //.. style from RooLogon.C in workdir
27 TStyle *atlasStyle= new TStyle("atlasStyle","Atlas style");
28
29 // use plain black on white colors
30 Int_t icol=0;
31 atlasStyle->SetFrameBorderMode(icol);
32 atlasStyle->SetFrameFillColor(icol);
33 atlasStyle->SetCanvasBorderMode(icol);
34 atlasStyle->SetPadBorderMode(icol);
35 atlasStyle->SetPadColor(icol);
36 atlasStyle->SetCanvasColor(icol);
37 atlasStyle->SetStatColor(icol);
38 //atlasStyle->SetFillColor(icol);
39
40 // set the paper & margin sizes
41 atlasStyle->SetPaperSize(20,26);
42
43 // with title:0.07 ;no title:0.05
44 atlasStyle->SetPadTopMargin(0.07);
45 atlasStyle->SetPadRightMargin(0.05);
46 // with title:0.14 ;no title:0.16
47 atlasStyle->SetPadBottomMargin(0.14);
48 atlasStyle->SetPadLeftMargin(0.12);
49
50 // use large fonts
51 //Int_t font=72;
52 Int_t font=42;
53 Double_t tsize=0.05;
54 atlasStyle->SetTextFont(font);
55
56
57 atlasStyle->SetTextSize(tsize);
58 atlasStyle->SetLabelFont(font,"x");
59 atlasStyle->SetTitleFont(font,"x");
60 atlasStyle->SetLabelFont(font,"y");
61 atlasStyle->SetTitleFont(font,"y");
62 atlasStyle->SetLabelFont(font,"z");
63 atlasStyle->SetTitleFont(font,"z");
64
65 atlasStyle->SetLabelSize(tsize,"x");
66 atlasStyle->SetTitleSize(tsize,"x");
67 atlasStyle->SetLabelSize(tsize,"y");
68 atlasStyle->SetTitleSize(tsize,"y");
69 atlasStyle->SetLabelSize(tsize,"z");
70 atlasStyle->SetTitleSize(tsize,"z");
71
72
73 //use bold lines and markers
74 atlasStyle->SetMarkerStyle(20);
75 atlasStyle->SetMarkerSize(1.2);
76 atlasStyle->SetHistLineWidth(2.);
77 atlasStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
78
79 //get rid of X error bars and y error bar caps
80 //atlasStyle->SetErrorX(0.001);
81
82 //do not display any of the standard histogram decorations
83 atlasStyle->SetOptTitle(1);
84 atlasStyle->SetTitleFillColor(10);
85 //atlasStyle->SetOptStat(1111);
86 atlasStyle->SetOptStat(0);
87 //atlasStyle->SetOptFit(1111);
88 atlasStyle->SetOptFit(0);
89
90 // put tick marks on top and RHS of plots
91 atlasStyle->SetPadTickX(1);
92 atlasStyle->SetPadTickY(1);
93
94 //gROOT->SetStyle("Plain");
95
96 //gStyle->SetPadTickX(1);
97 //gStyle->SetPadTickY(1);
98
99
100 //--------------------------
101 // Here is CMS ptdr style
102 //-----------------------
103
104 TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");
105
106 // For the canvas:
107 tdrStyle->SetCanvasBorderMode(0);
108 tdrStyle->SetCanvasColor(kWhite);
109 tdrStyle->SetCanvasDefH(600); //Height of canvas
110 tdrStyle->SetCanvasDefW(600); //Width of canvas
111 tdrStyle->SetCanvasDefX(0); //POsition on screen
112 tdrStyle->SetCanvasDefY(0);
113
114 // For the Pad:
115 tdrStyle->SetPadBorderMode(0);
116 // tdrStyle->SetPadBorderSize(Width_t size = 1);
117 tdrStyle->SetPadColor(kWhite);
118 tdrStyle->SetPadGridX(false);
119 tdrStyle->SetPadGridY(false);
120 tdrStyle->SetGridColor(0);
121 tdrStyle->SetGridStyle(3);
122 tdrStyle->SetGridWidth(1);
123
124 // For the frame:
125 tdrStyle->SetFrameBorderMode(0);
126 tdrStyle->SetFrameBorderSize(1);
127 tdrStyle->SetFrameFillColor(0);
128 tdrStyle->SetFrameFillStyle(0);
129 tdrStyle->SetFrameLineColor(1);
130 tdrStyle->SetFrameLineStyle(1);
131 tdrStyle->SetFrameLineWidth(1);
132
133 // For the histo:
134 // tdrStyle->SetHistFillColor(1);
135 // tdrStyle->SetHistFillStyle(0);
136 tdrStyle->SetHistLineColor(1);
137 tdrStyle->SetHistLineStyle(0);
138 tdrStyle->SetHistLineWidth(1);
139 // tdrStyle->SetLegoInnerR(Float_t rad = 0.5);
140 // tdrStyle->SetNumberContours(Int_t number = 20);
141
142 tdrStyle->SetEndErrorSize(2);
143 tdrStyle->SetMarkerStyle(20);
144 tdrStyle->SetErrorX(0.);
145
146 tdrStyle->SetMarkerStyle(20);
147
148 //For the fit/function:
149 tdrStyle->SetOptFit(1);
150 tdrStyle->SetFitFormat("5.4g");
151 tdrStyle->SetFuncColor(2);
152 tdrStyle->SetFuncStyle(1);
153 tdrStyle->SetFuncWidth(1);
154
155 //For the date:
156 tdrStyle->SetOptDate(0);
157 // tdrStyle->SetDateX(Float_t x = 0.01);
158 // tdrStyle->SetDateY(Float_t y = 0.01);
159
160 // For the statistics box:
161 tdrStyle->SetOptFile(0);
162 tdrStyle->SetOptStat(0); // To display the mean and RMS: SetOptStat("mr");
163 tdrStyle->SetStatColor(kWhite);
164 tdrStyle->SetStatFont(42);
165 tdrStyle->SetStatFontSize(0.025);
166 tdrStyle->SetStatTextColor(1);
167 tdrStyle->SetStatFormat("6.4g");
168 tdrStyle->SetStatBorderSize(1);
169 tdrStyle->SetStatH(0.1);
170 tdrStyle->SetStatW(0.15);
171 // tdrStyle->SetStatStyle(Style_t style = 1001);
172 // tdrStyle->SetStatX(Float_t x = 0);
173 // tdrStyle->SetStatY(Float_t y = 0);
174
175 // Margins:
176 tdrStyle->SetPadTopMargin(0.05);
177 tdrStyle->SetPadBottomMargin(0.15);
178 tdrStyle->SetPadLeftMargin(0.15);
179 tdrStyle->SetPadRightMargin(0.12);
180
181 // For the Global title:
182
183 tdrStyle->SetOptTitle(0);
184 tdrStyle->SetTitleFont(42);
185 tdrStyle->SetTitleColor(1);
186 tdrStyle->SetTitleTextColor(1);
187 tdrStyle->SetTitleFillColor(10);
188 tdrStyle->SetTitleFontSize(0.05);
189 // tdrStyle->SetTitleH(0); // Set the height of the title box
190 // tdrStyle->SetTitleW(0); // Set the width of the title box
191 // tdrStyle->SetTitleX(0); // Set the position of the title box
192 // tdrStyle->SetTitleY(0.985); // Set the position of the title box
193 // tdrStyle->SetTitleStyle(Style_t style = 1001);
194 // tdrStyle->SetTitleBorderSize(2);
195
196 // For the axis titles:
197
198 tdrStyle->SetTitleColor(1, "XYZ");
199 tdrStyle->SetTitleFont(42, "XYZ");
200 tdrStyle->SetTitleSize(0.06, "XYZ");
201 // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
202 // tdrStyle->SetTitleYSize(Float_t size = 0.02);
203 tdrStyle->SetTitleXOffset(0.9);
204 tdrStyle->SetTitleYOffset(1.25);
205 // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset
206
207 // For the axis labels:
208
209 tdrStyle->SetLabelColor(1, "XYZ");
210 tdrStyle->SetLabelFont(42, "XYZ");
211 tdrStyle->SetLabelOffset(0.007, "XYZ");
212 tdrStyle->SetLabelSize(0.05, "XYZ");
213
214 // For the axis:
215
216 tdrStyle->SetAxisColor(1, "XYZ");
217 tdrStyle->SetStripDecimals(kTRUE);
218 tdrStyle->SetTickLength(0.03, "XYZ");
219 tdrStyle->SetNdivisions(510, "XYZ");
220 tdrStyle->SetPadTickX(1); // To get tick marks on the opposite side of the frame
221 tdrStyle->SetPadTickY(1);
222
223 tdrStyle->SetPalette (1);
224 // Change for log plots:
225 tdrStyle->SetOptLogx(0);
226 tdrStyle->SetOptLogy(0);
227 tdrStyle->SetOptLogz(0);
228
229 // Postscript options:
230 // tdrStyle->SetPaperSize(20.,20.);
231 // tdrStyle->SetLineScalePS(Float_t scale = 3);
232 // tdrStyle->SetLineStyleString(Int_t i, const char* text);
233 // tdrStyle->SetHeaderPS(const char* header);
234 // tdrStyle->SetTitlePS(const char* pstitle);
235
236 // tdrStyle->SetBarOffset(Float_t baroff = 0.5);
237 // tdrStyle->SetBarWidth(Float_t barwidth = 0.5);
238 // tdrStyle->SetPaintTextFormat(const char* format = "g");
239 // tdrStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
240 // tdrStyle->SetTimeOffset(Double_t toffset);
241 // tdrStyle->SetHistMinimumZero(kTRUE);
242
243 //----------------------------------------------
244 // Here is the ild style
245 //--------------------------------------
246
247 //ild TStyle
248 TStyle* ildStyle = new TStyle("ildStyle", "ILD Style");
249
250 //set the background color to white
251 ildStyle->SetFillColor(10);
252 ildStyle->SetFrameFillColor(10);
253 ildStyle->SetCanvasColor(10);
254 ildStyle->SetPadColor(10);
255 ildStyle->SetTitleFillColor(0);
256 ildStyle->SetStatColor(10);
257
258 //dont put a colored frame around the plots
259 ildStyle->SetFrameBorderMode(0);
260 ildStyle->SetCanvasBorderMode(0);
261 ildStyle->SetPadBorderMode(0);
262 ildStyle->SetLegendBorderSize(0);
263
264 //use the primary color palette
265 ildStyle->SetPalette(1,0);
266
267 //set the default line color for a histogram to be black
268 ildStyle->SetHistLineColor(kBlack);
269
270 //set the default line color for a fit function to be red
271 ildStyle->SetFuncColor(kRed);
272
273 //make the axis labels black
274 ildStyle->SetLabelColor(kBlack,"xyz");
275
276 //set the default title color to be black
277 ildStyle->SetTitleColor(kBlack);
278
279 //set the margins
280 ildStyle->SetPadBottomMargin(0.18);
281 ildStyle->SetPadTopMargin(0.08);
282 ildStyle->SetPadRightMargin(0.08);
283 ildStyle->SetPadLeftMargin(0.17);
284
285 //set axis label and title text sizes
286 ildStyle->SetLabelFont(42,"xyz");
287 ildStyle->SetLabelSize(0.06,"xyz");
288 ildStyle->SetLabelOffset(0.015,"xyz");
289 ildStyle->SetTitleFont(42,"xyz");
290 ildStyle->SetTitleSize(0.07,"xyz");
291 ildStyle->SetTitleOffset(1.1,"yz");
292 ildStyle->SetTitleOffset(1.0,"x");
293 ildStyle->SetStatFont(42);
294 ildStyle->SetStatFontSize(0.07);
295 ildStyle->SetTitleBorderSize(0);
296 ildStyle->SetStatBorderSize(0);
297 ildStyle->SetTextFont(42);
298
299 //set line widths
300 ildStyle->SetFrameLineWidth(2);
301 ildStyle->SetFuncWidth(2);
302 ildStyle->SetHistLineWidth(2);
303
304 //set the number of divisions to show
305 ildStyle->SetNdivisions(506, "xy");
306
307 //turn off xy grids
308 ildStyle->SetPadGridX(0);
309 ildStyle->SetPadGridY(0);
310
311 //set the tick mark style
312 ildStyle->SetPadTickX(1);
313 ildStyle->SetPadTickY(1);
314
315 //turn off stats
316 ildStyle->SetOptStat(0);
317 ildStyle->SetOptFit(0);
318
319 //marker settings
320 ildStyle->SetMarkerStyle(20);
321 ildStyle->SetMarkerSize(0.7);
322 ildStyle->SetLineWidth(2);
323
324 //------------------------
325 // yastyle
326 //-----------------------
327
328 TStyle* yaStyle = new TStyle("yaStyle", "YA Style");
329 yaStyle->SetFillColor(0);
330 yaStyle->SetOptDate();
331 yaStyle->SetOptStat(111110);
332 yaStyle->SetOptFit(1111);
333 yaStyle->SetPadTickX(1);
334 yaStyle->SetPadTickY(1);
335 yaStyle->SetMarkerSize(0.5);
336 yaStyle->SetMarkerStyle(8);
337 yaStyle->SetGridStyle(3);
338 yaStyle->SetPaperSize(TStyle::kA4);
339 yaStyle->SetStatW(0.35); // width of statistics box; default is 0.19
340 yaStyle->SetStatH(0.20); // height of statistics box; default is 0.1
341 yaStyle->SetStatFormat("6.4g"); // leave default format for now
342 yaStyle->SetTitleSize(0.055, ""); // size for pad title; default is 0.02
343 // Really big; useful for talks.
344 yaStyle->SetTitleSize(0.1, ""); // size for pad title; default is 0.02
345 yaStyle->SetLabelSize(0.05, "XYZ"); // size for axis labels; default is 0.04
346 yaStyle->SetStatFontSize(0.06); // size for stat. box
347 yaStyle->SetTitleFont(32, "XYZ"); // times-bold-italic font (p. 153) for axes
348 yaStyle->SetTitleFont(32, ""); // same for pad title
349 yaStyle->SetLabelFont(32, "XYZ"); // same for axis labels
350 yaStyle->SetStatFont(32); // same for stat. box
351 yaStyle->SetLabelOffset(0.006, "Y"); // default is 0.005
352
353
354 //------------------------
355 // MIT Style
356 //-----------------------
357
358 TStyle *MITStyle = new TStyle("mitStyle","The Perfect Style for Plots ;-)");
359
360 // Canvas
361 MITStyle->SetCanvasColor (0);
362 MITStyle->SetCanvasBorderSize(10);
363 MITStyle->SetCanvasBorderMode(0);
364 MITStyle->SetCanvasDefH (700);
365 MITStyle->SetCanvasDefW (700);
366 MITStyle->SetCanvasDefX (100);
367 MITStyle->SetCanvasDefY (100);
368
369 // Pads
370 MITStyle->SetPadColor (0);
371 MITStyle->SetPadBorderSize (10);
372 MITStyle->SetPadBorderMode (0);
373 MITStyle->SetPadBottomMargin(0.13);
374 MITStyle->SetPadTopMargin (0.08);
375 MITStyle->SetPadLeftMargin (0.15);
376 MITStyle->SetPadRightMargin (0.05);
377 MITStyle->SetPadGridX (0);
378 MITStyle->SetPadGridY (0);
379 MITStyle->SetPadTickX (0);
380 MITStyle->SetPadTickY (0);
381
382 // Frames
383 MITStyle->SetFrameFillStyle ( 0);
384 MITStyle->SetFrameFillColor ( 0);
385 MITStyle->SetFrameLineColor ( 1);
386 MITStyle->SetFrameLineStyle ( 0);
387 MITStyle->SetFrameLineWidth ( 1);
388 MITStyle->SetFrameBorderSize(10);
389 MITStyle->SetFrameBorderMode( 0);
390
391 // Histograms
392 MITStyle->SetHistFillColor(2);
393 MITStyle->SetHistFillStyle(0);
394 MITStyle->SetHistLineColor(1);
395 MITStyle->SetHistLineStyle(0);
396 MITStyle->SetHistLineWidth(2);
397 MITStyle->SetNdivisions(505);
398
399 // Functions
400 MITStyle->SetFuncColor(1);
401 MITStyle->SetFuncStyle(0);
402 MITStyle->SetFuncWidth(2);
403
404 // Various
405 MITStyle->SetMarkerStyle(20);
406 MITStyle->SetMarkerColor(kBlack);
407 MITStyle->SetMarkerSize (1.2);
408
409 MITStyle->SetTitleSize (0.055,"X");
410 MITStyle->SetTitleOffset(0.900,"X");
411 MITStyle->SetLabelOffset(0.005,"X");
412 MITStyle->SetLabelSize (0.050,"X");
413 MITStyle->SetLabelFont (42 ,"X");
414
415 MITStyle->SetStripDecimals(kFALSE);
416
417 MITStyle->SetTitleSize (0.055,"Y");
418 MITStyle->SetTitleOffset(1.300,"Y");
419 MITStyle->SetLabelOffset(0.010,"Y");
420 MITStyle->SetLabelSize (0.050,"Y");
421 MITStyle->SetLabelFont (42 ,"Y");
422
423 MITStyle->SetTextSize (0.055);
424 MITStyle->SetTextFont (42);
425
426 MITStyle->SetStatFont (42);
427 MITStyle->SetTitleFont (42);
428 MITStyle->SetTitleFont (42,"X");
429 MITStyle->SetTitleFont (42,"Y");
430
431 MITStyle->SetPalette (1);
432
433 MITStyle->SetOptStat (0);
434 //MITStyle->SetOptStat (111111);
435
436
437
438
439 // // for CMSSW
440 //gSystem->Load("libFWCoreFWLite.so"); //for CMSSW >=0.8.0
441 //AutoLibraryLoader::enable();
442
443 // default style
444 // gROOT->SetStyle("Plain");
445 // gStyle->SetOptStat(1111111);
446 // gStyle->SetPadTickX(1);
447 // gStyle->SetPadTickY(1);
448
449 // activate these two style following way
450 // gROOT->SetStyle("atlasStyle");
451 gROOT->SetStyle("tdrStyle");
452 // gROOT->SetStyle("ildStyle");
453 // gROOT->SetStyle("yaStyle");
454 // gROOT->SetStyle("mitStyle");
455 gROOT->ForceStyle();
456
457 // load various style functions
458 gInterpreter->LoadMacro("styleFunc.C");
459
460 }
461