ATLAS Offline Software
Loading...
Searching...
No Matches
AtlasStyle.h File Reference
#include <vector>
#include <string>
#include <cmath>
#include <TStyle.h>
#include <TLatex.h>
#include <TMarker.h>
#include <TROOT.h>
Include dependency graph for InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/AtlasStyle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define def_Preliminary   false
#define def_Official   false

Functions

void SetAtlasStyle ()
void DrawATLASLabel (float x, float y, float textsize=0.05, bool Preliminary=true)
void DrawTitleLatex (const char *chartitle, float x, float y, int color=1, float textsize=0.04)
void DrawLegendLatex (const char *chartitle, int markertype, float x, float y, int color=1, float textsize=0.03)
void GetCoreParameters (const TH1 *hist, double &mean, double &mean_error, double &rms, double &rms_error, double &nentries)

Macro Definition Documentation

◆ def_Official

#define def_Official   false

◆ def_Preliminary

#define def_Preliminary   false

Function Documentation

◆ DrawATLASLabel()

void DrawATLASLabel ( float x,
float y,
float textsize = 0.05,
bool Preliminary = true )
inline

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

85 {
86 TLatex l; //l.SetTextAlign(12);
87 l.SetTextSize(textsize);
88 l.SetNDC();
89 l.SetTextFont(72);
90 l.SetTextColor(1);
91
92 double delx = 0.115*696*gPad->GetWh()/(472*gPad->GetWw());
93
94 l.DrawLatex(x,y,"ATLAS");
95 if (Preliminary) {
96 TLatex p;
97 p.SetNDC();
98 p.SetTextFont(42);
99 p.SetTextColor(1);
100 p.DrawLatex(x+delx,y,"Preliminary");
101 // p.DrawLatex(x,y,"#sqrt{s}=900GeV");
102 }
103}
#define y
#define x
l
Printing final latex table to .tex output file.

◆ DrawLegendLatex()

void DrawLegendLatex ( const char * chartitle,
int markertype,
float x,
float y,
int color = 1,
float textsize = 0.03 )
inline

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

137 {
138
139 TMarker *markerdot = new TMarker(x - 0.4 * textsize, y + 0.2 * textsize, markertype);
140 markerdot->SetNDC();
141 markerdot->SetMarkerColor(color);
142 markerdot->SetMarkerSize(25 * textsize);
143 markerdot->Draw(); // cannot use DrawMarker because it does not SetNDC()
144 //delete markerdot;
145
146 DrawTitleLatex(chartitle, x, y, color, textsize);
147}
void DrawTitleLatex(const char *chartitle, float x, float y, int color=1, float textsize=0.04)

◆ DrawTitleLatex()

void DrawTitleLatex ( const char * chartitle,
float x,
float y,
int color = 1,
float textsize = 0.04 )
inline

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

110 {
111 std::string left = std::string(chartitle);
112 std::vector<std::string> cuts;
113 std::string::size_type found = 0;
114 while(1){ // loop over the title, will exit with break
115 left = left.substr(found);
116 found = left.find(" - ");
117 if(found == std::string::npos){
118 cuts.push_back(std::move(left));
119 break;
120 }
121 cuts.push_back(left.substr(0,found));
122 found += 3; // take into account the delimiter " - "
123 }
124 TLatex TitleLabel;
125 TitleLabel.SetNDC();
126 TitleLabel.SetTextSize(textsize);
127 TitleLabel.SetTextColor(color);
128 for(unsigned int i = 0 ; i < cuts.size(); i++)
129 TitleLabel.DrawLatex(x,y-i*(1.25)*textsize,(cuts[i]).c_str());
130
131}

◆ GetCoreParameters()

void GetCoreParameters ( const TH1 * hist,
double & mean,
double & mean_error,
double & rms,
double & rms_error,
double & nentries )
inline

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

151 {
152
153 nentries = 0.;
154 mean = 0.;
155 mean_error = 0.;
156 rms = 0.;
157 rms_error = 0.;
158
159 double axmin = hist->GetMean() - 3 * hist->GetRMS();
160 double axmax = hist->GetMean() + 3 * hist->GetRMS();
161 int nbins = hist->GetNbinsX();
162 int imean = 0;
163 hist->GetBinWithContent(hist->GetMean(), imean);
164 float binwidth = hist->GetBinWidth(imean);
165 if( fabs(axmax-axmin) < binwidth){
166 nentries = hist->GetEntries();
167 mean = hist->GetMean();
168 rms = binwidth/sqrt(12);
169 }else{
170 for (int i = 0 ; i < nbins; i++){
171 double value = hist->GetBinCenter(i+1);
172 double ientries = hist->GetBinContent(i+1);
173 if (value < axmin) continue;
174 if (value > axmax) break;
175 mean += value*ientries;
176 rms += value*value*ientries;
177 nentries += ientries;
178 }
179 if (nentries > 0) {
181 rms = sqrt(rms/nentries-mean*mean);
182 }
183 }
184
185 if (nentries > 0) {
186 mean_error = rms / sqrt(nentries);
187 if(nentries > 1) rms_error = rms / sqrt(2*(nentries-1));
188 }
189
190 return;
191}
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
bool binwidth
Definition listroot.cxx:58

◆ SetAtlasStyle()

void SetAtlasStyle ( )
inline

Definition at line 17 of file InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/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->SetCanvasBorderMode(icol);
24 atlasStyle->SetFrameFillColor(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}