DESY Hbb Analysis Framework
Functions
HttStylesNew.h File Reference
#include <TH1.h>
#include <TPad.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TLegend.h>
#include <TPaveText.h>
#include "TLatex.h"

Go to the source code of this file.

Functions

void CMSPrelim (const char *dataset, double lowX=0.4, double lowY=0.74)
 add CMSPreliminary logo, lumi and channel More...
 
void InitData (TH1 *hist)
 define poly markers and line width for data More...
 
void InitHist (TH1 *hist, const char *xtit, const char *ytit="Number of Entries", int color=kBlack, int style=0)
 define a histogram file (not yet including poly markers, which are used fro data) More...
 
void InitSignal (TH1 *hist)
 define line style, width and color for signal sample More...
 
void InitSubPad (TPad *pad, int i)
 define common style of pads More...
 
TCanvas * MakeCanvas (const char *name, const char *title, int dX=600, int dY=600)
 create a canveas in common style (default is square) More...
 
void plotchannel (TString channel)
 
void SetLegendStyle (TLegend *leg)
 define common legend style More...
 
void SetStyle ()
 define common styles More...
 

Function Documentation

void CMSPrelim ( const char *  dataset,
double  lowX = 0.4,
double  lowY = 0.74 
)

add CMSPreliminary logo, lumi and channel

Definition at line 213 of file HttStylesNew.h.

214 {
215  TPaveText* cmsprel = new TPaveText(lowX, lowY+0.06, lowX+0.30, lowY+0.16, "NDC");
216  cmsprel->SetBorderSize( 0 );
217  cmsprel->SetFillStyle( 0 );
218  cmsprel->SetTextAlign( 12 );
219  cmsprel->SetTextSize ( 0.05 );
220  cmsprel->SetTextColor( 1 );
221  cmsprel->SetTextFont ( 62 );
222  cmsprel->AddText("CMS");
223  cmsprel->Draw();
224 
225  TPaveText* lumi = new TPaveText(lowX+0.08, lowY+0.061, lowX+0.45, lowY+0.161, "NDC");
226  lumi->SetBorderSize( 0 );
227  lumi->SetFillStyle( 0 );
228  lumi->SetTextAlign( 12 );
229  lumi->SetTextSize ( 0.05 );
230  lumi->SetTextColor( 1 );
231  lumi->SetTextFont ( 62 );
232  lumi->AddText(dataset);
233  lumi->Draw();
234 
235 }
void InitData ( TH1 *  hist)

define poly markers and line width for data

Definition at line 199 of file HttStylesNew.h.

200 {
201  hist->SetMarkerStyle(20.);
202  hist->SetMarkerSize (1.3);
203  hist->SetLineWidth ( 2.);
204 }
void InitHist ( TH1 *  hist,
const char *  xtit,
const char *  ytit = "Number of Entries",
int  color = kBlack,
int  style = 0 
)

define a histogram file (not yet including poly markers, which are used fro data)

Definition at line 172 of file HttStylesNew.h.

173 {
174  hist->SetXTitle(xtit);
175  hist->SetYTitle(ytit);
176  hist->SetLineColor(kBlack);
177  hist->SetLineWidth( 2.);
178  hist->SetFillColor(color );
179  hist->SetFillStyle(style );
180  hist->SetTitleSize (0.055,"Y");
181  hist->SetTitleOffset(1.600,"Y");
182  hist->SetLabelOffset(0.014,"Y");
183  hist->SetLabelSize (0.040,"Y");
184  hist->SetLabelFont (42 ,"Y");
185  hist->SetTitleSize (0.055,"X");
186  hist->SetTitleOffset(1.300,"X");
187  hist->SetLabelOffset(0.014,"X");
188  hist->SetLabelSize (0.050,"X");
189  hist->SetLabelFont (42 ,"X");
190  hist->SetMarkerStyle(20);
191  hist->SetMarkerColor(color);
192  hist->SetMarkerSize (0.6);
193  hist->GetYaxis()->SetTitleFont(42);
194  hist->GetXaxis()->SetTitleFont(42);
195  hist->SetTitle("");
196  return;
197 }
void InitSignal ( TH1 *  hist)

define line style, width and color for signal sample

Definition at line 164 of file HttStylesNew.h.

165 {
166  hist->SetFillStyle(0.);
167  hist->SetLineStyle(11);
168  hist->SetLineWidth(2.);
169  hist->SetLineColor(kBlue+3);
170 }
void InitSubPad ( TPad *  pad,
int  i 
)

define common style of pads

Definition at line 153 of file HttStylesNew.h.

154 {
155  pad->cd(i);
156  TPad *tmpPad = (TPad*) pad->GetPad(i);
157  tmpPad->SetLeftMargin (0.18);
158  tmpPad->SetTopMargin (0.05);
159  tmpPad->SetRightMargin (0.07);
160  tmpPad->SetBottomMargin(0.15);
161  return;
162 }
TCanvas * MakeCanvas ( const char *  name,
const char *  title,
int  dX = 600,
int  dY = 600 
)

create a canveas in common style (default is square)

Definition at line 127 of file HttStylesNew.h.

