Project

General

Profile

protoDUNEStyle.C

Tingjun Yang, 09/18/2019 01:26 PM

 
1
{
2

    
3
  // This is the protoDUNE style file
4

    
5
  TStyle* protoDUNEStyle = new  TStyle("protoDUNEStyle", "ProtoDUNE Style");
6

    
7
  // Colors
8

    
9
  //set the background color to white
10
  protoDUNEStyle->SetFillColor(10);
11
  protoDUNEStyle->SetFrameFillColor(10);
12
  protoDUNEStyle->SetCanvasColor(10);
13
  protoDUNEStyle->SetPadColor(10);
14
  protoDUNEStyle->SetTitleFillColor(10);
15
  protoDUNEStyle->SetStatColor(10);
16

    
17
  //dont put a colored frame around the plots
18
  protoDUNEStyle->SetFrameBorderMode(0);
19
  protoDUNEStyle->SetCanvasBorderMode(0);
20
  protoDUNEStyle->SetPadBorderMode(0);
21

    
22
  //use the primary color palette
23
  protoDUNEStyle->SetPalette(1,0);
24

    
25
  //set the default line color for a histogram to be black
26
  protoDUNEStyle->SetHistLineColor(kBlack);
27

    
28
  //set the default line color for a fit function to be red
29
  protoDUNEStyle->SetFuncColor(kRed);
30

    
31
  //make the axis labels black
32
  protoDUNEStyle->SetLabelColor(kBlack,"xyz");
33

    
34
  //set the default title color to be black
35
  protoDUNEStyle->SetTitleColor(kBlack);
36

    
37
  // Sizes
38

    
39
  //set the margins
40
  protoDUNEStyle->SetPadBottomMargin(0.125);
41
  protoDUNEStyle->SetPadTopMargin(0.075);
42
  protoDUNEStyle->SetPadLeftMargin(0.1);
43
  protoDUNEStyle->SetPadRightMargin(0.1);
44

    
45
  //set axis label and title text sizes
46
  protoDUNEStyle->SetLabelSize(0.045,"xy");
47
  protoDUNEStyle->SetLabelSize(0.035,"z");
48
  protoDUNEStyle->SetLabelOffset(0.005,"xy");
49
  //protoDUNEStyle->SetLabelOffset(0.005,"z");
50
  protoDUNEStyle->SetTitleSize(0.05,"xyz");
51
  protoDUNEStyle->SetTitleOffset(1,"x");
52
  protoDUNEStyle->SetTitleOffset(1,"yz");
53
  protoDUNEStyle->SetStatFontSize(0.05);
54
  protoDUNEStyle->SetTextSize(0.05);
55
  protoDUNEStyle->SetTitleBorderSize(0);
56
  protoDUNEStyle->SetStatBorderSize(0);
57

    
58
  //set line widths
59
  protoDUNEStyle->SetHistLineWidth(3);
60
  protoDUNEStyle->SetFrameLineWidth(2);
61
  protoDUNEStyle->SetFuncWidth(2);
62

    
63
  // Misc
64

    
65
  //align the titles to be centered
66
  //protoDUNEStyle->SetTitleAlign(22);
67

    
68
  //set the number of divisions to show
69
  protoDUNEStyle->SetNdivisions(506, "xy");
70

    
71
  //turn off xy grids
72
  protoDUNEStyle->SetPadGridX(0);
73
  protoDUNEStyle->SetPadGridY(0);
74

    
75
  //set the tick mark style
76
  protoDUNEStyle->SetPadTickX(1);
77
  protoDUNEStyle->SetPadTickY(1);
78

    
79
  //show the fit parameters in a box
80
  protoDUNEStyle->SetOptFit(1111);
81

    
82
  //turn off all other stats
83
  protoDUNEStyle->SetOptStat(0000000);
84

    
85
  //marker settings
86
  protoDUNEStyle->SetMarkerStyle(20);
87
  protoDUNEStyle->SetMarkerSize(0.9);
88

    
89
  // Fonts
90
  const int kProtoDUNEFont = 42;
91

    
92
  protoDUNEStyle->SetStatFont(kProtoDUNEFont);
93
  protoDUNEStyle->SetLabelFont(kProtoDUNEFont,"xyz");
94
  protoDUNEStyle->SetTitleFont(kProtoDUNEFont,"xyz");
95
  protoDUNEStyle->SetTitleFont(kProtoDUNEFont,"");
96
  protoDUNEStyle->SetTextFont(kProtoDUNEFont);
97

    
98
  // ---------------------------------------------------------
99
  // Additions from George 26/06/2019
100
  protoDUNEStyle->SetCanvasBorderSize(0);
101
  protoDUNEStyle->SetFrameBorderSize(0);
102
  protoDUNEStyle->SetDrawBorder(0);
103
  protoDUNEStyle->SetTitleBorderSize(0);
104

    
105
  // Set the size (in pixels) of the small lines drawn at the end of the error bars
106
  protoDUNEStyle->SetEndErrorSize(4);
107

    
108
  // Set option to strip decimals when drawing axis labels.
109
  protoDUNEStyle->SetStripDecimals(kFALSE);
110

    
111
  protoDUNEStyle->SetLegendBorderSize(0);
112
  protoDUNEStyle->SetLegendFont(kProtoDUNEFont);
113

    
114
  protoDUNEStyle->SetLabelOffset(0.015, "x");
115
  protoDUNEStyle->SetLabelOffset(0.015, "y");
116
  protoDUNEStyle->SetLabelOffset(0.01, "z");
117

    
118
  protoDUNEStyle->SetTitleStyle(0);
119
  protoDUNEStyle->SetTitleFont(kProtoDUNEFont, "pad");
120
  protoDUNEStyle->SetTitleX(0.1f);
121
  protoDUNEStyle->SetTitleY(.98f);
122
  protoDUNEStyle->SetTitleW(0.8f);
123
  protoDUNEStyle->SetLineStyleString(2, "[12 12]"); // postscript dashes
124

    
125
  // get rid of X error bars and y error bar caps
126
  protoDUNEStyle->SetErrorX(0.001);
127

    
128
  protoDUNEStyle->SetNumberContours(255);
129
  protoDUNEStyle->SetPalette(kBird);
130

    
131

    
132
  // ---------------------------------------------------------
133
  //done
134
  protoDUNEStyle->cd();
135

    
136
  gROOT->ForceStyle();
137
  gStyle->ls();
138

    
139
/*
140
  if (gROOT->GetVersionInt()>51200) {
141
    TColor::InitializeColors();
142
    const Int_t NRGBs = 5;
143
    const Int_t NCont = 255;
144
    Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
145
    Double_t red[NRGBs]   = { 0.00, 0.00, 0.87, 1.00, 0.51 };
146
    Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
147
    Double_t blue[NRGBs]  = { 0.51, 1.00, 0.12, 0.00, 0.00 };
148
    TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
149
    gStyle->SetNumberContours(NCont);
150
  }
151
*/
152

    
153

    
154
  // Avoid too many decimal places in the axis labels
155
  TGaxis::SetMaxDigits(4);
156

    
157
}