GENIEGenerator
Loading...
Searching...
No Matches
Style.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Costas Andreopoulos <c.andreopoulos \at cern.ch>
7 University of Liverpool
8*/
9//____________________________________________________________________________
10
11#include <TROOT.h>
12#include <TStyle.h>
13#include <TColor.h>
14#include <TGraph.h>
15#include <TH1.h>
16
18
19//___________________________________________________________________________
21{
22 gROOT->SetStyle("Plain");
23
24 gStyle -> SetPadTickX (1);
25 gStyle -> SetPadTickY (1);
26
27 //
28 // Turn off all borders
29 //
30 gStyle -> SetCanvasBorderMode (0);
31 gStyle -> SetFrameBorderMode (0);
32 gStyle -> SetPadBorderMode (0);
33 gStyle -> SetDrawBorder (0);
34 gStyle -> SetCanvasBorderSize (0);
35 gStyle -> SetFrameBorderSize (0);
36 gStyle -> SetPadBorderSize (0);
37 gStyle -> SetTitleBorderSize (0);
38
39 //
40 // Set the size of the default canvas
41 //
42 gStyle -> SetCanvasDefH (600);
43 gStyle -> SetCanvasDefW (730);
44 gStyle -> SetCanvasDefX (10);
45 gStyle -> SetCanvasDefY (10);
46
47 //
48 // Set marker style
49 //
50 gStyle -> SetMarkerStyle (20);
51 gStyle -> SetMarkerSize (1);
52
53 //
54 // Set line widths
55 //
56 gStyle -> SetFrameLineWidth (1);
57 gStyle -> SetFuncWidth (2);
58 gStyle -> SetHistLineWidth (3);
59 gStyle -> SetFuncColor (2);
60 gStyle -> SetFuncWidth (3);
61
62 //
63 // Set margins
64 //
65 gStyle -> SetPadTopMargin (0.10);
66 gStyle -> SetPadBottomMargin (0.20);
67 gStyle -> SetPadLeftMargin (0.15);
68 gStyle -> SetPadRightMargin (0.03);
69
70 //
71 // Set tick marks and turn off grids
72 //
73 gStyle -> SetNdivisions (505,"xyz");
74
75 //
76 // Adjust size and placement of axis labels
77 //
78 gStyle -> SetLabelSize (0.050, "xyz");
79 gStyle -> SetLabelOffset (0.005, "x" );
80 gStyle -> SetLabelOffset (0.005, "y" );
81 gStyle -> SetLabelOffset (0.005, "z" );
82 gStyle -> SetTitleSize (0.060, "xyz");
83 gStyle -> SetTitleOffset (1.200, "xz" );
84 gStyle -> SetTitleOffset (1.000, "y" );
85
86 // Set Data/Stat/... and other options
87 //
88 gStyle -> SetOptDate (0);
89 gStyle -> SetOptFile (0);
90 gStyle -> SetOptStat (0);
91 gStyle -> SetStatFormat ("6.2f");
92 gStyle -> SetFitFormat ("8.4f");
93 gStyle -> SetOptFit (1);
94 gStyle -> SetStatH (0.20);
95 gStyle -> SetStatStyle (0);
96 gStyle -> SetStatW (0.30);
97 gStyle -> SetStatX (0.845);
98 gStyle -> SetStatY (0.845);
99 gStyle -> SetOptTitle (0);
100 gStyle -> SetTitleX (0.15);
101 gStyle -> SetTitleW (0.75);
102 gStyle -> SetTitleY (0.90);
103 gStyle -> SetPalette (1);
104 gStyle -> SetLegendBorderSize (0);
105
106 //
107 // Set paper size for life in the US or EU
108 //
109 gStyle -> SetPaperSize (TStyle::kA4); //<-- tartes aux fraises
110//gStyle -> SetPaperSize (TStyle::kUSLetter); //<-- donuts
111
112 //
113 // In B&W (papers)
114 //
115 if(black_n_white){
116 const int ncol = 7;
117
118 double red [ncol];
119 double green [ncol];
120 double blue [ncol];
121 double stops [ncol];
122
123 double dcol = -1/double(ncol);
124 double gray = 1;
125 for (int j = 0; j < ncol; j++) {
126 // Define color with RGB equal to : gray, gray, gray
127 stops[j] = double(j)/double(ncol-1);
128 red [j] = gray;
129 blue [j] = gray;
130 green[j] = gray;
131
132 gray += dcol;
133 }
134 UInt_t totcol=50;
135 TColor::CreateGradientColorTable(ncol,stops,red,green,blue,totcol);
136
137 gStyle -> SetFuncWidth (1);
138 gStyle -> SetHistLineWidth (1);
139 gStyle -> SetFuncColor (1);
140 gStyle -> SetFuncWidth (1);
141 }//bw
142
143 gROOT->ForceStyle();
144}
145//___________________________________________________________________________
147 TGraph* gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
148{
149 if(!gr) return;
150
151 if (lcol >= 0) gr -> SetLineColor (lcol);
152 if (lsty >= 0) gr -> SetLineStyle (lsty);
153 if (lwid >= 0) gr -> SetLineWidth (lwid);
154
155 if (mcol >= 0) gr -> SetMarkerColor (mcol);
156 if (msty >= 0) gr -> SetMarkerStyle (msty);
157 if (msiz >= 0) gr -> SetMarkerSize (msiz);
158}
159//___________________________________________________________________________
161 TH1* hst, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
162{
163 if(!hst) return;
164
165 if (lcol >= 0) hst -> SetLineColor (lcol);
166 if (lsty >= 0) hst -> SetLineStyle (lsty);
167 if (lwid >= 0) hst -> SetLineWidth (lwid);
168
169 if (mcol >= 0) hst -> SetMarkerColor (mcol);
170 if (msty >= 0) hst -> SetMarkerStyle (msty);
171 if (msiz >= 0) hst -> SetMarkerSize (msiz);
172}
173//___________________________________________________________________________
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition Style.cxx:146
void SetDefaultStyle(bool black_n_white=false)
Definition Style.cxx:20