ATLAS Offline Software
Loading...
Searching...
No Matches
HGTD_PlottingHelpers.h
Go to the documentation of this file.
1
26
28
29#ifndef HGTD_ANALYSIS_HGTD_PLOTTINGHELPERS_H
30#define HGTD_ANALYSIS_HGTD_PLOTTINGHELPERS_H
31
33ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // single-threaded plotting application
34
35#include <cmath>
36#include <iostream>
37
38#include "TGraphAsymmErrors.h"
39#include "TGraphErrors.h"
40#include "TH1.h"
41#include "TLatex.h"
42#include "TLine.h"
43#include "TMarker.h"
44#include "TPave.h"
45#include "TROOT.h"
46#include "TStyle.h"
47
49inline TStyle *AtlasStyle() {
50 TStyle *atlasStyle = new TStyle("ATLAS", "Atlas style");
51
52 // use plain black on white colors
53 Int_t icol = 0; // WHITE
54 atlasStyle->SetFrameBorderMode(icol);
55 atlasStyle->SetFrameFillColor(icol);
56 atlasStyle->SetCanvasBorderMode(icol);
57 atlasStyle->SetCanvasColor(icol);
58 atlasStyle->SetPadBorderMode(icol);
59 atlasStyle->SetPadColor(icol);
60 atlasStyle->SetStatColor(icol);
61 // atlasStyle->SetFillColor(icol); // don't use: white fill color for *all*
62 // objects
63
64 // set the paper & margin sizes
65 atlasStyle->SetPaperSize(20, 26);
66
67 // set margin sizes
68 atlasStyle->SetPadTopMargin(0.05);
69 atlasStyle->SetPadRightMargin(0.05);
70 atlasStyle->SetPadBottomMargin(0.16);
71 atlasStyle->SetPadLeftMargin(0.16);
72
73 // set title offsets (for axis label)
74 atlasStyle->SetTitleXOffset(1.4);
75 atlasStyle->SetTitleYOffset(1.4);
76
77 // use large fonts
78 // Int_t font=72; // Helvetica italics
79 Int_t font = 42; // Helvetica
80 Double_t tsize = 0.05;
81 atlasStyle->SetTextFont(font);
82
83 atlasStyle->SetTextSize(tsize);
84 atlasStyle->SetLabelFont(font, "x");
85 atlasStyle->SetTitleFont(font, "x");
86 atlasStyle->SetLabelFont(font, "y");
87 atlasStyle->SetTitleFont(font, "y");
88 atlasStyle->SetLabelFont(font, "z");
89 atlasStyle->SetTitleFont(font, "z");
90
91 atlasStyle->SetLabelSize(tsize, "x");
92 atlasStyle->SetTitleSize(tsize, "x");
93 atlasStyle->SetLabelSize(tsize, "y");
94 atlasStyle->SetTitleSize(tsize, "y");
95 atlasStyle->SetLabelSize(tsize, "z");
96 atlasStyle->SetTitleSize(tsize, "z");
97
98 // use bold lines and markers
99 atlasStyle->SetMarkerStyle(20);
100 atlasStyle->SetMarkerSize(1.2);
101 atlasStyle->SetHistLineWidth(2.);
102 atlasStyle->SetLineStyleString(2, "[12 12]"); // postscript dashes
103
104 // get rid of error bar caps
105 atlasStyle->SetEndErrorSize(0.);
106
107 // do not display any of the standard histogram decorations
108 atlasStyle->SetOptTitle(0);
109 atlasStyle->SetOptStat(0);
110 atlasStyle->SetOptFit(0);
111
112 // put tick marks on top and RHS of plots
113 atlasStyle->SetPadTickX(1);
114 atlasStyle->SetPadTickY(1);
115
116 return atlasStyle;
117}
118
120inline void SetAtlasStyle() {
121 static TStyle *atlasStyle = 0;
122 std::cout << "[SetAtlasStyle] Applying ATLAS style settings...\n";
123 if (atlasStyle == 0)
125 gROOT->SetStyle("ATLAS");
126 gStyle->SetOptStat(0);
127 gROOT->ForceStyle();
128}
129
130namespace atlas {
131
133inline void ATLAS_LABEL(Double_t x, Double_t y, Color_t color = 1,
134 float fac = 1.) {
135 TLatex l;
136 l.SetNDC();
137 l.SetTextFont(72);
138 l.SetTextSize(fac * l.GetTextSize());
139 l.SetTextColor(color);
140 l.DrawLatex(x, y, "ATLAS");
141}
142
144inline void myText(Double_t x, Double_t y, Color_t color, const char *text) {
145
146 TLatex l;
147 l.SetNDC();
148 l.SetTextColor(color);
149 l.DrawLatex(x, y, text);
150}
151
153inline void myText(Double_t x, Double_t y, Color_t color, const char *text,
154 Double_t tsize) {
155
156 TLatex l;
157 l.SetTextSize(tsize);
158 l.SetNDC();
159 l.SetTextColor(color);
160 l.DrawLatex(x, y, text);
161}
162
163} // namespace atlas
164
165#endif // HGTD_ANALYSIS_HGTD_PLOTTINGHELPERS_H
166
void ATLAS_LABEL(Double_t x, Double_t y, Color_t color=1)
Definition AtlasUtils.h:29
void myText(Double_t x, Double_t y, Color_t color, char *text)
Definition AtlasUtils.h:291
TStyle * AtlasStyle()
#define y
#define x
Define macros for attributes used to control the static checker.
#define ATLAS_NO_CHECK_FILE_THREAD_SAFETY
l
Printing final latex table to .tex output file.