ATLAS Offline Software
Loading...
Searching...
No Matches
AtlasStyle.h File Reference
#include "TStyle.h"
#include "TGraphErrors.h"
#include "TGraphAsymmErrors.h"
Include dependency graph for InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/scripts/AtlasStyle.h:

Go to the source code of this file.

Functions

void SetAtlasStyle ()
TStyle * AtlasStyle ()
void ATLAS_LABEL (Double_t x, Double_t y, Color_t color=1)
void ATLASPRELIM_LABEL (Double_t x, Double_t y, double tsize, Color_t color=1)
TGraphErrors * myTGraphErrorsDivide (TGraphErrors *g1, TGraphErrors *g2)
TGraphAsymmErrors * myTGraphErrorsDivide (TGraphAsymmErrors *g1, TGraphAsymmErrors *g2)
TGraphAsymmErrors * myMakeBand (TGraphErrors *g0, TGraphErrors *g1, TGraphErrors *g2)
void myAddtoBand (TGraphErrors *g1, TGraphAsymmErrors *g2)
TGraphErrors * TH1TOTGraph (TH1 *h1)
void myText (Double_t x, Double_t y, Color_t color, char *text)
void myBoxText (Double_t x, Double_t y, Double_t boxsize, Int_t mcolor, char *text)
void myMarkerText (Double_t x, Double_t y, Int_t color, Int_t mstyle, char *text, Float_t msize=2., Float_t tsize=0.05)
void myLineText (Double_t x, Double_t y, Int_t boxsize, Int_t mcolor, char *text, float tsize=0.05)

Function Documentation

◆ ATLAS_LABEL()

void ATLAS_LABEL ( Double_t x,
Double_t y,
Color_t color = 1 )
inline

Definition at line 29 of file AtlasUtils.h.

30{
31 TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize);
32 l.SetNDC();
33 l.SetTextFont(72);
34 l.SetTextColor(color);
35 l.DrawLatex(x,y,"ATLAS");
36}
#define y
#define x
l
Printing final latex table to .tex output file.

◆ ATLASPRELIM_LABEL()

void ATLASPRELIM_LABEL ( Double_t x,
Double_t y,
double tsize,
Color_t color = 1 )

◆ AtlasStyle()

TStyle * AtlasStyle ( )

Definition at line 34 of file AtlasStyle.cxx.

35{
36 // TStyle *atlasStyle = new TStyle("ATLAS","Atlas style");
37 TStyle *atlasStyle = gROOT->GetStyle("Plain");
38
39 // use plain black on white colors
40 Int_t icol=0; // WHITE
41 atlasStyle->SetFrameBorderMode(icol);
42 atlasStyle->SetFrameFillColor(icol);
43 atlasStyle->SetCanvasBorderMode(icol);
44 atlasStyle->SetCanvasColor(icol);
45 atlasStyle->SetPadBorderMode(icol);
46 atlasStyle->SetPadColor(icol);
47 atlasStyle->SetStatColor(icol);
48 //atlasStyle->SetFillColor(icol); // don't use: white fill color for *all* objects
49
50 // set the paper & margin sizes
51 atlasStyle->SetPaperSize(20,26);
52
53 // set margin sizes
54 atlasStyle->SetPadTopMargin(0.05);
55 atlasStyle->SetPadRightMargin(0.05);
56 atlasStyle->SetPadBottomMargin(0.16);
57 atlasStyle->SetPadLeftMargin(0.16);
58
59 // set title offsets (for axis label)
60 atlasStyle->SetTitleXOffset(1.4);
61 atlasStyle->SetTitleYOffset(1.4);
62
63 // use large fonts
64 //Int_t font=72; // Helvetica italics
65 Int_t font=42; // Helvetica
66 Double_t tsize=0.05;
67 atlasStyle->SetTextFont(font);
68
69 atlasStyle->SetTextSize(tsize);
70 atlasStyle->SetLabelFont(font,"x");
71 atlasStyle->SetTitleFont(font,"x");
72 atlasStyle->SetLabelFont(font,"y");
73 atlasStyle->SetTitleFont(font,"y");
74 atlasStyle->SetLabelFont(font,"z");
75 atlasStyle->SetTitleFont(font,"z");
76
77 atlasStyle->SetLabelSize(tsize,"x");
78 atlasStyle->SetTitleSize(tsize,"x");
79 atlasStyle->SetLabelSize(tsize,"y");
80 atlasStyle->SetTitleSize(tsize,"y");
81 atlasStyle->SetLabelSize(tsize,"z");
82 atlasStyle->SetTitleSize(tsize,"z");
83
84 // use bold lines and markers
85 atlasStyle->SetMarkerStyle(20);
86 atlasStyle->SetMarkerSize(1.2);
87 atlasStyle->SetHistLineWidth(2.);
88 atlasStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
89
90 // get rid of X error bars
91 //atlasStyle->SetErrorX(0.001);
92 // get rid of error bar caps
93 atlasStyle->SetEndErrorSize(0.);
94
95 // do not display any of the standard histogram decorations
96 atlasStyle->SetOptTitle(0);
97 //atlasStyle->SetOptStat(1111);
98 atlasStyle->SetOptStat(0);
99 //atlasStyle->SetOptFit(1111);
100 atlasStyle->SetOptFit(0);
101
102 // put tick marks on top and RHS of plots
103 atlasStyle->SetPadTickX(1);
104 atlasStyle->SetPadTickY(1);
105
106 setpalette(atlasStyle);
107
108 return atlasStyle;
109
110}
void setpalette(TStyle *style)

