ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/FGolf/Tools/tdrStyle.cc
Revision: 1.1
Committed: Sat Mar 17 19:42:24 2012 UTC (13 years, 1 month ago) by fgolf
Content type: text/plain
Branch: MAIN
Log Message:
replace C with cc

File Contents

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