forked from awhitbeck/LDMX_TS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
tdrstyle.C
197 lines (158 loc) · 5.18 KB
/
tdrstyle.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
//
// TDR style macro for plots in ROOT
// .L tdrstyle.C
// setTDRStyle()
//
#include "TStyle.h"
#include <TLatex.h>
TStyle *tdrStyle = new TStyle("tdrStyle","Style for P-TDR");
// tdrGrid: Turns the grid lines on (true) or off (false)
//void tdrGrid(bool gridOn) {
// tdrStyle->SetPadGridX(gridOn);
// tdrStyle->SetPadGridY(gridOn);
//}
// fixOverlay: Redraws the axis
void fixOverlay() {
gPad->RedrawAxis();
}
void setTDRStyle() {
// For the canvas:
gStyle->SetCanvasBorderMode(0);
gStyle->SetCanvasColor(kWhite);
gStyle->SetCanvasDefH(600); //Height of canvas
gStyle->SetCanvasDefW(600); //Width of canvas
gStyle->SetCanvasDefX(0); //POsition on screen
gStyle->SetCanvasDefY(0);
// For the Pad:
gStyle->SetPadBorderMode(0);
// gStyle->SetPadBorderSize(Width_t size = 1);
gStyle->SetPadColor(kWhite);
gStyle->SetPadGridX(false);
gStyle->SetPadGridY(false);
gStyle->SetGridColor(0);
gStyle->SetGridStyle(3);
gStyle->SetGridWidth(1);
// For the frame:
gStyle->SetFrameBorderMode(0);
gStyle->SetFrameBorderSize(2);
gStyle->SetFrameFillColor(0);
gStyle->SetFrameFillStyle(0);
gStyle->SetFrameLineColor(1);
gStyle->SetFrameLineStyle(1);
gStyle->SetFrameLineWidth(1);
// For the histo:
// gStyle->SetHistFillColor(1);
// gStyle->SetHistFillStyle(0);
gStyle->SetHistLineColor(1);
gStyle->SetHistLineStyle(0);
gStyle->SetHistLineWidth(1);
// gStyle->SetLegoInnerR(Float_t rad = 0.5);
// gStyle->SetNumberContours(Int_t number = 20);
gStyle->SetEndErrorSize(2);
//gStyle->SetErrorMarker(20);
gStyle->SetErrorX(0.);
gStyle->SetMarkerStyle(7);
//For the fit/function:
gStyle->SetOptFit(0);
gStyle->SetFitFormat("5.4g");
gStyle->SetFuncColor(2);
gStyle->SetFuncStyle(1);
gStyle->SetFuncWidth(1);
//For the date:
gStyle->SetOptDate(0);
// gStyle->SetDateX(Float_t x = 0.01);
// gStyle->SetDateY(Float_t y = 0.01);
gStyle->SetOptStat(0);
/*
// For the statistics box:
gStyle->SetOptFile(0);
gStyle->SetOptStat("mr");
gStyle->SetStatColor(kWhite);
gStyle->SetStatFont(42);
gStyle->SetStatFontSize(0.04);///---> gStyle->SetStatFontSize(0.025);
gStyle->SetStatTextColor(1);
gStyle->SetStatFormat("6.4g");
gStyle->SetStatBorderSize(1);
gStyle->SetStatH(0.1);
gStyle->SetStatW(0.2);///---> gStyle->SetStatW(0.15);
*/
// gStyle->SetStatStyle(Style_t style = 1001);
// gStyle->SetStatX(Float_t x = 0);
// gStyle->SetStatY(Float_t y = 0);
// Margins:
gStyle->SetPadTopMargin(0.05);
gStyle->SetPadBottomMargin(0.13);
gStyle->SetPadLeftMargin(0.16);
gStyle->SetPadRightMargin(0.04);
// For the Global title:
gStyle->SetOptTitle(0);
gStyle->SetTitleFont(42);
gStyle->SetTitleColor(1);
gStyle->SetTitleTextColor(1);
gStyle->SetTitleFillColor(10);
gStyle->SetTitleFontSize(0.05);
// gStyle->SetTitleH(0); // Set the height of the title box
// gStyle->SetTitleW(0); // Set the width of the title box
// gStyle->SetTitleX(0); // Set the position of the title box
// gStyle->SetTitleY(0.985); // Set the position of the title box
// gStyle->SetTitleStyle(Style_t style = 1001);
// gStyle->SetTitleBorderSize(2);
// For the axis titles:
gStyle->SetTitleColor(1, "XYZ");
gStyle->SetTitleFont(42, "XYZ");
gStyle->SetTitleSize(0.06, "XYZ");
// gStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
// gStyle->SetTitleYSize(Float_t size = 0.02);
gStyle->SetTitleXOffset(0.9);
gStyle->SetTitleYOffset(1.25);
// gStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset
// For the axis labels:
gStyle->SetLabelColor(1, "XYZ");
gStyle->SetLabelFont(42, "XYZ");
gStyle->SetLabelOffset(0.007, "XYZ");
gStyle->SetLabelSize(0.05, "XYZ");
// For the axis:
gStyle->SetAxisColor(1, "XYZ");
gStyle->SetStripDecimals(kTRUE);
gStyle->SetTickLength(0.03, "XYZ");
gStyle->SetNdivisions(510, "XYZ");
gStyle->SetPadTickX(1); // To get tick marks on the opposite side of the frame
gStyle->SetPadTickY(1);
// Change for log plots:
gStyle->SetOptLogx(0);
gStyle->SetOptLogy(0);
gStyle->SetOptLogz(0);
// Postscript options:
gStyle->SetPaperSize(20.,20.);
// gStyle->SetLineScalePS(Float_t scale = 3);
// gStyle->SetLineStyleString(Int_t i, const char* text);
// gStyle->SetHeaderPS(const char* header);
// gStyle->SetTitlePS(const char* pstitle);
// gStyle->SetBarOffset(Float_t baroff = 0.5);
// gStyle->SetBarWidth(Float_t barwidth = 0.5);
// gStyle->SetPaintTextFormat(const char* format = "g");
// gStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
// gStyle->SetTimeOffset(Double_t toffset);
// gStyle->SetHistMinimumZero(kTRUE);
gStyle->SetPalette(1);
// gStyle->cd();
gROOT->ForceStyle();
}
void LDMXLabelFixSize(Double_t x,Double_t y, float tsize, char* text, double spaceFactor = 1.0 /*adjust spacing factor */, Color_t color = kBlack)
{
TLatex l; //l.SetTextAlign(12);
l.SetTextSize(tsize);
l.SetNDC();
l.SetTextFont(72);
l.SetTextColor(color);
double delx = 0.115*696*gPad->GetWh()/(472*gPad->GetWw())*spaceFactor;
l.DrawLatex(x,y,"LDMX");
if (text) {
TLatex p;
p.SetNDC();
p.SetTextFont(42);
p.SetTextSize(tsize);
p.SetTextColor(color);
p.DrawLatex(x+delx,y,text);
}
}