ATLAS Offline Software
Loading...
Searching...
No Matches
DrawLabel.h
Go to the documentation of this file.
1/* emacs: this is -*- c++ -*- */
10
11
12#ifndef DRAWLABEL_H
13#define DRAWLABEL_H
14
15#include <iostream>
16#include <string>
17
18#include "TLatex.h"
19
20
21
22class DrawLabel {
23
24public:
25
26 DrawLabel(double x, double y, const std::string& s, int colour=kBlack, double size=0.033, double font=42 ) :
27 m_text(s), m_colour(colour), m_font(font), m_x(x), m_y(y), m_size(size)
28 {
29 // std::cout << "DrawLabel::DrawLabel() " << m_text << std::endl;
30 Draw();
31 }
32
33 virtual ~DrawLabel() { }
34
35 void Draw() const {
36 TLatex* tt = new TLatex();
37 tt->SetNDC();
38 tt->SetTextColor(m_colour);
39 tt->SetTextSize(m_size);
40 tt->SetTextFont(m_font);
41 tt->DrawLatex(m_x, m_y, m_text.c_str() );
42 }
43
44 const std::string& text() const { return m_text; }
45
46private:
47
48 std::string m_text;
50 int m_font;
51
52 double m_x;
53 double m_y;
54
55 double m_size;
56
57};
58
59inline std::ostream& operator<<( std::ostream& s, const DrawLabel& d ) {
60 return s << d.text();
61}
62
63
64#endif // DRAWLABEL_H
65
66
67
68
69
70
71
72
73
74
std::ostream & operator<<(std::ostream &s, const DrawLabel &d)
Definition DrawLabel.h:59
#define y
#define x
int m_font
Definition DrawLabel.h:50
DrawLabel(double x, double y, const std::string &s, int colour=kBlack, double size=0.033, double font=42)
Definition DrawLabel.h:26
const std::string & text() const
Definition DrawLabel.h:44
double m_y
Definition DrawLabel.h:53
int m_colour
Definition DrawLabel.h:49
double m_x
Definition DrawLabel.h:52
void Draw() const
Definition DrawLabel.h:35
double m_size
Definition DrawLabel.h:55
std::string m_text
Definition DrawLabel.h:48
virtual ~DrawLabel()
Definition DrawLabel.h:33