1 |
|
2 |
|
3 |
map<string,TH1F*> th1f_map;
|
4 |
map<string,TH2F*> th2f_map;
|
5 |
map<string,TH3F*> th3f_map;
|
6 |
|
7 |
void makeTH3F(string sname, int nbinx, float xlow, float xhigh, int nbiny, float ylow, float yhigh,int nbinz,float zlow, float zhigh){
|
8 |
|
9 |
std::map<string,TH3F*>::iterator it_data2 = th3f_map.find(sname);
|
10 |
if( it_data2 != th3f_map.end()){
|
11 |
cout<<" makeTH3F already th3f defined! " << sname.c_str()<<endl;
|
12 |
exit(1);
|
13 |
}
|
14 |
TString tname = TString("th3f_") + TString(sname);
|
15 |
th3f_map[sname] = new TH3F(tname,tname,nbinx, xlow, xhigh,nbiny,ylow,yhigh,nbinz,zlow,zhigh);
|
16 |
|
17 |
}
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
void makeTH2F(string sname, int nbinx, float xlow, float xhigh, int nbiny, float ylow, float yhigh){
|
23 |
//string sname = string (Form("cc%d_sm%d_ietabin%d",n,j,k));
|
24 |
|
25 |
std::map<string,TH2F*>::iterator it_data2 = th2f_map.find(sname);
|
26 |
if( it_data2 != th2f_map.end()){
|
27 |
cout<<" makeTH2F already th2f defined! " << sname.c_str()<<endl;
|
28 |
exit(1);
|
29 |
}
|
30 |
TString tname = TString("th2f_") + TString(sname);
|
31 |
th2f_map[sname] = new TH2F(tname,tname,nbinx, xlow, xhigh,nbiny,ylow,yhigh);
|
32 |
|
33 |
}
|
34 |
|
35 |
|
36 |
void makeTH1F(string sname, int nbinx, float xlow, float xhigh){
|
37 |
|
38 |
std::map<string,TH1F*>::iterator it_data2 = th1f_map.find(sname);
|
39 |
if( it_data2 != th1f_map.end()){
|
40 |
cout<<" makeTH1F already th1f defined! " << sname.c_str()<<endl;
|
41 |
exit(1);
|
42 |
}
|
43 |
|
44 |
TString tname = TString("th1f_") + TString(sname);
|
45 |
th1f_map[sname] = new TH1F(tname,tname,nbinx, xlow, xhigh);
|
46 |
th1f_map[sname] ->Sumw2();
|
47 |
}
|
48 |
|
49 |
void makeTH1F(string sname, int nbinx, float xlow[]){
|
50 |
|
51 |
std::map<string,TH1F*>::iterator it_data2 = th1f_map.find(sname);
|
52 |
if( it_data2 != th1f_map.end()){
|
53 |
cout<<" makeTH1F already th1f defined! " << sname.c_str()<<endl;
|
54 |
exit(1);
|
55 |
}
|
56 |
|
57 |
TString tname = TString("th1f_") + TString(sname);
|
58 |
th1f_map[sname] = new TH1F(tname,tname,nbinx, xlow);
|
59 |
th1f_map[sname] ->Sumw2();
|
60 |
}
|
61 |
|
62 |
|
63 |
void fillTH1F(string sname, float val, float wt=1){
|
64 |
std::map<string,TH1F*>::iterator it_data2 = th1f_map.find(sname);
|
65 |
if( it_data2 == th1f_map.end()){
|
66 |
cout<<" fillTH1F not defined! " << sname.c_str()<<endl;
|
67 |
exit(1);
|
68 |
}
|
69 |
th1f_map[sname]->Fill(val,wt);
|
70 |
|
71 |
}
|
72 |
|
73 |
void fillTH2F(string sname, float valx, float valy, float wt=1){
|
74 |
std::map<string,TH2F*>::iterator it_data2 = th2f_map.find(sname);
|
75 |
if( it_data2 == th2f_map.end()){
|
76 |
cout<<" fillTH2F not defined! " << sname.c_str()<<endl;
|
77 |
exit(1);
|
78 |
}
|
79 |
th2f_map[sname]->Fill(valx,valy,wt);
|
80 |
|
81 |
}
|
82 |
|
83 |
void setBinContentTH2F(string sname, int binx, int biny, float val){
|
84 |
std::map<string,TH2F*>::iterator it_data2 = th2f_map.find(sname);
|
85 |
if( it_data2 == th2f_map.end()){
|
86 |
cout<<" seBinContentTH2F not defined! " << sname.c_str()<<endl;
|
87 |
exit(1);
|
88 |
}
|
89 |
th2f_map[sname]->SetBinContent(binx, biny, val);
|
90 |
|
91 |
}
|
92 |
|
93 |
|
94 |
void setBinContentTH1F(string sname, int binx, float val,float err){
|
95 |
std::map<string,TH1F*>::iterator it_data2 = th1f_map.find(sname);
|
96 |
if( it_data2 == th1f_map.end()){
|
97 |
cout<<" seBinContentTH1F not defined! " << sname.c_str()<<endl;
|
98 |
exit(1);
|
99 |
}
|
100 |
th1f_map[sname]->SetBinContent(binx, val);
|
101 |
th1f_map[sname]->SetBinError(binx, err);
|
102 |
|
103 |
}
|
104 |
|