ROOTANA
TSimpleHistogramCanvas.hxx
Go to the documentation of this file.
1 #ifndef TSimpleHistogramCanvas_h
2 #define TSimpleHistogramCanvas_h
3 
4 
5 #include <iostream>
6 #include <string>
7 #include "TCanvasHandleBase.hxx"
8 
9 #include "TH1.h"
10 #include "TGraph.h"
11 
12 /// A canvas that plots a single TH1 or TGraph
14 
15 public:
16 
17 
18  TSimpleHistogramCanvas(TH1* histo, std::string name, std::string printoption = "");
19  TSimpleHistogramCanvas(TGraph* graph, std::string name);
20 
22 
23  /// Reset the histograms for this canvas
24  void ResetCanvasHistograms();
25 
26  /// Update the histograms for this canvas. Doesn't do anything.
27  // assumption is that the user will take care of filling histogram themself
28  void UpdateCanvasHistograms(TDataContainer& dataContainer);
29 
30  /// Plot the histograms for this canvas
31  void PlotCanvas(TDataContainer& dataContainer, TRootEmbeddedCanvas *embedCanvas);
32 
33  /// Take actions at begin run
34  void BeginRun(int transition,int run,int time);
35 
36  /// Take actions at end run
37  void EndRun(int transition,int run,int time);
38 
39  // Add extra histogram
40  void AddExtraHisto(TH1* h1){
41  fExtraHistos.push_back(h1);
42  };
43 
44  // Add extra graph
45  void AddExtraGraph(TGraph* g1){
46  fExtraGraphs.push_back(g1);
47  };
48 
49 private:
50 
51  /// Pointer to the histogram
52  TH1* fHisto;
53  /// Pointer to the graph
54  TGraph* fGraph;
55 
56  // Extra histograms and graphs
57  std::vector<TH1*> fExtraHistos;
58  std::vector<TGraph*> fExtraGraphs;
59 
60  // Print option for TH1F
61  std::string fPrintOption;
62 
63  // Don't define default constructor.
65 
66 };
67 
68 
69 #endif
A canvas that plots a single TH1 or TGraph.
TGraph * fGraph
Pointer to the graph.
void BeginRun(int transition, int run, int time)
Take actions at begin run.
void UpdateCanvasHistograms(TDataContainer &dataContainer)
Update the histograms for this canvas. Doesn't do anything.
std::vector< TH1 * > fExtraHistos
std::vector< TGraph * > fExtraGraphs
void ResetCanvasHistograms()
Reset the histograms for this canvas.
void EndRun(int transition, int run, int time)
Take actions at end run
TH1 * fHisto
Pointer to the histogram.
void PlotCanvas(TDataContainer &dataContainer, TRootEmbeddedCanvas *embedCanvas)
Plot the histograms for this canvas.