◆ myAddtoBand()

void myAddtoBand ( TGraphErrors * g1,
TGraphAsymmErrors * g2 )
inline

Definition at line 211 of file AtlasUtils.h.

211 {
212
213 Double_t x1=0., y1=0., y2=0., y0=0;
214 //Double_t dx1=0.;
215 //Double_t dum;
216
217 if (g1->GetN()!=g2->GetN())
218 std::cout << " graphs have not the same # of elements " << std::endl;
219
220 Double_t* EYhigh = g2-> GetEYhigh();
221 Double_t* EYlow = g2-> GetEYlow();
222
223 for (Int_t i=0; i<g1->GetN(); i++) {
224 g1->GetPoint(i, x1,y1);
225 g2->GetPoint(i, x1,y2);
226
227 if (y1==0) y1=1;
228 if (y2==0) y2=1;
229
230 // if (i==g1->GetN()-1) x2=x1;
231 // else g2->GetPoint(i+1,x2,dum);
232 // if (i==0) x3=x1;
233 // else g2->GetPoint(i-1,x3,dum);
234
235 Double_t eyh=0., eyl=0.;
236 //if (y1<y2) {y2=y1; y1=tmp;}
237 //Double_t y3=1.;
238
239 //printf("%d: y1=%f y2=%f Eyhigh= %f Eylow= %f \n",i,y1,y2,EYhigh[i],EYlow[i]);
240
241 y0=y1-y2;
242 if (y0!=0) {
243 if (y0>0){
244 eyh=EYhigh[i];
245 eyh=sqrt(eyh*eyh+y0*y0);
246 //printf("high: %d: y0=%f eyh=%f \n",i,y0,eyh);
247 g2->SetPointEYhigh(i,eyh);
248 } else {
249 eyl=EYlow[i];
250 eyl=sqrt(eyl*eyl+y0*y0);
251 // printf("low: %d: y0=%f eyl=%f \n",i,y0,eyl);
252 g2->SetPointEYlow (i,eyl);
253 }
254 }
255 }
256 return;
257
258}

◆ myBoxText()

void myBoxText ( Double_t x,
Double_t y,
Double_t boxsize,
Int_t mcolor,
char * text )
inline

Definition at line 301 of file AtlasUtils.h.

301 {
302
303 Double_t tsize=0.06;
304
305 TLatex l; l.SetTextAlign(12); //l.SetTextSize(tsize);
306 l.SetNDC();
307 l.DrawLatex(x,y,text);
308
309 Double_t y1=y-0.25*tsize;
310 Double_t y2=y+0.25*tsize;
311 Double_t x2=x-0.3*tsize;
312 Double_t x1=x2-boxsize;
313
314 printf("x1= %f x2= %f y1= %f y2= %f \n",x1,x2,y1,y2);
315
316 TPave *mbox= new TPave(x1,y1,x2,y2,0,"NDC");
317
318 mbox->SetFillColor(mcolor);
319 mbox->SetFillStyle(1001);
320 mbox->Draw();
321
322 TLine mline;
323 mline.SetLineWidth(4);
324 mline.SetLineColor(1);
325 mline.SetLineStyle(1);
326 Double_t ytmp=(y1+y2)/2.;
327 mline.DrawLineNDC(x1,ytmp,x2,y);
328
329}

