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