BmnRoot
Loading...
Searching...
No Matches
BmnDrawHist.h
Go to the documentation of this file.
1
7#ifndef BMNDRAWHIST_H_
8#define BMNDRAWHIST_H_
9
10#include "TH1.h"
11#include "TH1D.h"
12#include "TH2.h"
13#include "TPad.h"
14#include "TLegend.h"
15#include "TGraph.h"
16#include "TGraph2D.h"
17
18#include <string>
19#include <vector>
20#include <fstream>
21using std::string;
22using std::vector;
23
32public:
33
34 static Int_t Color(Int_t colorIndex) {
35 static const Int_t nofColors = 6;
36 static Int_t colors[nofColors] = {kRed, kBlue + 1, kGreen + 3, kMagenta + 4, kYellow + 2, kViolet};
37 return (colorIndex < nofColors) ? colors[colorIndex] : colorIndex;
38 }
39
40 static Int_t LineWidth() {
41 return 2;
42 }
43
44 static Int_t LineStyle(Int_t lineStyleIndex) {
45 return lineStyleIndex + 1;
46 }
47
48 static Float_t MarkerSize() {
49 return 0.8;
50 }
51
52 static Int_t MarkerStyle(Int_t markerIndex) {
53 static const Int_t nofMarkers = 4;
54 // static Int_t markers[nofMarkers] = {kOpenCircle, kOpenSquare, kOpenTriangleUp, kOpenDiamond,
55 // kFullCircle, kFullSquare, kFullTriangleUp};
56 static Int_t markers[nofMarkers] = {kFullCircle, kFullSquare, kFullTriangleUp, kFullDiamond};
57 return (markerIndex < nofMarkers) ? markers[markerIndex] : markerIndex;
58 }
59
60 static Double_t TextSize() {
61 return 0.06;
62 }
63};
64
70 kLog = 0,
71 kLinear = 1
72};
73
74
80
94void DrawH1(
95 TH1* hist,
96 HistScale logx = kLinear,
97 HistScale logy = kLinear,
98 const string& drawOpt = "",
99 Int_t color = BmnDrawingOptions::Color(0),
100 Int_t lineWidth = BmnDrawingOptions::LineWidth(),
101 Int_t lineStyle = BmnDrawingOptions::LineStyle(0),
102 Float_t markerSize = BmnDrawingOptions::MarkerSize(),
103 Int_t markerStyle = BmnDrawingOptions::MarkerStyle(0),
104 Int_t fillColor = -1);
105
106
115void DrawH2(
116 TH2* hist,
117 HistScale logx = kLinear,
118 HistScale logy = kLinear,
119 HistScale logz = kLinear,
120 const string& drawOpt = "COLZ");
121
122
137void DrawH1(
138 const vector<TH1*>& histos,
139 const vector<string>& histLabels,
140 HistScale logx = kLinear,
141 HistScale logy = kLinear,
142 Bool_t drawLegend = true,
143 Double_t x1 = 0.25,
144 Double_t y1 = 0.99,
145 Double_t x2 = 0.55,
146 Double_t y2 = 0.75,
147 const string& drawOpt = "", Bool_t outputMeanValue01 = kFALSE);
148
162void DrawGraph(
163 TGraph* graph,
164 HistScale logx = kLinear,
165 HistScale logy = kLinear,
166 const string& drawOpt = "AC",
167 Int_t color = BmnDrawingOptions::Color(0),
168 Int_t lineWidth = BmnDrawingOptions::LineWidth(),
169 Int_t lineStyle = BmnDrawingOptions::LineStyle(0),
170 Int_t markerSize = BmnDrawingOptions::MarkerSize(),
171 Int_t markerStyle = BmnDrawingOptions::MarkerStyle(0));
172
186void DrawGraph(
187 const vector<TGraph*>& graphs,
188 const vector<string>& graphLabels,
189 HistScale logx = kLinear,
190 HistScale logy = kLinear,
191 Bool_t drawLegend = true,
192 Double_t x1 = 0.25,
193 Double_t y1 = 0.99,
194 Double_t x2 = 0.55,
195 Double_t y2 = 0.75);
196
206void DrawGraph2D(
207 TGraph2D* graph,
208 HistScale logx = kLinear,
209 HistScale logy = kLinear,
210 HistScale logz = kLinear,
211 const string& drawOpt = "colz");
212
213void DrawMeanLine(TH1* hist);
214
215#endif
Default options for drawing.
Definition BmnDrawHist.h:31
static Int_t LineStyle(Int_t lineStyleIndex)
Definition BmnDrawHist.h:44
static Double_t TextSize()
Definition BmnDrawHist.h:60
static Int_t Color(Int_t colorIndex)
Definition BmnDrawHist.h:34
static Int_t LineWidth()
Definition BmnDrawHist.h:40
static Int_t MarkerStyle(Int_t markerIndex)
Definition BmnDrawHist.h:52
static Float_t MarkerSize()
Definition BmnDrawHist.h:48
void DrawGraph2D(TGraph2D *graph, HistScale logx=kLinear, HistScale logy=kLinear, HistScale logz=kLinear, const string &drawOpt="colz")
void SetDefaultDrawStyle()
void DrawH2(TH2 *hist, HistScale logx=kLinear, HistScale logy=kLinear, HistScale logz=kLinear, const string &drawOpt="COLZ")
void DrawGraph(TGraph *graph, HistScale logx=kLinear, HistScale logy=kLinear, const string &drawOpt="AC", Int_t color=BmnDrawingOptions::Color(0), Int_t lineWidth=BmnDrawingOptions::LineWidth(), Int_t lineStyle=BmnDrawingOptions::LineStyle(0), Int_t markerSize=BmnDrawingOptions::MarkerSize(), Int_t markerStyle=BmnDrawingOptions::MarkerStyle(0))
void DrawH1(TH1 *hist, HistScale logx=kLinear, HistScale logy=kLinear, const string &drawOpt="", Int_t color=BmnDrawingOptions::Color(0), Int_t lineWidth=BmnDrawingOptions::LineWidth(), Int_t lineStyle=BmnDrawingOptions::LineStyle(0), Float_t markerSize=BmnDrawingOptions::MarkerSize(), Int_t markerStyle=BmnDrawingOptions::MarkerStyle(0), Int_t fillColor=-1)
void DrawMeanLine(TH1 *hist)
HistScale
Define linear or logarithmic scale for drawing.
Definition BmnDrawHist.h:69
@ kLinear
Definition BmnDrawHist.h:71
@ kLog
Definition BmnDrawHist.h:70