◆ myLineText()

void myLineText ( Double_t x,
Double_t y,
Int_t boxsize,
Int_t mcolor,
char * text,
float tsize = 0.05 )

◆ myMakeBand()

TGraphAsymmErrors * myMakeBand ( TGraphErrors * g0,
TGraphErrors * g1,
TGraphErrors * g2 )
inline

Definition at line 169 of file AtlasUtils.h.

169 {
170 // default is g0
171 //const Int_t debug=0;
172
173 TGraphAsymmErrors* g3= new TGraphAsymmErrors();
174
175 Double_t x1=0., y1=0., x2=0., y2=0., y0=0, x3=0.;
176 //Double_t dx1=0.;
177 Double_t dum;
178 for (Int_t i=0; i<g1->GetN(); i++) {
179 g0->GetPoint(i, x1,y0);
180 g1->GetPoint(i, x1,y1);
181 g2->GetPoint(i, x1,y2);
182
183 // if (y1==0) y1=1;
184 //if (y2==0) y2=1;
185
186 if (i==g1->GetN()-1) x2=x1;
187 else g2->GetPoint(i+1,x2,dum);
188
189 if (i==0) x3=x1;
190 else g2->GetPoint(i-1,x3,dum);
191
192 Double_t tmp=y2;
193 if (y1<y2) {y2=y1; y1=tmp;}
194 //Double_t y3=1.;
195 Double_t y3=y0;
196 g3->SetPoint(i,x1,y3);
197
198 Double_t binwl=(x1-x3)/2.;
199 Double_t binwh=(x2-x1)/2.;
200 if (binwl==0.) binwl= binwh;
201 if (binwh==0.) binwh= binwl;
202 g3->SetPointError(i,binwl,binwh,(y3-y2),(y1-y3));
203
204 }
205 return g3;
206
207}

◆ myMarkerText()

void myMarkerText ( Double_t x,
Double_t y,
Int_t color,
Int_t mstyle,
char * text,
Float_t msize = 2.,
Float_t tsize = 0.05 )

◆ myText()

void myText ( Double_t x,
Double_t y,
Color_t color,
char * text )
inline

Definition at line 291 of file AtlasUtils.h.

291 {
292
293 //Double_t tsize=0.05;
294 TLatex l; //l.SetTextAlign(12); l.SetTextSize(tsize);
295 l.SetNDC();
296 l.SetTextColor(color);
297 l.DrawLatex(x,y,text);
298}

◆ myTGraphErrorsDivide() [1/2]

TGraphAsymmErrors * myTGraphErrorsDivide ( TGraphAsymmErrors * g1,
TGraphAsymmErrors * g2 )
inline

Definition at line 100 of file AtlasUtils.h.

