37 |
|
#include "TElectron.hh" |
38 |
|
#include "TMuon.hh" |
39 |
|
#include "TJet.hh" |
40 |
+ |
#include "SiMVAElectronSelection.h" |
41 |
|
#include "RunLumiRangeMap.h" |
42 |
|
|
43 |
|
// |
51 |
|
#include "HZZBDTElectronSelection.h" |
52 |
|
#include "SampleWeight.h" |
53 |
|
|
54 |
+ |
//#define BDTFAIL_THEIR_EVENTS |
55 |
|
//#define THEIR_EVENTS |
56 |
|
|
57 |
|
//=== MAIN ================================================================================================= |
97 |
|
// |
98 |
|
// Setup |
99 |
|
//-------------------------------------------------------------------------------------------------------------- |
100 |
+ |
const char * ofname; |
101 |
+ |
if( strcmp( ctrl.outputfile.c_str(), "") ) { |
102 |
+ |
ofname = ctrl.outputfile.c_str(); |
103 |
+ |
} else { |
104 |
+ |
ofname = "tmp.root"; |
105 |
+ |
} |
106 |
+ |
TFile *file = new TFile(ofname, "RECREATE"); |
107 |
|
TH1F * h_evt = new TH1F("hevt", "hevt", 2, 0, 2 ); |
108 |
|
TH1F * h_evtfail = new TH1F("hevtfail", "hevtfail", 1024, 0, 1024 ); |
109 |
|
// TNtuple * passtuple = new TNtuple( "passtuple", "passtuple", "run:evt:lumi:channel:mZ1:mZ2:m4l:pt4l:w" ); |
110 |
|
TTree * passtuple = new TTree("passtuple", "passtuple" ); |
111 |
|
unsigned run, evt, lumi, channel; |
112 |
|
float mZ1, mZ2, m4l, pt4l; |
113 |
+ |
unsigned tZ1, tZ2; |
114 |
|
double w; |
115 |
|
passtuple->Branch("run", &run); |
116 |
|
passtuple->Branch("evt", &evt); |
117 |
|
passtuple->Branch("lumi", &lumi); |
118 |
|
passtuple->Branch("mZ1", &mZ1); |
119 |
|
passtuple->Branch("mZ2", &mZ2); |
120 |
+ |
passtuple->Branch("tZ1", &tZ1); |
121 |
+ |
passtuple->Branch("tZ2", &tZ2); |
122 |
|
passtuple->Branch("m4l", &m4l); |
123 |
|
passtuple->Branch("pt4l", &pt4l); |
124 |
|
passtuple->Branch("w", &w); |
125 |
|
initCiCSelection(); |
126 |
|
if(ctrl.eleSele=="lik") initLikSelection(); |
127 |
|
if(ctrl.eleSele=="bdt") initBDTSelection(); |
128 |
+ |
// if(ctrl.eleSele=="si" ) initSiMVAElectronSelection(); |
129 |
|
initRunLumiRangeMap(); |
130 |
|
|
131 |
|
// |
132 |
|
// Loop |
133 |
|
//-------------------------------------------------------------------------------------------------------------- |
134 |
+ |
if(ctrl.fakeScheme!="none") {cout << "wrong executable!" << endl; assert(0);} |
135 |
|
|
136 |
|
// |
137 |
|
// Access samples and fill histograms |
158 |
|
chain->SetBranchAddress("Muon", &muonArr); |
159 |
|
|
160 |
|
|
161 |
< |
|
161 |
> |
int count=0, pass=0; |
162 |
|
cout << "nEntries: " << chain->GetEntries() << endl; |
163 |
< |
for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) { |
164 |
< |
|
163 |
> |
cerr << "nEntries: " << chain->GetEntries() << endl; |
164 |
> |
UInt_t imax = chain->GetEntries(); |
165 |
> |
for(UInt_t ientry=0; ientry<imax; ientry++) { |
166 |
|
chain->GetEntry(ientry); |
167 |
< |
if(!(ientry%100000)) cout << "entry: " << ientry << endl; |
167 |
> |
if(!(ientry%100000)) cerr << "entry: " << ientry << endl; |
168 |
|
|
169 |
|
// get event weight for this file |
170 |
|
double eventweight=1; |
173 |
|
#ifdef THEIR_EVENTS |
174 |
|
if( !( info->evtNum == 504867308 || |
175 |
|
info->evtNum == 368148849 || |
176 |
< |
info->evtNum == 129514273 || |
176 |
> |
// info->evtNum == 129514273 || |
177 |
|
info->evtNum == 286336207 || |
178 |
|
info->evtNum == 344708580 || |
179 |
|
info->evtNum == 30998576 || |
181 |
|
info->evtNum == 394010457 || |
182 |
|
info->evtNum == 917379387 || |
183 |
|
info->evtNum == 78213037 || |
184 |
< |
info->evtNum == 337493970 || |
184 |
> |
info->evtNum == 862270386 || |
185 |
> |
info->evtNum == 337493970 || // not baseline anymore? |
186 |
|
info->evtNum == 1491724484 || |
187 |
|
info->evtNum == 480301165 || |
188 |
|
info->evtNum == 1038911933 || |
193 |
|
info->evtNum == 191231387 || |
194 |
|
info->evtNum == 66033190 || |
195 |
|
info->evtNum == 10347106 || |
196 |
< |
info->evtNum == 107360878 ) ) continue; |
196 |
> |
info->evtNum == 107360878 || |
197 |
> |
info->evtNum == 2554393033 || |
198 |
> |
info->evtNum == 933807102 || |
199 |
> |
info->evtNum == 1188043146 || |
200 |
> |
info->evtNum == 559839432 || |
201 |
> |
info->evtNum == 16706390 || |
202 |
> |
info->evtNum == 65557571 || |
203 |
> |
info->evtNum == 389185367 || |
204 |
> |
info->evtNum == 2722114329 ) ) continue; |
205 |
|
#endif |
206 |
+ |
|
207 |
+ |
|
208 |
+ |
#ifdef BDTFAIL_THEIR_EVENTS |
209 |
+ |
if( !( info->evtNum == 78213037 || |
210 |
+ |
info->evtNum == 876658967 ) ) continue; |
211 |
+ |
|
212 |
+ |
#endif |
213 |
+ |
|
214 |
+ |
unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple); |
215 |
|
|
216 |
< |
unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple); |
216 |
> |
#ifdef THEIR_EVENTS |
217 |
> |
if(evtfail!=0) cout << "Failed!" << endl; |
218 |
> |
#endif |
219 |
> |
|
220 |
|
h_evtfail->Fill( evtfail, eventweight ); |
221 |
< |
if( ctrl.debug ) cout << endl << endl; |
221 |
> |
|
222 |
> |
count++; |
223 |
> |
if( !evtfail ) pass++; |
224 |
|
|
225 |
|
} //end loop over data |
226 |
|
|
227 |
< |
|
227 |
> |
if( ctrl.mc ) { |
228 |
> |
cout << "--------------" << endl; |
229 |
> |
cout << "denom: " << count << endl; |
230 |
> |
cout << "pass: " << pass << endl; |
231 |
> |
cout << "axe: " << (float)pass/count << endl; |
232 |
> |
cout << "--------------" << endl; |
233 |
> |
} |
234 |
|
|
235 |
|
delete info; |
236 |
|
delete electronArr; |
241 |
|
//-------------------------------------------------------------------------------------------------------------- |
242 |
|
// Save Histograms; |
243 |
|
//============================================================================================================== |
244 |
< |
const char * ofname; |
245 |
< |
if( strcmp( ctrl.outputfile.c_str(), "") ) { |
246 |
< |
ofname = ctrl.outputfile.c_str(); |
247 |
< |
} else { |
248 |
< |
ofname = "tmp.root"; |
249 |
< |
} |
244 |
> |
// const char * ofname; |
245 |
> |
// if( strcmp( ctrl.outputfile.c_str(), "") ) { |
246 |
> |
// ofname = ctrl.outputfile.c_str(); |
247 |
> |
// } else { |
248 |
> |
// ofname = "tmp.root"; |
249 |
> |
// } |
250 |
|
|
251 |
< |
TFile *file = new TFile(ofname, "RECREATE"); |
251 |
> |
// TFile *file = new TFile(ofname, "RECREATE"); |
252 |
> |
gROOT->cd(file->GetPath()); |
253 |
|
h_evt->Write(); |
254 |
|
h_evtfail->Write(); |
255 |
|
passtuple->Write(); |