ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/AnalysisFramework/Plotting/Modules/setTDRStyle.C
Revision: 1.6
Committed: Mon Aug 15 07:41:50 2011 UTC (13 years, 8 months ago) by buchmann
Content type: text/plain
Branch: MAIN
CVS Tags: cbaf_4_98ifb_paper, beforeFR20120418, cbaf_4p7ifb, Honeypot, cbaf_2p1ifb, HEAD
Changes since 1.5: +5 -3 lines
Log Message:
Added option to use the more 'delicate' style with thinner lines (default remains the new style though)

File Contents

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