100 {
101
102 const Int_t debug=0;
103
104 TGraphAsymmErrors* g3= new TGraphAsymmErrors();
105 Int_t n1=g1->GetN();
106 Int_t n2=g2->GetN();
107
108 if (n1!=n2) {
109 printf(" vectors do not have same number of entries ! \n");
110 return g3;
111 }
112
113 Double_t x1=0., y1=0., x2=0., y2=0.;
114 Double_t dx1h=0., dx1l=0.;
115 Double_t dy1h=0., dy1l=0.;
116 Double_t dy2h=0., dy2l=0.;
117
118 Double_t* X1 = g1->GetX();
119 Double_t* Y1 = g1->GetY();
120 Double_t* EXhigh1 = g1->GetEXhigh();
121 Double_t* EXlow1 = g1->GetEXlow();
122 Double_t* EYhigh1 = g1->GetEYhigh();
123 Double_t* EYlow1 = g1->GetEYlow();
124
125 Double_t* X2 = g2->GetX();
126 Double_t* Y2 = g2->GetY();
127 Double_t* EXhigh2 = g2->GetEXhigh();
128 Double_t* EXlow2 = g2->GetEXlow();
129 Double_t* EYhigh2 = g2->GetEYhigh();
130 Double_t* EYlow2 = g2->GetEYlow();
131
132 for (Int_t i=0; i<g1->GetN(); i++) {
133 g1->GetPoint(i,x1,y1);
134 g2->GetPoint(i,x2,y2);
135 dx1h = EXhigh1[i];
136 dx1l = EXlow1[i];
137 if (y1!=0.) dy1h = EYhigh1[i]/y1;
138 else dy1h = 0.;
139 if (y2!=0.) dy2h = EYhigh2[i]/y2;
140 else dy2h = 0.;
141 if (y1!=0.) dy1l = EYlow1 [i]/y1;
142 else dy1l = 0.;
143 if (y2!=0.) dy2l = EYlow2 [i]/y2;
144 else dy2l = 0.;
145
146 //if (debug)
147 //printf("%d x1=%f x2=%f y1=%f y2=%f \n",i,x1,x2,y1,y2);
148 if (debug)
149 printf("%d dy1=%f %f dy2=%f %f sqrt= %f %f \n",i,dy1l,dy1h,dy2l,dy2h,
150 sqrt(dy1l*dy1l+dy2l*dy2l),sqrt(dy1h*dy1h+dy2h*dy2h));
151
152 if (y2!=0.) g3->SetPoint(i, x1,y1/y2);
153 else g3->SetPoint(i, x1,y2);
154 Double_t el=0.; Double_t eh=0.;
155
156 if (y1!=0. && y2!=0.) el=sqrt(dy1l*dy1l+dy2l*dy2l)*(y1/y2);
157 if (y1!=0. && y2!=0.) eh=sqrt(dy1h*dy1h+dy2h*dy2h)*(y1/y2);
158
159 if (debug) printf("dx1h=%f dx1l=%f el=%f eh=%f \n",dx1h,dx1l,el,eh);
160 g3->SetPointError(i,dx1h,dx1l,el,eh);
161
162 }
163 return g3;
164
165}
const bool debug

◆ myTGraphErrorsDivide() [2/2]

TGraphErrors * myTGraphErrorsDivide ( TGraphErrors * g1,
TGraphErrors * g2 )
inline

Definition at line 38 of file AtlasUtils.h.

38 {
39
40 const Int_t debug=0;
41
42 if (!g1) printf("**myTGraphErrorsDivide: g1 does not exist ! \n");
43 if (!g2) printf("**myTGraphErrorsDivide: g2 does not exist ! \n");
44
45
46 Int_t n1=g1->GetN();
47 Int_t n2=g2->GetN();
48
49 if (n1!=n2) {
50 printf("**myTGraphErrorsDivide: vector do not have same number of entries ! \n");
51 }
52
53 TGraphErrors* g3= new TGraphErrors();
54
55 Double_t x1=0., y1=0., x2=0., y2=0.;
56 Double_t dx1=0.,dy1=0., dy2=0.;
57
58 Int_t iv=0;
59 for (Int_t i1=0; i1<n1; i1++) {
60 for (Int_t i2=0; i2<n2; i2++) {
61 //if (debug) printf("**myTGraphErrorsDivide: %d %d ! \n",i1,i2);
62
63 g1->GetPoint(i1,x1,y1);
64 g2->GetPoint(i2,x2,y2);
65 if (x1!=x2) {
66 //printf("**myTGraphErrorsDivide: %d x1!=x2 %f %f ! \n",iv,x1,x2);
67 }else{
68 //if (debug) printf("**myTGraphErrorsDivide: %d x1=x2 %f %f ! \n",iv,x1,x2);
69 dx1 = g1->GetErrorX(i1);
70 if (y1!=0) dy1 = g1->GetErrorY(i1)/y1;
71 if (y2!=0) dy2 = g2->GetErrorY(i2)/y2;
72
73 if (debug)
74 printf("**myTGraphErrorsDivide: %d x1=%f x2=%f y1=%f y2=%f \n",iv,x1,x2,y1,y2);
75
76 if (y2!=0.) g3->SetPoint(iv, x1,y1/y2);
77 else g3->SetPoint(iv, x1,y2);
78
79 Double_t e=0.;
80 if (y1!=0 && y2!=0) e=std::sqrt(dy1*dy1+dy2*dy2)*(y1/y2);
81 g3->SetPointError(iv,dx1,e);
82
83
84 if (debug) {
85 //Double_t g3y, g3x,g3e;
86 //g3->GetPoint(iv, g3y,g3x);
87 //g3e=g3->GetErrorY(iv);
88 //printf("%d g3y= %f g3e=%f \n",iv,g3y,g3e);
89 }
90 iv++;
91 }
92 // printf("**myTGraphErrorsDivide: ...next \n");
93 }
94 }
95 return g3;
96
97}

