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", 100, 0, 100 ); |
100 |
< |
TNtuple * passtuple = new TNtuple( "passtuple", "passtuple", "run:evt:lumi:channel:mZ1:mZ2:m4l:pt4l:w" ); |
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 |
> |
TTree * passtuple = new TTree("passtuple", "passtuple" ); |
102 |
> |
unsigned run, evt, lumi, channel; |
103 |
> |
float mZ1, mZ2, m4l, pt4l; |
104 |
> |
double w; |
105 |
> |
passtuple->Branch("run", &run); |
106 |
> |
passtuple->Branch("evt", &evt); |
107 |
> |
passtuple->Branch("lumi", &lumi); |
108 |
> |
passtuple->Branch("mZ1", &mZ1); |
109 |
> |
passtuple->Branch("mZ2", &mZ2); |
110 |
> |
passtuple->Branch("m4l", &m4l); |
111 |
> |
passtuple->Branch("pt4l", &pt4l); |
112 |
> |
passtuple->Branch("w", &w); |
113 |
|
initCiCSelection(); |
114 |
+ |
if(ctrl.eleSele=="lik") initLikSelection(); |
115 |
+ |
if(ctrl.eleSele=="bdt") initBDTSelection(); |
116 |
|
initRunLumiRangeMap(); |
117 |
|
|
99 |
– |
|
118 |
|
// |
119 |
|
// Loop |
120 |
|
//-------------------------------------------------------------------------------------------------------------- |
146 |
|
|
147 |
|
|
148 |
|
cout << "nEntries: " << chain->GetEntries() << endl; |
149 |
< |
for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) { |
150 |
< |
|
149 |
> |
for(UInt_t ientry=0; ientry<chain->GetEntries(); ientry++) { |
150 |
> |
|
151 |
|
chain->GetEntry(ientry); |
152 |
+ |
if(!(ientry%100000)) cout << "entry: " << ientry << endl; |
153 |
|
|
154 |
|
// get event weight for this file |
155 |
< |
double xs=1,eventweight=1; |
156 |
< |
if(ctrl.mc) eventweight = xstab.Get(getname(chain).c_str()) / chain->GetEntries(); |
155 |
> |
double eventweight=1; |
156 |
> |
if(ctrl.mc) eventweight = getWeight(xstab,entrymap,chain); |
157 |
|
|
158 |
|
#ifdef THEIR_EVENTS |
159 |
|
if( !( info->evtNum == 504867308 || |
180 |
|
info->evtNum == 107360878 ) ) continue; |
181 |
|
#endif |
182 |
|
|
183 |
< |
unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple ); |
183 |
> |
unsigned evtfail = fails_HZZ4L_selection(ctrl, info, electronArr, muonArr, eventweight, passtuple); |
184 |
|
h_evtfail->Fill( evtfail, eventweight ); |
185 |
< |
cout << endl << endl; |
185 |
> |
if( ctrl.debug ) cout << endl << endl; |
186 |
|
|
187 |
|
} //end loop over data |
188 |
|
|
211 |
|
file->Close(); |
212 |
|
delete file; |
213 |
|
|
214 |
+ |
// map<TString,TMVA::Reader*>::iterator it; |
215 |
+ |
// for(it=readers.begin(); it!=readers.end(); it++) delete (*it).second; |
216 |
+ |
|
217 |
|
cerr << "done!" << endl; |
218 |
|
} |
219 |
|
|