ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/FGolf/Tools/tdrStyle.cc
Revision: 1.2
Committed: Sat Jul 14 22:50:05 2012 UTC (12 years, 9 months ago) by fgolf
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +18 -6 lines
Log Message:
update color palette

File Contents

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