ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LEP3/rootlogonTDR.py
Revision: 1.1
Committed: Fri Jun 8 09:14:06 2012 UTC (12 years, 10 months ago) by mzanetti
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
Log Message:
*** empty log message ***

File Contents

# Content
1 import sys, os, math, argparse
2 from ROOT import gROOT, gStyle, TStyle, TColor
3 from array import array
4 tdrStyle = TStyle("tdrStyle","Style for P-TDR")
5
6 kWhite = 0
7
8 tdrStyle.SetCanvasBorderMode(0)
9 tdrStyle.SetCanvasColor(kWhite)
10 tdrStyle.SetCanvasDefH(600)
11 tdrStyle.SetCanvasDefW(600)
12 tdrStyle.SetCanvasDefX(0)
13 tdrStyle.SetCanvasDefY(0)
14
15 tdrStyle.SetPadBorderMode(0)
16 tdrStyle.SetPadColor(kWhite)
17 tdrStyle.SetPadGridX(False)
18 tdrStyle.SetPadGridY(False)
19 tdrStyle.SetGridColor(0)
20 tdrStyle.SetGridStyle(3)
21 tdrStyle.SetGridWidth(1)
22
23 tdrStyle.SetFrameBorderMode(0)
24 tdrStyle.SetFrameBorderSize(1)
25 tdrStyle.SetFrameFillColor(0)
26 tdrStyle.SetFrameFillStyle(0)
27 tdrStyle.SetFrameLineColor(1)
28 tdrStyle.SetFrameLineStyle(1)
29 tdrStyle.SetFrameLineWidth(1)
30
31 tdrStyle.SetHistFillColor(63)
32 tdrStyle.SetHistLineColor(1)
33 tdrStyle.SetHistLineStyle(0)
34 tdrStyle.SetHistLineWidth(1)
35
36
37 tdrStyle.SetErrorX(0.)
38
39 tdrStyle.SetMarkerStyle(20)
40
41 tdrStyle.SetOptFit(1)
42 tdrStyle.SetFitFormat("5.4g")
43 tdrStyle.SetFuncColor(2)
44 tdrStyle.SetFuncStyle(1)
45 tdrStyle.SetFuncWidth(1)
46
47 tdrStyle.SetOptDate(0)
48
49 tdrStyle.SetOptFile(0)
50 #tdrStyle.SetOptStat(0111)
51 tdrStyle.SetOptStat(0)
52 tdrStyle.SetStatColor(kWhite)
53 tdrStyle.SetStatFont(42)
54 tdrStyle.SetStatFontSize(0.025)
55 tdrStyle.SetStatTextColor(1)
56 tdrStyle.SetStatFormat("6.4g")
57 tdrStyle.SetStatBorderSize(1)
58 tdrStyle.SetStatH(0.1)
59 tdrStyle.SetStatW(0.15)
60
61 tdrStyle.SetPadTopMargin(0.05)
62 tdrStyle.SetPadBottomMargin(0.13)
63 tdrStyle.SetPadLeftMargin(0.13)
64 tdrStyle.SetPadRightMargin(0.05)
65
66
67 tdrStyle.SetTitleFont(42)
68 tdrStyle.SetTitleColor(1)
69 tdrStyle.SetTitleTextColor(1)
70 tdrStyle.SetTitleFillColor(10)
71 tdrStyle.SetTitleFontSize(0.05)
72
73 tdrStyle.SetTitleColor(1, "XYZ")
74 tdrStyle.SetTitleFont(42, "XYZ")
75 tdrStyle.SetTitleSize(0.06, "XYZ")
76 tdrStyle.SetTitleXOffset(0.9)
77 tdrStyle.SetTitleYOffset(1.05)
78
79 tdrStyle.SetLabelColor(1, "XYZ")
80 tdrStyle.SetLabelFont(42, "XYZ")
81 tdrStyle.SetLabelOffset(0.007, "XYZ")
82 tdrStyle.SetLabelSize(0.05, "XYZ")
83
84 tdrStyle.SetAxisColor(1, "XYZ")
85 tdrStyle.SetStripDecimals(1)
86 tdrStyle.SetTickLength(0.03, "XYZ")
87 tdrStyle.SetNdivisions(510, "XYZ")
88 tdrStyle.SetPadTickX(1)
89 tdrStyle.SetPadTickY(1)
90
91 tdrStyle.SetOptLogx(0)
92 tdrStyle.SetOptLogy(0)
93 tdrStyle.SetOptLogz(0)
94 tdrStyle.cd()
95
96 palette=''
97 def set_palette(name=palette, ncontours=999):
98 """Set a color palette from a given RGB list
99 stops, red, green and blue should all be lists of the same length
100 see set_decent_colors for an example"""
101
102 if name == "gray" or name == "grayscale":
103 stops = [0.00, 0.34, 0.61, 0.84, 1.00]
104 red = [1.00, 0.84, 0.61, 0.34, 0.00]
105 green = [1.00, 0.84, 0.61, 0.34, 0.00]
106 blue = [1.00, 0.84, 0.61, 0.34, 0.00]
107 # elif name == "whatever":
108 # (define more palettes)
109 else:
110 # default palette, looks cool
111 stops = [0.00, 0.34, 0.61, 0.84, 1.00]
112 red = [0.00, 0.00, 0.87, 1.00, 0.51]
113 green = [0.00, 0.81, 1.00, 0.20, 0.00]
114 blue = [0.51, 1.00, 0.12, 0.00, 0.00]
115
116 s = array('d', stops)
117 r = array('d', red)
118 g = array('d', green)
119 b = array('d', blue)
120
121 npoints = len(s)
122 TColor.CreateGradientColorTable(npoints, s, r, g, b, ncontours)
123 gStyle.SetNumberContours(ncontours)
124
125