1 |
|
## |
2 |
|
## $Log$ |
3 |
+ |
## Revision 1.4 2009/06/26 10:13:31 wangdy |
4 |
+ |
## first import ildstyle; add yastyle and ildstyle directly into root logon |
5 |
+ |
## |
6 |
+ |
## Revision 1.3 2008/01/18 15:51:18 wangdy |
7 |
+ |
## adjust top margin of the pad w/(o) title |
8 |
+ |
## |
9 |
|
## Revision 1.2 2008/01/18 11:33:19 wangdy |
10 |
|
## add setting for title color |
11 |
|
## |
18 |
|
|
19 |
|
from ROOT import * |
20 |
|
|
21 |
+ |
|
22 |
+ |
atlasStyle=TStyle("atlasStyle","Atlas style") |
23 |
+ |
tdrStyle = TStyle("tdrStyle","Style for P-TDR") |
24 |
+ |
ildStyle = TStyle("ildStyle","ILD Style") |
25 |
+ |
yaStyle = TStyle("yaStyle","Yet Another Style, for talks") |
26 |
+ |
|
27 |
|
def atlasstyle(): |
28 |
|
|
29 |
|
""" ATLAS stylebased on a style file from BaBar""" |
30 |
|
|
31 |
|
global atlasStyle |
32 |
|
##.. style from RooLogon.C in workdir |
33 |
< |
## atlasStyle=TStyle("ATLAS","Atlas style") |
33 |
> |
## atlasStyle=TStyle("ATLAS","Atlas style") |
34 |
|
|
35 |
|
## use plain black on white colors |
36 |
|
icol=0 |
37 |
|
atlasStyle.SetFrameBorderMode(icol) |
38 |
+ |
atlasStyle.SetFrameFillColor(icol) |
39 |
|
atlasStyle.SetCanvasBorderMode(icol) |
40 |
|
atlasStyle.SetPadBorderMode(icol) |
41 |
|
atlasStyle.SetPadColor(icol) |
45 |
|
|
46 |
|
## set the paper & margin sizes |
47 |
|
atlasStyle.SetPaperSize(20,26) |
48 |
< |
atlasStyle.SetPadTopMargin(0.05) |
48 |
> |
|
49 |
> |
## with title:0.07 ;no title:0.05 |
50 |
> |
atlasStyle.SetPadTopMargin(0.07) |
51 |
|
atlasStyle.SetPadRightMargin(0.05) |
52 |
< |
atlasStyle.SetPadBottomMargin(0.16) |
52 |
> |
|
53 |
> |
## with title:0.14 ;no title:0.16 |
54 |
> |
atlasStyle.SetPadBottomMargin(0.14) |
55 |
|
atlasStyle.SetPadLeftMargin(0.12) |
56 |
|
|
57 |
|
## use large fonts |
108 |
|
Here is CMS ptdr style |
109 |
|
""" |
110 |
|
global tdrStyle |
111 |
< |
# tdrStyle = TStyle("tdrStyle","Style for P-TDR") |
111 |
> |
## tdrStyle = TStyle("tdrStyle","Style for P-TDR") |
112 |
|
|
113 |
|
## For the canvas: |
114 |
|
tdrStyle.SetCanvasBorderMode(0) |
242 |
|
gROOT.SetStyle("tdrStyle") |
243 |
|
gROOT.ForceStyle() |
244 |
|
|
245 |
< |
atlasStyle=TStyle("ATLAS","Atlas style") |
246 |
< |
tdrStyle = TStyle("tdrStyle","Style for P-TDR") |
245 |
> |
def ildstyle(): |
246 |
> |
|
247 |
> |
""" |
248 |
> |
Here is ILD style |
249 |
> |
""" |
250 |
> |
global ildStyle |
251 |
> |
|
252 |
> |
|
253 |
> |
#set the background color to white |
254 |
> |
ildStyle.SetFillColor(10) |
255 |
> |
ildStyle.SetFrameFillColor(10) |
256 |
> |
ildStyle.SetCanvasColor(10) |
257 |
> |
ildStyle.SetPadColor(10) |
258 |
> |
ildStyle.SetTitleFillColor(0) |
259 |
> |
ildStyle.SetStatColor(10) |
260 |
> |
|
261 |
> |
#dont put a colored frame around the plots |
262 |
> |
ildStyle.SetFrameBorderMode(0) |
263 |
> |
ildStyle.SetCanvasBorderMode(0) |
264 |
> |
ildStyle.SetPadBorderMode(0) |
265 |
> |
ildStyle.SetLegendBorderSize(0) |
266 |
> |
|
267 |
> |
#use the primary color palette |
268 |
> |
ildStyle.SetPalette(1,0) |
269 |
> |
|
270 |
> |
#set the default line color for a histogram to be black |
271 |
> |
ildStyle.SetHistLineColor(kBlack) |
272 |
> |
|
273 |
> |
#set the default line color for a fit function to be red |
274 |
> |
ildStyle.SetFuncColor(kRed) |
275 |
> |
|
276 |
> |
#make the axis labels black |
277 |
> |
ildStyle.SetLabelColor(kBlack,"xyz") |
278 |
> |
|
279 |
> |
#set the default title color to be black |
280 |
> |
ildStyle.SetTitleColor(kBlack) |
281 |
> |
|
282 |
> |
#set the margins |
283 |
> |
ildStyle.SetPadBottomMargin(0.18) |
284 |
> |
ildStyle.SetPadTopMargin(0.08) |
285 |
> |
ildStyle.SetPadRightMargin(0.08) |
286 |
> |
ildStyle.SetPadLeftMargin(0.17) |
287 |
> |
|
288 |
> |
#set axis label and title text sizes |
289 |
> |
ildStyle.SetLabelFont(42,"xyz") |
290 |
> |
ildStyle.SetLabelSize(0.06,"xyz") |
291 |
> |
ildStyle.SetLabelOffset(0.015,"xyz") |
292 |
> |
ildStyle.SetTitleFont(42,"xyz") |
293 |
> |
ildStyle.SetTitleSize(0.07,"xyz") |
294 |
> |
ildStyle.SetTitleOffset(1.1,"yz") |
295 |
> |
ildStyle.SetTitleOffset(1.0,"x") |
296 |
> |
ildStyle.SetStatFont(42) |
297 |
> |
ildStyle.SetStatFontSize(0.07) |
298 |
> |
ildStyle.SetTitleBorderSize(0) |
299 |
> |
ildStyle.SetStatBorderSize(0) |
300 |
> |
ildStyle.SetTextFont(42) |
301 |
> |
|
302 |
> |
#set line widths |
303 |
> |
ildStyle.SetFrameLineWidth(2) |
304 |
> |
ildStyle.SetFuncWidth(2) |
305 |
> |
ildStyle.SetHistLineWidth(2) |
306 |
> |
|
307 |
> |
#set the number of divisions to show |
308 |
> |
ildStyle.SetNdivisions(506, "xy") |
309 |
> |
|
310 |
> |
#turn off xy grids |
311 |
> |
ildStyle.SetPadGridX(0) |
312 |
> |
ildStyle.SetPadGridY(0) |
313 |
> |
|
314 |
> |
#set the tick mark style |
315 |
> |
ildStyle.SetPadTickX(1) |
316 |
> |
ildStyle.SetPadTickY(1) |
317 |
> |
|
318 |
> |
#turn off stats |
319 |
> |
ildStyle.SetOptStat(0) |
320 |
> |
ildStyle.SetOptFit(0) |
321 |
> |
|
322 |
> |
#marker settings |
323 |
> |
ildStyle.SetMarkerStyle(20) |
324 |
> |
ildStyle.SetMarkerSize(0.7) |
325 |
> |
ildStyle.SetLineWidth(2) |
326 |
> |
|
327 |
> |
gROOT.SetStyle("ildStyle") |
328 |
> |
gROOT.ForceStyle() |
329 |
> |
|
330 |
> |
def yastyle(): |
331 |
> |
|
332 |
> |
""" |
333 |
> |
Here is Yet Another style |
334 |
> |
""" |
335 |
> |
global yaStyle |
336 |
> |
|
337 |
> |
yaStyle.SetFillColor(0) |
338 |
> |
yaStyle.SetOptDate() |
339 |
> |
yaStyle.SetOptStat(111110) |
340 |
> |
yaStyle.SetOptFit(1111) |
341 |
> |
yaStyle.SetPadTickX(1) |
342 |
> |
yaStyle.SetPadTickY(1) |
343 |
> |
yaStyle.SetMarkerSize(0.5) |
344 |
> |
yaStyle.SetMarkerStyle(8) |
345 |
> |
yaStyle.SetGridStyle(3) |
346 |
> |
yaStyle.SetPaperSize(TStyle::kA4) |
347 |
> |
yaStyle.SetStatW(0.35) # width of statistics box; default is 0.19 |
348 |
> |
yaStyle.SetStatH(0.20) # height of statistics box; default is 0.1 |
349 |
> |
yaStyle.SetStatFormat("6.4g") # leave default format for now |
350 |
> |
yaStyle.SetTitleSize(0.055, "") # size for pad title; default is 0.02 |
351 |
> |
# Really big; useful for talks. |
352 |
> |
yaStyle.SetTitleSize(0.1, "") # size for pad title; default is 0.02 |
353 |
> |
yaStyle.SetLabelSize(0.05, "XYZ") # size for axis labels; default is 0.04 |
354 |
> |
yaStyle.SetStatFontSize(0.06) # size for stat. box |
355 |
> |
yaStyle.SetTitleFont(32, "XYZ") # times-bold-italic font (p. 153) for axes |
356 |
> |
yaStyle.SetTitleFont(32, "") # same for pad title |
357 |
> |
yaStyle.SetLabelFont(32, "XYZ") # same for axis labels |
358 |
> |
yaStyle.SetStatFont(32) # same for stat. box |
359 |
> |
yaStyle.SetLabelOffset(0.006, "Y") # default is 0.005 |
360 |
> |
|
361 |
> |
gROOT.SetStyle("yaStyle") |
362 |
> |
gROOT.ForceStyle() |
363 |
> |
|
364 |
|
if __name__ == '__main__': |
365 |
< |
## default style |
365 |
> |
## default style |
366 |
|
gROOT.SetStyle("Plain") |
367 |
|
gStyle.SetOptStat(1111111) |
368 |
|
gStyle.SetPadTickX(1) |
369 |
|
gStyle.SetPadTickY(1) |
370 |
|
|
371 |
+ |
## activate these two style following way: better way |
372 |
+ |
# atlasstyle() |
373 |
+ |
# tdrstyle() |
374 |
+ |
# ildstyle() |
375 |
+ |
# yastyle() |
376 |
+ |
|
377 |
|
## activate these two style following way |
378 |
< |
## gROOT.SetStyle("ATLAS") |
378 |
> |
## gROOT.SetStyle("atlasStyle") |
379 |
|
## gROOT.SetStyle("tdrStyle") |
380 |
+ |
## gROOT.SetStyle("ildStyle") |
381 |
+ |
## gROOT.SetStyle("yaStyle") |
382 |
|
## gROOT.ForceStyle() |
383 |
|
|
384 |
|
|