Graphs.hh
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "TGraph.h"
7 #include "TMultiGraph.h"
8 #include "TLine.h"
9 
10 #include "boca/plotting/Legend.hh"
11 #include "boca/plotting/Canvas.hh"
12 
13 namespace boca
14 {
15 
16 class Graphs : public Canvas
17 {
18 
19 public:
20 
21  Graphs(std::string const& path, std::string const& name, bool show_title = false);
22 
23  ~Graphs();
24 
25  void AddGraph(std::vector<double> const& xs, std::vector<double> const& ys, latex::String const& name = latex::String());
26 
27  void SetLegend(Orientation orientation, latex::String const& title = latex::String());
28 
29  void SetXAxis(const boca::latex::String& title, boca::Range<double> const& range = Range<double>());
30 
31  void SetYAxis(const boca::latex::String& title, boca::Range<double> const& range = Range<double>());
32 
33  void AddLine(double x_value, latex::String const& title = latex::String());
34 
35 private:
36 
37  void Draw();
38 
39  Range<double> RangeY();
40 
41  Range<double> RangeX();
42 
43  void AddGraphs();
44 
45  TMultiGraph multi_graph_;
46 
47  Legend legend_;
48 
49  std::vector<TGraph> graphs_;
50 
51  std::vector<std::pair<TLine, std::string>> lines_;
52 
53  std::vector<std::pair<std::vector<double>, std::vector<double>>> datas_;
54 
55  Rectangle<double> range_;
56 
57 };
58 
59 }
60 
Definition: Graphs.hh:16
void AddGraph(std::vector< double > const &xs, std::vector< double > const &ys, latex::String const &name=latex::String())
Definition: Graphs.cpp:31
Graphs(std::string const &path, std::string const &name, bool show_title=false)
Definition: Graphs.cpp:17
Definition: String.hh:45
void SetLegend(Orientation orientation, latex::String const &title=latex::String())
Definition: Graphs.cpp:47
Boosted Collider Analysis.
Definition: Analysis.hh:15
Definition: Canvas.hh:14
~Graphs()
Definition: Graphs.cpp:24
Definition: Legend.hh:15
Orientation
Orientation of the Legend.
Definition: Orientation.hh:20
void SetYAxis(const boca::latex::String &title, boca::Range< double > const &range=Range< double >())
Definition: Graphs.cpp:85
void AddLine(double x_value, latex::String const &title=latex::String())
Definition: Graphs.cpp:138
void SetXAxis(const boca::latex::String &title, boca::Range< double > const &range=Range< double >())
Definition: Graphs.cpp:67