Legend.hh
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "TLegend.h"
7 
8 #include "boca/math/Rectangle.hh"
9 #include "boca/latex/String.hh"
11 
12 namespace boca
13 {
14 
15 class Legend
16 {
17 public:
18 
19  Legend();
20 
21  Legend(latex::String const& title);
22 
23  Legend(boca::Rectangle<double> const& rectangle, latex::String const& title = latex::String());
24 
25  Legend(Orientation orientation, std::vector<latex::String> const& entries, latex::String const& title = latex::String());
26 
27  void SetOrientation(Orientation orientation, std::vector<latex::String> const& entries, latex::String const& title);
28 
29  void Set(boca::Rectangle<double> const& rectangle, latex::String const& title = latex::String());
30 
31  void SetOrientation(Orientation orientation, latex::String const& title);
32 
33  void Draw();
34 
35  void AddEntry(TObject const& object, latex::String const& name);
36 
37  void AddEntry(TObject const& object, char const* name);
38 
39  void TwoColumn();
40 
42 
43 private:
44 
45  double Width(std::vector<latex::String> const& entries) const;
46 
47  double Height(std::vector<latex::String> const& entries, latex::String const& title) const;
48 
49  void SetCorners(boca::Rectangle<double> const& rectangle);
50 
51  void SetStyle();
52 
53  void SetTitle(latex::String const& title);
54 
55  TLegend legend_;
56 
57  int columns_ = 1;
58 };
59 
60 }
boca::Rectangle< double > Rectangle()
Definition: Legend.cpp:262
void AddEntry(TObject const &object, latex::String const &name)
Definition: Legend.cpp:215
Definition: String.hh:45
Boosted Collider Analysis.
Definition: Analysis.hh:15
void Set(boca::Rectangle< double > const &rectangle, latex::String const &title=latex::String())
Definition: Legend.cpp:177
void TwoColumn()
Definition: Legend.cpp:227
Definition: Legend.hh:15
Orientation
Orientation of the Legend.
Definition: Orientation.hh:20
void Draw()
Definition: Legend.cpp:205
void SetOrientation(Orientation orientation, std::vector< latex::String > const &entries, latex::String const &title)
Definition: Legend.cpp:184
Legend()
Definition: Legend.cpp:157