ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/FGolf/Tools/tdrStyle.C
Revision: 1.3
Committed: Sun May 22 21:53:30 2011 UTC (13 years, 11 months ago) by fgolf
Content type: text/plain
Branch: MAIN
CVS Tags: synchMay2011v1, ss20May2011
Changes since 1.2: +1 -0 lines
Log Message:
include TPad.h to get this to compile

File Contents

# User Rev Content
1 fgolf 1.1 #include "TStyle.h"
2 fgolf 1.3 #include "TPad.h"
3 fgolf 1.1
4 fgolf 1.2 TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");
5    
6 fgolf 1.1 // tdrGrid: Turns the grid lines on (true) or off (false)
7    
8 fgolf 1.2 void tdrGrid (bool gridOn) {
9 fgolf 1.1 tdrStyle->SetPadGridX(gridOn);
10     tdrStyle->SetPadGridY(gridOn);
11     }
12    
13     // fixOverlay: Redraws the axis
14    
15     void fixOverlay() {
16     gPad->RedrawAxis();
17     }
18    
19     void setTDRStyle() {
20    
21     // For the canvas:
22     tdrStyle->SetCanvasBorderMode(0);
23     tdrStyle->SetCanvasColor(kWhite);
24     tdrStyle->SetCanvasDefH(600); //Height of canvas
25     tdrStyle->SetCanvasDefW(600); //Width of canvas
26     tdrStyle->SetCanvasDefX(0); //POsition on screen
27     tdrStyle->SetCanvasDefY(0);
28    
29     // For the Pad:
30     tdrStyle->SetPadBorderMode(0);
31     // tdrStyle->SetPadBorderSize(Width_t size = 1);
32     tdrStyle->SetPadColor(kWhite);
33     tdrStyle->SetPadGridX(false);
34     tdrStyle->SetPadGridY(false);
35     tdrStyle->SetGridColor(0);
36     tdrStyle->SetGridStyle(3);
37     tdrStyle->SetGridWidth(1);
38    
39     // For the frame:
40     tdrStyle->SetFrameBorderMode(0);
41     tdrStyle->SetFrameBorderSize(1);
42     tdrStyle->SetFrameFillColor(0);
43     tdrStyle->SetFrameFillStyle(0);
44     tdrStyle->SetFrameLineColor(1);
45     tdrStyle->SetFrameLineStyle(1);
46     tdrStyle->SetFrameLineWidth(1);
47    
48     // For the histo:
49     // tdrStyle->SetHistFillColor(1);
50     // tdrStyle->SetHistFillStyle(0);
51     tdrStyle->SetHistLineColor(1);
52     tdrStyle->SetHistLineStyle(0);
53     tdrStyle->SetHistLineWidth(1);
54     // tdrStyle->SetLegoInnerR(Float_t rad = 0.5);
55     // tdrStyle->SetNumberContours(Int_t number = 20);
56    
57     tdrStyle->SetEndErrorSize(2);
58     // remarked out DLE
59     //tdrStyle->SetErrorMarker(20);
60     tdrStyle->SetErrorX(0.);
61    
62    
63     tdrStyle->SetMarkerStyle(20);
64    
65     //For the fit/function:
66     tdrStyle->SetOptFit(1);
67     tdrStyle->SetFitFormat("5.4g");
68     tdrStyle->SetFuncColor(2);
69     tdrStyle->SetFuncStyle(1);
70     tdrStyle->SetFuncWidth(1);
71    
72     //For the date:
73     tdrStyle->SetOptDate(0);
74     // tdrStyle->SetDateX(Float_t x = 0.01);
75     // tdrStyle->SetDateY(Float_t y = 0.01);
76    
77     // For the statistics box:
78     tdrStyle->SetOptFile(0);
79     tdrStyle->SetOptStat(0); // To display the mean and RMS: SetOptStat("mr");
80     tdrStyle->SetStatColor(kWhite);
81     tdrStyle->SetStatFont(42);
82     tdrStyle->SetStatFontSize(0.025);
83     tdrStyle->SetStatTextColor(1);
84     tdrStyle->SetStatFormat("6.4g");
85     tdrStyle->SetStatBorderSize(1);
86     tdrStyle->SetStatH(0.1);
87     tdrStyle->SetStatW(0.15);
88     // tdrStyle->SetStatStyle(Style_t style = 1001);
89     // tdrStyle->SetStatX(Float_t x = 0);
90     // tdrStyle->SetStatY(Float_t y = 0);
91    
92     // Margins:
93     tdrStyle->SetPadTopMargin(0.05);
94     tdrStyle->SetPadBottomMargin(0.13);
95     tdrStyle->SetPadLeftMargin(0.16);
96     tdrStyle->SetPadRightMargin(0.035);
97    
98     // For the Global title:
99    
100     tdrStyle->SetOptTitle(0);
101     tdrStyle->SetTitleFont(42);
102     tdrStyle->SetTitleColor(1);
103     tdrStyle->SetTitleTextColor(1);
104     tdrStyle->SetTitleFillColor(10);
105     tdrStyle->SetTitleFontSize(0.05);
106     // tdrStyle->SetTitleH(0); // Set the height of the title box
107     // tdrStyle->SetTitleW(0); // Set the width of the title box
108     // tdrStyle->SetTitleX(0); // Set the position of the title box
109     // tdrStyle->SetTitleY(0.985); // Set the position of the title box
110     // tdrStyle->SetTitleStyle(Style_t style = 1001);
111     // tdrStyle->SetTitleBorderSize(2);
112    
113     // For the axis titles:
114    
115     tdrStyle->SetTitleColor(1, "XYZ");
116     tdrStyle->SetTitleFont(42, "XYZ");
117     tdrStyle->SetTitleSize(0.06, "XYZ");
118     // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
119     // tdrStyle->SetTitleYSize(Float_t size = 0.02);
120     tdrStyle->SetTitleXOffset(0.9);
121     tdrStyle->SetTitleYOffset(1.25);
122     // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset
123    
124     // For the axis labels:
125    
126     tdrStyle->SetLabelColor(1, "XYZ");
127     tdrStyle->SetLabelFont(42, "XYZ");
128     tdrStyle->SetLabelOffset(0.007, "XYZ");
129     tdrStyle->SetLabelSize(0.05, "XYZ");
130    
131     // For the axis:
132    
133     tdrStyle->SetAxisColor(1, "XYZ");
134     tdrStyle->SetStripDecimals(kTRUE);
135     tdrStyle->SetTickLength(0.03, "XYZ");
136     tdrStyle->SetNdivisions(505, "XYZ");
137     // tdrStyle->SetNdivisions(510, "XYZ");
138     tdrStyle->SetPadTickX(1); // To get tick marks on the opposite side of the frame
139     tdrStyle->SetPadTickY(1);
140    
141     // Change for log plots:
142     tdrStyle->SetOptLogx(0);
143     tdrStyle->SetOptLogy(0);
144     tdrStyle->SetOptLogz(0);
145    
146     // Postscript options:
147     tdrStyle->SetPaperSize(20.,20.);
148     // tdrStyle->SetLineScalePS(Float_t scale = 3);
149     // tdrStyle->SetLineStyleString(Int_t i, const char* text);
150     // tdrStyle->SetHeaderPS(const char* header);
151     // tdrStyle->SetTitlePS(const char* pstitle);
152    
153     // tdrStyle->SetBarOffset(Float_t baroff = 0.5);
154     // tdrStyle->SetBarWidth(Float_t barwidth = 0.5);
155     // tdrStyle->SetPaintTextFormat(const char* format = "g");
156     // tdrStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
157     // tdrStyle->SetTimeOffset(Double_t toffset);
158     // tdrStyle->SetHistMinimumZero(kTRUE);
159    
160     tdrStyle->cd();
161    
162     }
163