ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/IPHCalignment2/analysis/Layout.h
Revision: 1.2
Committed: Sun Nov 27 11:11:49 2011 UTC (13 years, 5 months ago) by econte
Content type: text/plain
Branch: MAIN
Changes since 1.1: +50 -5 lines
Log Message:
eric changes for Layout

File Contents

# User Rev Content
1 econte 1.1 #ifndef Layout_h
2     #define Layout_h
3    
4     #include <TROOT.h>
5     #include <TH1F.h>
6     #include <TCanvas.h>
7     #include <TLegend.h>
8     #include <THStack.h>
9     #include <TColor.h>
10    
11     #include <vector>
12     #include <string>
13     #include <sstream>
14    
15    
16     #include "histoAlgo.h"
17    
18    
19     class Layout
20     {
21     public:
22     Layout() { counter_=0;}
23     ~Layout() {}
24    
25     void Draw(const std::vector<HistoBlock>& histos,
26 econte 1.2 const std::string& xlabel, float K=0, float MU=0, float SIG=0);
27     void Draw(const HistoBlock& histo1,
28     const std::string& xlabel, float K=0, float MU=0, float SIG=0)
29     {
30     std::vector<HistoBlock> histos(1);
31     histos[0]=histo1;
32     Draw(histos,xlabel,K,MU,SIG);
33     }
34    
35     void Draw(const HistoBlock& histo1, const HistoBlock& histo2,
36     const std::string& xlabel, float K=0, float MU=0, float SIG=0)
37     {
38     std::vector<HistoBlock> histos(2);
39     histos[0]=histo1;
40     histos[1]=histo2;
41     Draw(histos,xlabel,K,MU,SIG);
42     }
43    
44     void Draw(const HistoBlock& histo1,const HistoBlock& histo2,const HistoBlock& histo3,
45     const std::string& xlabel, float K=0, float MU=0, float SIG=0)
46     {
47     std::vector<HistoBlock> histos(3);
48     histos[0]=histo1;
49     histos[1]=histo2;
50     histos[2]=histo3;
51     Draw(histos,xlabel,K,MU,SIG);
52     }
53    
54     void Draw(const HistoBlock& histo1, const HistoBlock& histo2,
55     const HistoBlock& histo3, const HistoBlock& histo4,
56     const std::string& xlabel, float K=0, float MU=0, float SIG=0)
57     {
58     std::vector<HistoBlock> histos(4);
59     histos[0]=histo1;
60     histos[1]=histo2;
61     histos[2]=histo3;
62     histos[3]=histo4;
63     Draw(histos,xlabel,K,MU,SIG);
64     }
65    
66 econte 1.1 void DrawInit();
67    
68     private:
69    
70     unsigned int counter_;
71    
72     // Give a unique string (for ROOT name object)
73     std::string dummy()
74     {
75     counter_++;
76     std::stringstream str;
77     str << counter_;
78     return "dummy_"+str.str();
79     }
80    
81     // Some change to be sure that the string could be a filename
82     std::string GetFileName(std::string name)
83     {
84     for (unsigned int i=0;i<name.size();i++)
85     {
86 econte 1.2 if (name[i]=='^') name[i]='_';
87     else if (name[i]=='{') name[i]='_';
88     else if (name[i]=='}') name[i]='_';
89     else if (name[i]=='(') name[i]='_';
90     else if (name[i]==')') name[i]='_';
91     else if (name[i]==' ') name[i]='_';
92     else if (name[i]=='*') name[i]='_';
93     else if (name[i]=='/') name[i]='_';
94     else if (name[i]=='\\') name[i]='_';
95     else if (name[i]=='#') name[i]='_';
96 econte 1.1 }
97     return name;
98     }
99    
100     };
101    
102     #endif
103