ATLAS Offline Software
AtlasStyleMacro.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 
3 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
4 # -*- coding: utf-8 -*-
5 
6 #from ROOT import TStyle, TLatex, TCanvas
7 from ROOT import *
8 
10  atlasStyle = TStyle("myStyle","myStyle")
11 
12  atlasStyle.SetOptStat(0)
13  atlasStyle.SetPalette(1)
14 
15  icol=0 #WHITE
16  atlasStyle.SetFrameBorderMode(icol)
17  atlasStyle.SetFrameFillColor(icol)
18  atlasStyle.SetCanvasBorderMode(icol)
19  atlasStyle.SetCanvasColor(icol)
20  atlasStyle.SetPadBorderMode(icol)
21  atlasStyle.SetPadColor(icol)
22  atlasStyle.SetStatColor(icol)
23  atlasStyle.SetTitleFillColor(icol)
24 
25  #atlasStyle.SetPaperSize(20,26)
26  #atlasStyle.SetPadTopMargin(0.02)
27  #atlasStyle.SetPadRightMargin(0.10)
28  #atlasStyle.SetPadBottomMargin(0.10)
29  #atlasStyle.SetPadLeftMargin(0.14)
30 
31  atlasStyle.SetPaperSize(20,26)
32  atlasStyle.SetPadTopMargin(0.05)
33  atlasStyle.SetPadRightMargin(0.13)
34  atlasStyle.SetPadBottomMargin(0.16)
35  atlasStyle.SetPadLeftMargin(0.15)
36 
37  #Int_t font=72
38  font=42
39  tsize=0.05
40  atlasStyle.SetTextFont(font)
41  atlasStyle.SetTextSize(tsize)
42 
43  atlasStyle.SetLabelFont(font,"x")
44  atlasStyle.SetLabelFont(font,"y")
45  atlasStyle.SetLabelFont(font,"z")
46 
47  atlasStyle.SetTitleFont(font,"x")
48  atlasStyle.SetTitleFont(font,"y")
49  atlasStyle.SetTitleFont(font,"z")
50  atlasStyle.SetTitleFont(font,"")
51 
52  atlasStyle.SetLabelSize(tsize,"x")
53  atlasStyle.SetLabelSize(tsize,"y")
54  atlasStyle.SetLabelSize(tsize,"z")
55 
56  atlasStyle.SetTitleSize(tsize,"x")
57  atlasStyle.SetTitleSize(tsize,"y")
58  atlasStyle.SetTitleSize(tsize,"z")
59 
60  atlasStyle.SetTitleSize(0.05,"")
61  atlasStyle.SetTitleFont(font,"x")
62  atlasStyle.SetTitleFont(font,"y")
63  atlasStyle.SetTitleFont(font,"z")
64  #atlasStyle.SetTitleOffset(1.20,"x")
65  #atlasStyle.SetTitleOffset(1.20,"y")
66  #atlasStyle.SetTitleOffset(1.20,"z")
67 
68  atlasStyle.SetStatFont(font)
69 
70  #atlasStyle->SetLabelOffset(0.05,"x")
71  #atlasStyle->SetLabelOffset(0.05,"y")
72  #atlasStyle->SetLabelOffset(0.05,"z")
73 
74  #tlasStyle.SetTitleY(0.99)
75  #tlasStyle.SetTitleX(0.)
76 
77  #atlasStyle->SetTitleOffset(1.5,"x")
78  #tlasStyle.SetTitleOffset(1.2,"y")
79  #tlasStyle.SetTitleOffset(1.2,"z")
80 
81  #use bold lines and markers
82  atlasStyle.SetMarkerStyle(20)
83  atlasStyle.SetMarkerSize(1.2)
84  atlasStyle.SetHistLineWidth(1)
85  atlasStyle.SetLineStyleString(2,"[12 12]") #postscript dashes
86 
87  #get rid of X error bars
88  #atlasStyle->SetErrorX(0.001)
89  #get rid of error bar caps
90  atlasStyle.SetEndErrorSize(0.)
91 
92  #do not display any of the standard histogram decorations
93  atlasStyle.SetOptTitle(0)
94  #ksiourmen
95  #atlasStyle.SetOptStat(100000)
96  #atlasStyle.SetOptStat(1)
97  #atlasStyle.SetOptFit(1111)
98  atlasStyle.SetOptFit(0)
99  # put tick marks on top and RHS of plots
100  atlasStyle.SetPadTickX(1)
101  atlasStyle.SetPadTickY(1)
102 
103  #atlasStyle.SetOptStat("rm")
104 
105  atlasStyle.cd()
106 
107 
108 def ATLASLabel(x,y,text="",color=kBlack):
109  l = TLatex()
110  l.SetNDC()
111  l.SetTextFont(72)
112  l.SetTextColor(color)
113 
114  delx = 0.115*696*gPad.GetWh()/(472*gPad.GetWw())
115 
116  l.DrawLatex(x,y,"ATLAS")
117  if text != "":
118  p = TLatex()
119  p.SetNDC()
120  p.SetTextFont(42)
121  p.SetTextColor(color)
122  p.DrawLatex(x+delx,y,text)
123 
AtlasStyleMacro.SetAtlasStyle
def SetAtlasStyle()
Definition: AtlasStyleMacro.py:9
AtlasStyleMacro.ATLASLabel
def ATLASLabel(x, y, text="", color=kBlack)
Definition: AtlasStyleMacro.py:108