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