ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/csander/HEPTutorial/Plotter.h
Revision: 1.1
Committed: Mon Jun 25 14:39:49 2012 UTC (12 years, 10 months ago) by csander
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
automated plotting

File Contents

# User Rev Content
1 csander 1.1 /*
2     * Plotter.h
3     *
4     * Created on: 25.06.2012
5     * Author: csander
6     */
7    
8     #ifndef PLOTTER_H_
9     #define PLOTTER_H_
10    
11     #include <vector>
12     #include <string>
13     #include <iostream>
14    
15     #include <TH1F.h>
16     #include <TStyle.h>
17     #include <THStack.h>
18     #include <TCanvas.h>
19     #include <TLegend.h>
20     #include <TROOT.h>
21    
22    
23     class Plotter {
24     public:
25     Plotter();
26     virtual ~Plotter();
27     void SetData(std::vector<TH1F*> v, std::string n){
28     data.push_back(v);
29     data_names.push_back(n);
30     N_histos = v.size();
31     }
32     void ClearData(){
33     data.clear();
34     data_names.clear();
35     }
36     void AddBg(std::vector<TH1F*> v, std::string n){
37     bg.push_back(v);
38     bg_names.push_back(n);
39     N_histos = v.size();
40     }
41     void ClearBg(){
42     bg.clear();
43     bg_names.clear();
44     }
45     void AddSig(std::vector<TH1F*> v, std::string n){
46     signal.push_back(v);
47     signal_names.push_back(n);
48     N_histos = v.size();
49     }
50     void ClearSig(){
51     signal.clear();
52     signal_names.clear();
53     }
54     void Plot(std::string filename = "result.pdf");
55    
56     private:
57     std::vector < std::vector<TH1F*> > data;
58     std::vector < std::vector<TH1F*> > bg;
59     std::vector < std::vector<TH1F*> > signal;
60    
61     std::vector < std::string > data_names;
62     std::vector < std::string > bg_names;
63     std::vector < std::string > signal_names;
64    
65     int N_histos;
66    
67     };
68    
69     #endif /* PLOTTER_H_ */