128 {
129  // Start with a canvas
130  TCanvas *canvas = new TCanvas(name,title,0,0,dX,dY);
131  // General overall stuff
132  canvas->SetFillColor (0);
133  canvas->SetBorderMode (0);
134  canvas->SetBorderSize (10);
135  // Set margins to reasonable defaults
136  canvas->SetLeftMargin (0.18);
137  canvas->SetRightMargin (0.05);
138  canvas->SetTopMargin (0.08);
139  canvas->SetBottomMargin (0.15);
140  // Setup a frame which makes sense
141  canvas->SetFrameFillStyle (0);
142  canvas->SetFrameLineStyle (0);
143  canvas->SetFrameBorderMode(0);
144  canvas->SetFrameBorderSize(10);
145  canvas->SetFrameFillStyle (0);
146  canvas->SetFrameLineStyle (0);
147  canvas->SetFrameBorderMode(0);
148  canvas->SetFrameBorderSize(10);
149 
150  return canvas;
151 }
void plotchannel ( TString  channel)

Definition at line 236 of file HttStylesNew.h.

236  {
237 
238  TLatex * tex = new TLatex(0.2,0.94,channel);
239  tex->SetNDC();
240  tex->SetTextSize(0.06);
241  tex->SetLineWidth(2);
242  tex->Draw();
243 
244 }
void SetLegendStyle ( TLegend *  leg)

define common legend style

Definition at line 206 of file HttStylesNew.h.

207 {
208  leg->SetFillStyle (0);
209  leg->SetFillColor (0);
210  leg->SetBorderSize(0);
211 }
std::string leg[10]
Definition: PlotsCompare.cc:29
void SetStyle ( )

define common styles

Definition at line 38 of file HttStylesNew.h.

Referenced by PlotTanBetaLimit().

39 {
40  TStyle *HttStyle = new TStyle("Htt-Style","The Perfect Style for Plots ;-)");
41  gStyle = HttStyle;
42 
43  // Canvas
44  HttStyle->SetCanvasColor (0);
45  HttStyle->SetCanvasBorderSize(10);
46  HttStyle->SetCanvasBorderMode(0);
47  HttStyle->SetCanvasDefH (700);
48  HttStyle->SetCanvasDefW (700);
49  HttStyle->SetCanvasDefX (100);
50  HttStyle->SetCanvasDefY (100);
51 
52  // color palette for 2D temperature plots
53  HttStyle->SetPalette(1,0);
54 
55  // Pads
56  HttStyle->SetPadColor (0);
57  HttStyle->SetPadBorderSize (10);
58  HttStyle->SetPadBorderMode (0);
59  HttStyle->SetPadBottomMargin(0.13);
60  HttStyle->SetPadTopMargin (0.08);
61  HttStyle->SetPadLeftMargin (0.15);
62  HttStyle->SetPadRightMargin (0.05);
63  HttStyle->SetPadGridX (0);
64  HttStyle->SetPadGridY (0);
65  HttStyle->SetPadTickX (1);
66  HttStyle->SetPadTickY (1);
67 
68  // Frames
69  HttStyle->SetLineWidth(3);
70  HttStyle->SetFrameFillStyle ( 0);
71  HttStyle->SetFrameFillColor ( 0);
72  HttStyle->SetFrameLineColor ( 1);
73  HttStyle->SetFrameLineStyle ( 0);
74  HttStyle->SetFrameLineWidth ( 2);
75  HttStyle->SetFrameBorderSize(10);
76  HttStyle->SetFrameBorderMode( 0);
77 
78  // Histograms
79  HttStyle->SetHistFillColor(2);
80  HttStyle->SetHistFillStyle(0);
81  HttStyle->SetHistLineColor(1);
82  HttStyle->SetHistLineStyle(0);
83  HttStyle->SetHistLineWidth(3);
84  HttStyle->SetNdivisions(505);
85 
86  // Functions
87  HttStyle->SetFuncColor(1);
88  HttStyle->SetFuncStyle(0);
89  HttStyle->SetFuncWidth(2);
90 
91  // Various
92  HttStyle->SetMarkerStyle(20);
93  HttStyle->SetMarkerColor(kBlack);
94  HttStyle->SetMarkerSize (1.4);
95 
96  HttStyle->SetTitleBorderSize(0);
97  HttStyle->SetTitleFillColor (0);
98  HttStyle->SetTitleX (0.2);
99 
100  HttStyle->SetTitleSize (0.055,"X");
101  HttStyle->SetTitleOffset(1.200,"X");
102  HttStyle->SetLabelOffset(0.005,"X");
103  HttStyle->SetLabelSize (0.050,"X");
104  HttStyle->SetLabelFont (42 ,"X");
105 
106  HttStyle->SetStripDecimals(kFALSE);
107  HttStyle->SetLineStyleString(11,"20 10");
108 
109  HttStyle->SetTitleSize (0.055,"Y");
110  HttStyle->SetTitleOffset(1.600,"Y");
111  HttStyle->SetLabelOffset(0.010,"Y");
112  HttStyle->SetLabelSize (0.050,"Y");
113  HttStyle->SetLabelFont (42 ,"Y");
114 
115  HttStyle->SetTextSize (0.055);
116  HttStyle->SetTextFont (42);
117 
118  HttStyle->SetStatFont (42);
119  HttStyle->SetTitleFont (42);
120  HttStyle->SetTitleFont (42,"X");
121  HttStyle->SetTitleFont (42,"Y");
122 
123  HttStyle->SetOptStat (0);
124  return;
125 }