rootlogon.py
Go to the documentation of this file.
1 # To set this as default, you need a .rootrc file in your home directory,
2 # containing the following line:
3 # Rint.Logon: /full/path/to/rootlogon.C
4 print "rl-on: === Welcome to the ROOT of all evils"
5 from ROOT import TStyle, gROOT, TGaxis, TColor, kRed
6 # Defaults to classic style, but that's OK, we can fix it
7 novaStyle = TStyle("novaStyle", "NOvA Style")
8 
9 # Centre title
10 novaStyle.SetTitleAlign(22)
11 novaStyle.SetTitleX(.5)
12 novaStyle.SetTitleY(.95)
13 novaStyle.SetTitleBorderSize(0)
14 
15 # No info box
16 novaStyle.SetOptStat(0)
17 
18 #set the background color to white
19 novaStyle.SetFillColor(10)
20 novaStyle.SetFrameFillColor(10)
21 novaStyle.SetCanvasColor(10)
22 novaStyle.SetPadColor(10)
23 novaStyle.SetTitleFillColor(0)
24 novaStyle.SetStatColor(10)
25 
26 # Don't put a colored frame around the plots
27 novaStyle.SetFrameBorderMode(0)
28 novaStyle.SetCanvasBorderMode(0)
29 novaStyle.SetPadBorderMode(0)
30 
31 # Set the default line color for a fit function to be red
32 novaStyle.SetFuncColor(kRed)
33 
34 # Marker settings
35 # novaStyle.SetMarkerStyle(kFullCircle)
36 
37 # No border on legends
38 novaStyle.SetLegendBorderSize(0)
39 
40 # Scientific notation on axes
41 TGaxis.SetMaxDigits(3)
42 
43 # Axis titles
44 novaStyle.SetTitleSize(.05, "xyz")
45 novaStyle.SetTitleOffset(.8, "xyz")
46 # More space for y-axis to avoid clashing with big numbers
47 novaStyle.SetTitleOffset(.9, "y")
48 # This applies the same settings to the overall plot title
49 novaStyle.SetTitleSize(.05, "")
50 novaStyle.SetTitleOffset(.8, "")
51 # Axis labels (numbering)
52 novaStyle.SetLabelSize(.04, "xyz")
53 novaStyle.SetLabelOffset(.005, "xyz")
54 
55 # Thicker lines
56 novaStyle.SetHistLineWidth(2)
57 novaStyle.SetFrameLineWidth(2)
58 novaStyle.SetFuncWidth(2)
59 
60 # Set the number of tick marks to show
61 novaStyle.SetNdivisions(506, "xyz")
62 
63 # Set the tick mark style
64 novaStyle.SetPadTickX(1)
65 novaStyle.SetPadTickY(1)
66 
67 # Fonts
68 kNovaFont = 42
69 novaStyle.SetStatFont(kNovaFont)
70 novaStyle.SetLabelFont(kNovaFont, "xyz")
71 novaStyle.SetTitleFont(kNovaFont, "xyz")
72 novaStyle.SetTitleFont(kNovaFont, "") # Apply same setting to plot titles
73 novaStyle.SetTextFont(kNovaFont)
74 # novaStyle.SetLegendFont(kNovaFont)
75 
76 # Get moodier colours for colz
77 NRGBs = 5
78 NCont = 255
79 from array import array
80 stops = array("d", [ 0.00, 0.34, 0.61, 0.84, 1.00 ])
81 red = array("d", [ 0.00, 0.00, 0.87, 1.00, 0.51 ])
82 green = array("d", [ 0.00, 0.81, 1.00, 0.20, 0.00 ])
83 blue = array("d", [ 0.51, 1.00, 0.12, 0.00, 0.00 ])
84 TColor.CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont)
85 novaStyle.SetNumberContours(NCont)
86 
87 gROOT.SetStyle("novaStyle")
88 
89 # Uncomment this line if you want to force all plots loaded from files
90 # to use this same style
91 #gROOT.ForceStyle()
92 
93 
94 ## Put a "NOvA preliminary" tag in the corner
95 #void Preliminary()
96 #{
97  #TLatex* prelim = new TLatex(.9, .95, "NO#nuA preliminary")
98  #prelim.SetTextColor(kBlue)
99  #prelim.SetNDC()
100  #prelim.SetTextSize(2/30.)
101  #prelim.SetTextAlign(32)
102  #prelim.Draw()
103 #}
104