ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/FGolf/ss/Tools/tdrStyle.C
Revision: 1.1
Committed: Thu Sep 2 01:18:56 2010 UTC (14 years, 8 months ago) by fgolf
Content type: text/plain
Branch: MAIN
Log Message:
tools useful for SS analysis

File Contents

# User Rev Content
1 fgolf 1.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(1);
48     // tdrStyle->SetHistFillStyle(0);
49     tdrStyle->SetHistLineColor(1);
50     tdrStyle->SetHistLineStyle(0);
51     tdrStyle->SetHistLineWidth(1);
52     // tdrStyle->SetLegoInnerR(Float_t rad = 0.5);
53     // tdrStyle->SetNumberContours(Int_t number = 20);
54    
55     tdrStyle->SetEndErrorSize(2);
56     // remarked out DLE
57     //tdrStyle->SetErrorMarker(20);
58     tdrStyle->SetErrorX(0.);
59    
60    
61     tdrStyle->SetMarkerStyle(20);
62    
63     //For the fit/function:
64     tdrStyle->SetOptFit(1);
65     tdrStyle->SetFitFormat("5.4g");
66     tdrStyle->SetFuncColor(2);
67     tdrStyle->SetFuncStyle(1);
68     tdrStyle->SetFuncWidth(1);
69    
70     //For the date:
71     tdrStyle->SetOptDate(0);
72     // tdrStyle->SetDateX(Float_t x = 0.01);
73     // tdrStyle->SetDateY(Float_t y = 0.01);
74    
75     // For the statistics box:
76     tdrStyle->SetOptFile(0);
77     tdrStyle->SetOptStat(0); // To display the mean and RMS: SetOptStat("mr");
78     tdrStyle->SetStatColor(kWhite);
79     tdrStyle->SetStatFont(42);
80     tdrStyle->SetStatFontSize(0.025);
81     tdrStyle->SetStatTextColor(1);
82     tdrStyle->SetStatFormat("6.4g");
83     tdrStyle->SetStatBorderSize(1);
84     tdrStyle->SetStatH(0.1);
85     tdrStyle->SetStatW(0.15);
86     // tdrStyle->SetStatStyle(Style_t style = 1001);
87     // tdrStyle->SetStatX(Float_t x = 0);
88     // tdrStyle->SetStatY(Float_t y = 0);
89    
90     // Margins:
91     tdrStyle->SetPadTopMargin(0.05);
92     tdrStyle->SetPadBottomMargin(0.13);
93     tdrStyle->SetPadLeftMargin(0.16);
94     tdrStyle->SetPadRightMargin(0.035);
95    
96     // For the Global title:
97    
98     tdrStyle->SetOptTitle(0);
99     tdrStyle->SetTitleFont(42);
100     tdrStyle->SetTitleColor(1);
101     tdrStyle->SetTitleTextColor(1);
102     tdrStyle->SetTitleFillColor(10);
103     tdrStyle->SetTitleFontSize(0.05);
104     // tdrStyle->SetTitleH(0); // Set the height of the title box
105     // tdrStyle->SetTitleW(0); // Set the width of the title box
106     // tdrStyle->SetTitleX(0); // Set the position of the title box
107     // tdrStyle->SetTitleY(0.985); // Set the position of the title box
108     // tdrStyle->SetTitleStyle(Style_t style = 1001);
109     // tdrStyle->SetTitleBorderSize(2);
110    
111     // For the axis titles:
112    
113     tdrStyle->SetTitleColor(1, "XYZ");
114     tdrStyle->SetTitleFont(42, "XYZ");
115     tdrStyle->SetTitleSize(0.06, "XYZ");
116     // tdrStyle->SetTitleXSize(Float_t size = 0.02); // Another way to set the size?
117     // tdrStyle->SetTitleYSize(Float_t size = 0.02);
118     tdrStyle->SetTitleXOffset(0.9);
119     tdrStyle->SetTitleYOffset(1.25);
120     // tdrStyle->SetTitleOffset(1.1, "Y"); // Another way to set the Offset
121    
122     // For the axis labels:
123    
124     tdrStyle->SetLabelColor(1, "XYZ");
125     tdrStyle->SetLabelFont(42, "XYZ");
126     tdrStyle->SetLabelOffset(0.007, "XYZ");
127     tdrStyle->SetLabelSize(0.05, "XYZ");
128    
129     // For the axis:
130    
131     tdrStyle->SetAxisColor(1, "XYZ");
132     tdrStyle->SetStripDecimals(kTRUE);
133     tdrStyle->SetTickLength(0.03, "XYZ");
134     tdrStyle->SetNdivisions(505, "XYZ");
135     // tdrStyle->SetNdivisions(510, "XYZ");
136     tdrStyle->SetPadTickX(1); // To get tick marks on the opposite side of the frame
137     tdrStyle->SetPadTickY(1);
138    
139     // Change for log plots:
140     tdrStyle->SetOptLogx(0);
141     tdrStyle->SetOptLogy(0);
142     tdrStyle->SetOptLogz(0);
143    
144     // Postscript options:
145     tdrStyle->SetPaperSize(20.,20.);
146     // tdrStyle->SetLineScalePS(Float_t scale = 3);
147     // tdrStyle->SetLineStyleString(Int_t i, const char* text);
148     // tdrStyle->SetHeaderPS(const char* header);
149     // tdrStyle->SetTitlePS(const char* pstitle);
150    
151     // tdrStyle->SetBarOffset(Float_t baroff = 0.5);
152     // tdrStyle->SetBarWidth(Float_t barwidth = 0.5);
153     // tdrStyle->SetPaintTextFormat(const char* format = "g");
154     // tdrStyle->SetPalette(Int_t ncolors = 0, Int_t* colors = 0);
155     // tdrStyle->SetTimeOffset(Double_t toffset);
156     // tdrStyle->SetHistMinimumZero(kTRUE);
157    
158     tdrStyle->cd();
159    
160     }
161