◆ SetAtlasStyle()

void SetAtlasStyle ( )
inline

Definition at line 17 of file InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/AtlasStyle.h.

17 {
18 TStyle *atlasStyle= new TStyle("ATLAS","Atlas style");
19
20 // use plain black on white colors
21 Int_t icol=0;
22 atlasStyle->SetFrameBorderMode(icol);
23 atlasStyle->SetFrameFillColor(icol);
24 atlasStyle->SetCanvasBorderMode(icol);
25 atlasStyle->SetPadBorderMode(icol);
26 atlasStyle->SetPadColor(icol);
27 atlasStyle->SetCanvasColor(icol);
28 atlasStyle->SetStatColor(icol);
29 //atlasStyle->SetFillColor(icol);
30
31 // set the paper & margin sizes
32 atlasStyle->SetPaperSize(20,26);
33 atlasStyle->SetPadTopMargin(0.05);
34 atlasStyle->SetPadRightMargin(0.05);
35 atlasStyle->SetPadBottomMargin(0.16);
36 atlasStyle->SetPadLeftMargin(0.12);
37
38 // use large fonts
39 //Int_t font=72;
40 Int_t font=42;
41 Double_t tsize=0.05;
42 atlasStyle->SetTextFont(font);
43
44
45 atlasStyle->SetTextSize(tsize);
46 atlasStyle->SetLabelFont(font,"x");
47 atlasStyle->SetTitleFont(font,"x");
48 atlasStyle->SetLabelFont(font,"y");
49 atlasStyle->SetTitleFont(font,"y");
50 atlasStyle->SetLabelFont(font,"z");
51 atlasStyle->SetTitleFont(font,"z");
52
53 atlasStyle->SetLabelSize(tsize,"x");
54 atlasStyle->SetTitleSize(tsize,"x");
55 atlasStyle->SetLabelSize(tsize,"y");
56 atlasStyle->SetTitleSize(tsize,"y");
57 atlasStyle->SetLabelSize(tsize,"z");
58 atlasStyle->SetTitleSize(tsize,"z");
59
60
61 //use bold lines and markers
62 atlasStyle->SetMarkerStyle(20);
63 atlasStyle->SetMarkerSize(1.2);
64 atlasStyle->SetHistLineWidth(2);
65 atlasStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
66
67 //get rid of X error bars and y error bar caps
68 //atlasStyle->SetErrorX(0.001);
69
70 //do not display any of the standard histogram decorations
71 atlasStyle->SetOptTitle(0);
72 //atlasStyle->SetOptStat(1111);
73 atlasStyle->SetOptStat(0);
74 //atlasStyle->SetOptFit(1111);
75 atlasStyle->SetOptFit(0);
76
77 // put tick marks on top and RHS of plots
78 atlasStyle->SetPadTickX(1);
79 atlasStyle->SetPadTickY(1);
80
81 gROOT->SetStyle("ATLAS");
82
83}

◆ TH1TOTGraph()

TGraphErrors * TH1TOTGraph ( TH1 * h1)
inline

Definition at line 262 of file AtlasUtils.h.

262 {
263
264
265 if (!h1) std::cout << "TH1TOTGraph: histogram not found !" << std::endl;
266
267 TGraphErrors* g1= new TGraphErrors();
268
269 Double_t x, y, ex, ey;
270 for (Int_t i=0; i<h1->GetNbinsX(); i++) {
271 y=h1->GetBinContent(i);
272 ey=h1->GetBinError(i);
273 x=h1->GetBinCenter(i);
274 ex=h1->GetBinWidth(i);
275
276 // cout << " x,y = " << x << " " << y << " ex,ey = " << ex << " " << ey << endl;
277
278 g1->SetPoint(i,x,y);
279 g1->SetPointError(i,ex,ey);
280
281 }
282
283 //g1->Print();
284
285 return g1;
286}