46 |
|
#include "SampleWeight.h" |
47 |
|
#include "Selection.h" |
48 |
|
#include "HZZCiCElectronSelection.h" |
49 |
+ |
#include "HZZLikelihoodElectronSelection.h" |
50 |
+ |
#include "HZZBDTElectronSelection.h" |
51 |
|
#include "SampleWeight.h" |
52 |
|
|
53 |
|
//#define THEIR_EVENTS |
74 |
|
} |
75 |
|
ctrl.dump(); |
76 |
|
|
77 |
+ |
map<string,double> entrymap; // number of unskimmed entries in each file |
78 |
+ |
|
79 |
|
// |
80 |
|
// File I/O |
81 |
|
//-------------------------------------------------------------------------------------------------------------- |
83 |
|
ifstream f(ctrl.inputfile.c_str()); |
84 |
|
string fname; |
85 |
|
while (f >> fname) { |
86 |
< |
if( !(strncmp( fname.c_str(), "#", 1 ) ) ) continue; // skip commented lines |
86 |
> |
if( !(strncmp( fname.c_str(), "#", 1 ) ) ) continue; // skip commented lines |
87 |
|
cout << "adding inputfile : " << fname.c_str() << endl; |
88 |
+ |
entrymap[string(fname.c_str())] = unskimmedEntries(fname.c_str()); |
89 |
|
chain->AddFile(fname.c_str()); |
90 |
|
} |
91 |
|
|
96 |
|
// Setup |
97 |
|
//-------------------------------------------------------------------------------------------------------------- |
98 |
|
TH1F * h_evt = new TH1F("hevt", "hevt", 2, 0, 2 ); |
99 |
< |
TH1F * h_evtfail = new TH1F("hevtfail", "hevtfail", 1024, 0, 1024 ); |
99 |
> |
TH1F * h_evtfail = new TH1F("hevtfail", "hevtfail", 1024, 0, 1024 ); |
100 |
|
TNtuple * passtuple = new TNtuple( "passtuple", "passtuple", "run:evt:lumi:channel:mZ1:mZ2:m4l:pt4l:w" ); |
101 |
|
initCiCSelection(); |
102 |
+ |
if(ctrl.eleSele=="lik") initLikSelection(); |
103 |
+ |
if(ctrl.eleSele=="bdt") initBDTSelection(); |
104 |
|
initRunLumiRangeMap(); |
105 |
|
|
99 |
– |
|
106 |
|
// |
107 |
|
// Loop |
108 |
|
//-------------------------------------------------------------------------------------------------------------- |
134 |
|
|
135 |
|
|
136 |
|
cout << "nEntries: " << chain->GetEntries() << endl; |
137 |
< |
for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) { |
138 |
< |
|
137 |
> |
for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) { |
138 |
> |
|
139 |
|
chain->GetEntry(ientry); |
140 |
+ |
if(!(ientry%100000)) cout << "entry: " << ientry << endl; |
141 |
|
|
142 |
|
// get event weight for this file |
143 |
< |
double xs=1,eventweight=1; |
144 |
< |
if(ctrl.mc) eventweight = xstab.Get(getname(chain).c_str()) / chain->GetEntries(); |
143 |
> |
double eventweight=1; |
144 |
> |
if(ctrl.mc) eventweight = getWeight(xstab,entrymap,chain); |
145 |
|
|
146 |
|
#ifdef THEIR_EVENTS |
147 |
|
if( !( info->evtNum == 504867308 || |
168 |
|
info->evtNum == 107360878 ) ) continue; |
169 |
|
#endif |
170 |
|
|
171 |
< |
unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple ); |
171 |
> |
unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple); |
172 |
|
h_evtfail->Fill( evtfail, eventweight ); |
173 |
< |
cout << endl << endl; |
173 |
> |
if( ctrl.debug ) cout << endl << endl; |
174 |
|
|
175 |
|
} //end loop over data |
176 |
|
|
199 |
|
file->Close(); |
200 |
|
delete file; |
201 |
|
|
202 |
+ |
// map<TString,TMVA::Reader*>::iterator it; |
203 |
+ |
// for(it=readers.begin(); it!=readers.end(); it++) delete (*it).second; |
204 |
+ |
|
205 |
|
cerr << "done!" << endl; |
206 |
|
} |
207 |
|
|