1 |
|
#include "Selection.h" |
2 |
|
#include "PassHLT.h" |
3 |
+ |
|
4 |
+ |
#include "SiMVAElectronSelection.h" |
5 |
+ |
|
6 |
|
#include "HZZCiCElectronSelection.h" |
7 |
+ |
#include "HZZLikelihoodElectronSelection.h" |
8 |
+ |
#include "HZZBDTElectronSelection.h" |
9 |
|
#include "RunLumiRangeMap.h" |
10 |
|
|
11 |
|
RunLumiRangeMap rlrm; |
12 |
|
|
13 |
+ |
unsigned getGenChannel(mithep::TGenInfo * ginfo) { |
14 |
+ |
int gchannel=-1; |
15 |
+ |
if( abs(ginfo->id_1_a) == EGenType::kElectron && abs(ginfo->id_1_b) == EGenType::kElectron ) gchannel=0; |
16 |
+ |
else if( abs(ginfo->id_1_a) == EGenType::kMuon && abs(ginfo->id_1_b) == EGenType::kMuon ) gchannel=1; |
17 |
+ |
else if( (abs(ginfo->id_1_a) == EGenType::kElectron && abs(ginfo->id_1_b) == EGenType::kMuon) || |
18 |
+ |
(abs(ginfo->id_1_a) == EGenType::kMuon && abs(ginfo->id_1_b) == EGenType::kElectron) ) gchannel=2; |
19 |
+ |
|
20 |
+ |
return gchannel; |
21 |
+ |
}; |
22 |
+ |
|
23 |
+ |
|
24 |
|
void initRunLumiRangeMap() { |
25 |
|
rlrm.AddJSONFile(std::string("./data/Cert_136033-149442_7TeV_Apr21ReReco_Collisions10_JSON.txt")); |
26 |
< |
rlrm.AddJSONFile(std::string("./data/Cert_160404-173244_7TeV_PromptReco_Collisions11_JSON_v2.txt")); |
26 |
> |
// rlrm.AddJSONFile(std::string("./data/Cert_160404-173244_7TeV_PromptReco_Collisions11_JSON_v2.txt")); |
27 |
> |
rlrm.AddJSONFile(std::string("./data/Cert_160404-178078_7TeV_PromptReco_Collisions11_JSON.txt")); |
28 |
|
rlrm.AddJSONFile(std::string("./data/Cert_160404-163869_7TeV_May10ReReco_Collisions11_JSON_v3.txt")); |
29 |
|
rlrm.AddJSONFile(std::string("./data/Cert_170249-172619_7TeV_ReReco5Aug_Collisions11_JSON.txt")); |
30 |
|
}; |
34 |
|
TClonesArray *electronArr, // input electrons |
35 |
|
TClonesArray *muonArr, // input muons |
36 |
|
double eventweight, // weight |
37 |
< |
TNtuple * passtuple ) { |
37 |
> |
TTree * passtuple ) { |
38 |
|
|
39 |
< |
fails_HZZ4L_selection( ctrl, info, electronArr, muonArr, eventweight, passtuple, NULL ); |
39 |
> |
fails_HZZ4L_selection( ctrl, NULL, info, electronArr, muonArr, eventweight, passtuple, NULL ); |
40 |
|
|
41 |
|
}; |
42 |
|
|
43 |
+ |
|
44 |
+ |
|
45 |
|
unsigned fails_HZZ4L_selection(ControlFlags &ctrl, // input control |
46 |
|
mithep::TEventInfo *info, // input event inof |
47 |
|
TClonesArray *electronArr, // input electrons |
49 |
|
double eventweight, // weight |
50 |
|
LabVectors *l ) { |
51 |
|
|
52 |
< |
fails_HZZ4L_selection( ctrl, info, electronArr, muonArr, eventweight, NULL, l ); |
52 |
> |
fails_HZZ4L_selection( ctrl, NULL, info, electronArr, muonArr, eventweight, NULL, l ); |
53 |
|
|
54 |
|
}; |
55 |
|
|
56 |
|
|
57 |
|
unsigned fails_HZZ4L_selection(ControlFlags &ctrl, // input control |
58 |
< |
mithep::TEventInfo *info, // input event inof |
58 |
> |
mithep::TGenInfo *ginfo , // input gen info |
59 |
> |
mithep::TEventInfo *info, // input event info |
60 |
|
TClonesArray *electronArr, // input electrons |
61 |
|
TClonesArray *muonArr, // input muons |
62 |
|
double eventweight, // weight |
63 |
< |
TNtuple * passtuple, |
64 |
< |
LabVectors * l ) { // output ntuple |
63 |
> |
TTree * passtuple ) { |
64 |
> |
|
65 |
> |
fails_HZZ4L_selection( ctrl, ginfo, info, electronArr, muonArr, eventweight, passtuple, NULL ); |
66 |
> |
|
67 |
> |
}; |
68 |
> |
|
69 |
> |
|
70 |
> |
unsigned fails_HZZ4L_selection(ControlFlags &ctrl, // input control |
71 |
> |
mithep::TGenInfo *ginfo, // input gen info |
72 |
> |
mithep::TEventInfo *info, // input event info |
73 |
> |
TClonesArray *electronArr, // input electrons |
74 |
> |
TClonesArray *muonArr, // input muons |
75 |
> |
double eventweight, // weight |
76 |
> |
TTree * passtuple, |
77 |
> |
LabVectors * l) { // output ntuple |
78 |
|
|
79 |
|
unsigned evtfail = 0x0; |
80 |
+ |
unsigned gchannel=0xdeaddead; |
81 |
+ |
|
82 |
+ |
if( ctrl.mc && ginfo != NULL ) { |
83 |
+ |
gchannel = getGenChannel(ginfo); |
84 |
+ |
} |
85 |
+ |
|
86 |
+ |
|
87 |
+ |
if( ctrl.debug ) { |
88 |
+ |
cout << "Run: " << info->runNum |
89 |
+ |
<< "\tEvt: " << info->evtNum |
90 |
+ |
<< "\tLumi: " << info->lumiSec |
91 |
+ |
<< endl; |
92 |
+ |
} |
93 |
|
|
94 |
|
if( !ctrl.mc ) { |
95 |
|
// not accounting for overlap atm |
96 |
|
RunLumiRangeMap::RunLumiPairType rl(info->runNum, info->lumiSec); |
97 |
|
if( !(rlrm.HasRunLumi(rl)) ) { |
98 |
+ |
if( ctrl.debug ) cout << "\tfails JSON" << endl; |
99 |
|
evtfail |= (1<<EVTFAIL_JSON); |
100 |
|
return evtfail; |
101 |
|
} |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
< |
if( ctrl.debug ) { |
59 |
< |
cout << "Run: " << info->runNum |
60 |
< |
<< "\tEvt: " << info->evtNum |
61 |
< |
<< "\tLumi: " << info->lumiSec |
62 |
< |
<< endl; |
63 |
< |
} |
105 |
> |
|
106 |
|
|
107 |
|
|
108 |
|
//******************************************************** |
135 |
|
vector<SimpleLepton> lepvec; |
136 |
|
|
137 |
|
// |
138 |
< |
cout << "\tnMuons: " << muonArr->GetEntries() << endl; |
138 |
> |
if( ctrl.debug ) cout << "\tnMuons: " << muonArr->GetEntries() << endl; |
139 |
|
//---------------------------------------------------- |
140 |
|
for(Int_t i=0; i<muonArr->GetEntries(); i++) { |
141 |
|
const mithep::TMuon *mu = (mithep::TMuon*)((*muonArr)[i]); |
142 |
< |
unsigned muonfail = passMuonSelectionZZ(mu); |
142 |
> |
unsigned muonfail; |
143 |
> |
if( ctrl.muSele == "ksWW" ) |
144 |
> |
muonfail = passMuonSelection(mu); |
145 |
> |
else |
146 |
> |
muonfail = passMuonSelectionZZ(mu); |
147 |
|
if( ctrl.debug ) { |
148 |
|
cout << "muon:: pt: " << mu->pt |
149 |
|
<< "\teta: " << mu->eta |
162 |
|
tmplep.isoTrk = mu->trkIso03; |
163 |
|
tmplep.isoEcal = mu->emIso03; |
164 |
|
tmplep.isoHcal = mu->hadIso03; |
165 |
+ |
tmplep.isoPF03 = mu->pfIso03; |
166 |
+ |
tmplep.isoPF04 = mu->pfIso04; |
167 |
|
tmplep.ip3dSig = mu->ip3dSig; |
168 |
|
tmplep.is4l = false; |
169 |
|
tmplep.isEB = (fabs(mu->eta) < 1.479 ? 1 : 0 ); |
172 |
|
} |
173 |
|
} |
174 |
|
|
127 |
– |
// |
175 |
|
if( ctrl.debug ) { cout << "\tnElectron: " << electronArr->GetEntries() << endl; } |
176 |
+ |
|
177 |
|
//---------------------------------------------------- |
178 |
|
for(Int_t i=0; i<electronArr->GetEntries(); i++) { |
179 |
|
const mithep::TElectron *ele = (mithep::TElectron*)((*electronArr)[i]); |
183 |
|
TVector3 tmplep; |
184 |
|
tmplep.SetPtEtaPhi(ele->pt, ele->eta, ele->phi); |
185 |
|
if ( lepvec[k].type == 13 && lepvec[k].vec.Vect().DrEtaPhi(tmplep) < 0.1 ) { |
186 |
< |
cout << "-----> isMuonOverlap! " << endl; |
186 |
> |
if( ctrl.debug ) cout << "-----> isMuonOverlap! " << endl; |
187 |
|
isMuonOverlap = kTRUE; |
188 |
|
break; |
189 |
|
} |
190 |
|
} |
191 |
|
|
192 |
< |
CICStruct tightcuts = getTightCuts(); |
193 |
< |
unsigned failsCIC = failsCicSelection(ele, tightcuts); |
192 |
> |
unsigned FAIL=0, isEleTight=0; |
193 |
> |
|
194 |
> |
unsigned failsCIC=0; |
195 |
> |
CICStruct ciccuts_tight, ciccuts_medium, ciccuts_loose; |
196 |
> |
if(ctrl.eleSele=="cic") { |
197 |
> |
if( ctrl.eleSeleScheme == "mediumloose" ) { |
198 |
> |
ciccuts_medium = getCiCCuts("medium"); |
199 |
> |
unsigned failsCICMedium = failsCicSelection(ctrl, ele, ciccuts_medium, ctrl.kinematics); |
200 |
> |
ciccuts_loose = getCiCCuts("loose"); |
201 |
> |
unsigned failsCICLoose = failsCicSelection(ctrl, ele, ciccuts_loose, ctrl.kinematics); |
202 |
> |
failsCIC = ( failsCICLoose > 0 && failsCICMedium > 0 ); |
203 |
> |
if( !failsCICMedium ) isEleTight=1; |
204 |
> |
} |
205 |
> |
else { |
206 |
> |
ciccuts_tight = getCiCCuts(ctrl.eleSeleScheme); |
207 |
> |
failsCIC = failsCicSelection(ctrl, ele, ciccuts_tight, ctrl.kinematics); |
208 |
> |
if( !failsCIC ) isEleTight=1; |
209 |
> |
} |
210 |
> |
FAIL = failsCIC; |
211 |
> |
} |
212 |
> |
|
213 |
> |
LikStruct likcuts; |
214 |
> |
unsigned failsLike=0; |
215 |
> |
if(ctrl.eleSele=="lik") { |
216 |
> |
likcuts = getLikCuts(ctrl.eleSeleScheme); |
217 |
> |
failsLike = failsLikelihoodSelection(ele, likcuts, ctrl.kinematics); |
218 |
> |
FAIL = failsLike; |
219 |
> |
} |
220 |
> |
unsigned failsBDT=0; |
221 |
> |
if(ctrl.eleSele=="bdt") { |
222 |
> |
if( ctrl.eleSeleScheme == "mediumloose" ) { |
223 |
> |
unsigned failsBDTMedium = failsBDTSelection(ctrl,"medium",ele); |
224 |
> |
unsigned failsBDTLoose = failsBDTSelection(ctrl,"loose",ele); |
225 |
> |
failsBDT = ( failsBDTLoose > 0 && failsBDTMedium > 0 ); |
226 |
> |
if( !failsBDTMedium ) isEleTight=1; |
227 |
> |
} else { |
228 |
> |
failsBDT = failsBDTSelection(ctrl,"tight",ele); |
229 |
> |
if( !failsBDT ) isEleTight=1; |
230 |
> |
} |
231 |
> |
FAIL = failsBDT; |
232 |
> |
} |
233 |
> |
unsigned failsSi=0; |
234 |
> |
if(ctrl.eleSele=="si") { |
235 |
> |
failsSi = failsSiMVAElectronSelection(ctrl, ele, 0.95, ctrl.kinematics); |
236 |
> |
FAIL = failsSi; |
237 |
> |
} |
238 |
> |
|
239 |
> |
|
240 |
> |
|
241 |
> |
|
242 |
|
if( ctrl.debug ){ |
243 |
|
cout << "CIC category: " << cicCategory(ele) |
244 |
< |
<< "\tfailmask : 0x" << hex << failsCIC << dec |
244 |
> |
<< "\tlikelihood: " << ele->likelihood |
245 |
> |
<< "\tFAIL: 0x" << hex << FAIL << dec |
246 |
> |
<< "\tfailsCIC: 0x" << hex << failsCIC << dec |
247 |
> |
<< "\tfailsLike: 0x" << hex << failsLike << dec |
248 |
> |
<< "\tfailsBDT: 0x" << hex << failsBDT << dec |
249 |
|
<< "\tscEt: " << ele->scEt |
250 |
< |
<< "\tscEta: " << ele->scEta |
250 |
> |
<< "\tscEta: " << ele->scEta |
251 |
> |
<< "\tncluster: " << ele->ncluster |
252 |
|
<< endl; |
253 |
|
} |
254 |
< |
if ( !failsCIC && !isMuonOverlap ) { |
254 |
> |
if ( !FAIL && !isMuonOverlap ) { |
255 |
|
SimpleLepton tmplep; |
256 |
|
tmplep.vec.SetPtEtaPhiM( ele->pt, |
257 |
|
ele->eta, |
263 |
|
tmplep.isoTrk = ele->trkIso03; |
264 |
|
tmplep.isoEcal = ele->emIso03; |
265 |
|
tmplep.isoHcal = ele->hadIso03; |
266 |
+ |
tmplep.isoPF03 = ele->pfIso03; |
267 |
+ |
tmplep.isoPF04 = ele->pfIso04; |
268 |
|
tmplep.ip3dSig = ele->ip3dSig; |
269 |
|
tmplep.is4l = false; |
270 |
+ |
tmplep.isTight = isEleTight; |
271 |
|
tmplep.isEB = ele->isEB; |
272 |
|
lepvec.push_back(tmplep); |
273 |
|
if( ctrl.debug ) { cout << "\telectron passes ... " << endl; } |
318 |
|
} |
319 |
|
|
320 |
|
float tmpZ1Mass = (leptonPlus+leptonMinus).M(); |
321 |
< |
cout << "Z1 selection, tmpZ1Mass: " << tmpZ1Mass << endl; |
321 |
> |
if( ctrl.debug ) cout << "Z1 selection, tmpZ1Mass: " << tmpZ1Mass << endl; |
322 |
|
if( tmpZ1Mass > 60 ) { |
323 |
|
if (fabs(tmpZ1Mass - 91.1876) < fabs(BestZ1Mass - 91.1876)) { |
324 |
|
BestZ1Mass = tmpZ1Mass; |
325 |
< |
cout << "Z1 selection, new BestZ1Mass: " << BestZ1Mass |
325 |
> |
if( ctrl.debug ) cout << "Z1 selection, new BestZ1Mass: " << BestZ1Mass |
326 |
|
<< "\tdM: " << fabs(BestZ1Mass - 91.1876) |
327 |
|
<< endl; |
328 |
|
if (lepvec[i].charge > 0) { |
341 |
|
evtfail |= (1<<EVTFAIL_Z1); |
342 |
|
return evtfail; |
343 |
|
} |
344 |
< |
cout << "\tgot a Z1 ... run: " << info->runNum << "\tevt: " << info->evtNum << endl; |
345 |
< |
cout << "\tZ1 plusindex: " << Z1LeptonPlusIndex << "\tminusindex: " << Z1LeptonMinusIndex << endl; |
344 |
> |
if( ctrl.debug ) cout << "\tgot a Z1 ... run: " << info->runNum << "\tevt: " << info->evtNum << endl; |
345 |
> |
if( ctrl.debug ) cout << "\tZ1 plusindex: " << Z1LeptonPlusIndex << "\tminusindex: " << Z1LeptonMinusIndex << endl; |
346 |
|
TLorentzVector Z1LeptonPlus = lepvec[Z1LeptonPlusIndex].vec; |
347 |
|
TLorentzVector Z1LeptonMinus = lepvec[Z1LeptonMinusIndex].vec; |
348 |
|
TLorentzVector Z1Candidate = Z1LeptonPlus + Z1LeptonMinus; |
366 |
|
Int_t Z2LeptonPlusIndex = -1; |
367 |
|
Int_t Z2LeptonMinusIndex = -1; |
368 |
|
Double_t BestZ2Mass = -1; |
369 |
< |
cout << "looking for a Z2 ... out of " << lepvec.size() << " leptons" <<endl; |
369 |
> |
if( ctrl.debug ) cout << "looking for a Z2 ... out of " << lepvec.size() << " leptons" <<endl; |
370 |
|
for(int i = 0; i < lepvec.size(); ++i) { |
371 |
+ |
if( abs(lepvec[i].type) == 11 && |
372 |
+ |
ctrl.eleSeleScheme == "mediumloose" && |
373 |
+ |
!(lepvec[i].isTight) ) continue; |
374 |
+ |
|
375 |
|
for(int j = i+1; j < lepvec.size(); ++j) { |
376 |
+ |
if( abs(lepvec[j].type) == 11 && |
377 |
+ |
ctrl.eleSeleScheme == "mediumloose" && |
378 |
+ |
!(lepvec[j].isTight) ) continue; |
379 |
+ |
|
380 |
|
// cout << "i: " << i << "\tj: " << j << endl; |
381 |
|
if (i == Z1LeptonPlusIndex || i == Z1LeptonMinusIndex) { |
382 |
|
// cout << "\ti matches a Z1 index, skipping ..." << endl; |
410 |
|
TLorentzVector dilepton = leptonPlus+leptonMinus; |
411 |
|
TLorentzVector fourLepton = Z1Candidate + dilepton; |
412 |
|
|
413 |
< |
cout << "dilepton.M() : " << dilepton.M() << endl; |
414 |
< |
cout << "fourLepton.M() : " << fourLepton.M() << endl; |
413 |
> |
if( ctrl.debug ) cout << "dilepton.M() : " << dilepton.M() << endl; |
414 |
> |
if( ctrl.debug ) cout << "fourLepton.M() : " << fourLepton.M() << endl; |
415 |
|
|
416 |
|
if (!(dilepton.M() > 12.0)) continue; |
417 |
|
if (!(fourLepton.M() > 100.0)) continue; |
418 |
|
|
419 |
< |
|
419 |
> |
/* |
420 |
|
//for 4e and 4mu, require at least 1 of the other opp sign lepton pairs have mass > 12 |
421 |
|
if (fabs(lepvec[i].type) == fabs(lepvec[Z1LeptonPlusIndex].type)) { |
422 |
|
TLorentzVector pair1 = Z1LeptonPlus+leptonMinus; |
423 |
|
TLorentzVector pair2 = Z1LeptonMinus+leptonPlus; |
424 |
< |
cout << "pair1: " << pair1.M() << "\tpair2: "<< pair2.M() << endl; |
424 |
> |
if( ctrl.debug ) cout << "pair1: " << pair1.M() << "\tpair2: "<< pair2.M() << endl; |
425 |
|
if (!(pair1.M() > 12 || pair2.M() > 12)) continue; |
426 |
|
} |
427 |
< |
|
427 |
> |
*/ |
428 |
> |
|
429 |
|
//Disambiguiation is done by choosing the pair with the largest ptMax and largest ptMin |
430 |
|
if (Z2LeptonPlusIndex < 0) { |
431 |
|
if (lepvec[i].charge > 0) { |
481 |
|
// cout << "evtfail: " << hex << evtfail << dec << endl; |
482 |
|
// continue; |
483 |
|
} |
484 |
< |
cout << "\tgot a Z2 ..." << endl; |
485 |
< |
cout << "\tZ2 plusindex: " << Z2LeptonPlusIndex << "\tminusindex: " << Z2LeptonMinusIndex << endl; |
484 |
> |
if( ctrl.debug ) cout << "\tgot a Z2 ..." << endl; |
485 |
> |
if( ctrl.debug ) cout << "\tZ2 plusindex: " << Z2LeptonPlusIndex |
486 |
> |
<< "\tminusindex: " << Z2LeptonMinusIndex << endl; |
487 |
|
TLorentzVector Z2LeptonPlus = lepvec[Z2LeptonPlusIndex].vec; |
488 |
|
TLorentzVector Z2LeptonMinus = lepvec[Z2LeptonMinusIndex].vec; |
489 |
|
TLorentzVector Z2Candidate = Z2LeptonPlus+Z2LeptonMinus; |
504 |
|
//*************************************************************** |
505 |
|
bool failiso=false; |
506 |
|
|
507 |
< |
/* |
394 |
< |
int i,j; |
395 |
< |
i=Z1LeptonPlusIndex; |
396 |
< |
j=Z1LeptonMinusIndex; |
397 |
< |
float RIso1 = (lepvec[i].isoTrk+lepvec[i].isoEcal+lepvec[i].isoHcal)/lepvec[i].vec.Pt(); |
398 |
< |
float RIso2 = (lepvec[j].isoTrk+lepvec[j].isoEcal+lepvec[j].isoHcal)/lepvec[j].vec.Pt(); |
399 |
< |
float comboIso12 = RIso1 + RIso2; |
400 |
< |
i=Z2LeptonPlusIndex; |
401 |
< |
j=Z2LeptonMinusIndex; |
402 |
< |
float RIso3 = (lepvec[i].isoTrk+lepvec[i].isoEcal+lepvec[i].isoHcal)/lepvec[i].vec.Pt(); |
403 |
< |
float RIso4 = (lepvec[j].isoTrk+lepvec[j].isoEcal+lepvec[j].isoHcal)/lepvec[j].vec.Pt(); |
404 |
< |
float comboIso34 = RIso3 + RIso4; |
405 |
< |
if( comboIso12 > 0.35 || comboIso34 > 0.35 ) { |
406 |
< |
failiso = true; |
407 |
< |
} |
408 |
< |
*/ |
507 |
> |
if( ctrl.isoScheme == "pf" ) { |
508 |
|
|
509 |
< |
float rho = info->rho; |
510 |
< |
for( int i=0; i<lepvec.size(); i++ ) { |
511 |
< |
if( !(lepvec[i].is4l) ) continue; |
509 |
> |
for( int i=0; i<lepvec.size(); i++ ) { |
510 |
> |
|
511 |
> |
if( !(lepvec[i].is4l) ) continue; |
512 |
> |
|
513 |
> |
if( abs(lepvec[i].type) == 11 ) { |
514 |
> |
float reliso = lepvec[i].isoPF04/lepvec[i].vec.Pt(); |
515 |
> |
if( lepvec[i].isEB && lepvec[i].vec.Pt() > 20 && reliso > PFISO_ELE_LOOSE_EB_HIGHPT ) { |
516 |
> |
failiso = true; |
517 |
> |
break; |
518 |
> |
} |
519 |
> |
if( lepvec[i].isEB && lepvec[i].vec.Pt() < 20 && reliso > PFISO_ELE_LOOSE_EB_LOWPT ) { |
520 |
> |
failiso = true; |
521 |
> |
break; |
522 |
> |
} |
523 |
> |
if( !(lepvec[i].isEB) && lepvec[i].vec.Pt() > 20 && reliso > PFISO_ELE_LOOSE_EE_HIGHPT ) { |
524 |
> |
failiso = true; |
525 |
> |
break; |
526 |
> |
} |
527 |
> |
if( !(lepvec[i].isEB) && lepvec[i].vec.Pt() < 20 && reliso > PFISO_ELE_LOOSE_EE_LOWPT ) { |
528 |
> |
failiso = true; |
529 |
> |
break; |
530 |
> |
} |
531 |
> |
} |
532 |
> |
|
533 |
> |
if( abs(lepvec[i].type) == 13 ) { |
534 |
> |
|
535 |
> |
float reliso = lepvec[i].isoPF03/lepvec[i].vec.Pt(); |
536 |
> |
if( lepvec[i].isEB && lepvec[i].vec.Pt() > 20 && reliso > PFISO_MU_LOOSE_EB_HIGHPT ) { //0.13 |
537 |
> |
failiso = true; |
538 |
> |
break; |
539 |
> |
} |
540 |
> |
if( lepvec[i].isEB && lepvec[i].vec.Pt() < 20 && reliso > PFISO_MU_LOOSE_EB_LOWPT ) { //0.06 |
541 |
> |
failiso = true; |
542 |
> |
break; |
543 |
> |
} |
544 |
> |
if( !(lepvec[i].isEB) && lepvec[i].vec.Pt() > 20 && reliso > PFISO_MU_LOOSE_EE_HIGHPT ) { //0.09 |
545 |
> |
failiso = true; |
546 |
> |
break; |
547 |
> |
} |
548 |
> |
if( !(lepvec[i].isEB) && lepvec[i].vec.Pt() < 20 && reliso > PFISO_MU_LOOSE_EE_LOWPT ) { //0.05 |
549 |
> |
failiso = true; |
550 |
> |
break; |
551 |
> |
} |
552 |
> |
} |
553 |
> |
} |
554 |
> |
} else if ( ctrl.isoScheme == "pairwise" ) { |
555 |
> |
float rho = info->rho; |
556 |
> |
for( int i=0; i<lepvec.size(); i++ ) { |
557 |
> |
if( !(lepvec[i].is4l) ) continue; |
558 |
|
float effArea_ecal_i, effArea_hcal_i; |
559 |
|
if( lepvec[i].isEB ) { |
560 |
|
if( lepvec[i].type == 11 ) { |
625 |
|
cout.flush(); |
626 |
|
} |
627 |
|
if( comboIso > 0.35 ) { |
628 |
< |
cout << "combo failing for indices: " << i << "," << j << endl; |
628 |
> |
if( ctrl.debug ) cout << "combo failing for indices: " << i << "," << j << endl; |
629 |
|
failiso = true; |
630 |
|
// break; |
631 |
|
} |
632 |
|
} |
633 |
+ |
} |
634 |
|
} |
635 |
+ |
|
636 |
+ |
|
637 |
|
if( failiso ) { |
638 |
|
evtfail |= ( 1<<EVTFAIL_ISOLATION ); |
639 |
|
return evtfail; |
666 |
|
//*************************************************************** |
667 |
|
// remaining kinematic cuts |
668 |
|
//*************************************************************** |
669 |
< |
if ( Z1Candidate.M() > 120 || |
670 |
< |
Z2Candidate.M() < 20 || |
671 |
< |
Z2Candidate.M() > 120 || |
669 |
> |
double Z2massCut=0; |
670 |
> |
if ( ctrl.kinematics == "loose" ) Z2massCut = 12; |
671 |
> |
else if ( ctrl.kinematics == "tight" ) Z2massCut = 20; |
672 |
> |
else { cout << "error! kinematic tightness not defined!" << endl; assert(0); } |
673 |
> |
|
674 |
> |
if ( Z1Candidate.M() > 120 || |
675 |
> |
Z2Candidate.M() < Z2massCut || |
676 |
> |
Z2Candidate.M() > 120 || |
677 |
|
!(lepvec[Z1LeptonPlusIndex].vec.Pt() > 20.0 || lepvec[Z1LeptonMinusIndex].vec.Pt() > 20.0) || |
678 |
|
!(lepvec[Z1LeptonPlusIndex].vec.Pt() > 10.0 && lepvec[Z1LeptonMinusIndex].vec.Pt() > 10.0) |
679 |
|
) { |
685 |
|
// continue; |
686 |
|
} |
687 |
|
|
688 |
< |
int channel; |
688 |
> |
unsigned channel; |
689 |
|
if( lepvec[Z1LeptonMinusIndex].type == 11 && lepvec[Z2LeptonMinusIndex].type == 11 ) channel=0; |
690 |
|
if( lepvec[Z1LeptonMinusIndex].type == 13 && lepvec[Z2LeptonMinusIndex].type == 13 ) channel=1; |
691 |
|
if( (lepvec[Z1LeptonMinusIndex].type == 11 && lepvec[Z2LeptonMinusIndex].type == 13) || |
692 |
|
(lepvec[Z1LeptonMinusIndex].type == 13 && lepvec[Z2LeptonMinusIndex].type == 11)) channel=2; |
693 |
|
|
694 |
|
|
695 |
< |
|
695 |
> |
|
696 |
|
if( passtuple != NULL ) { |
697 |
< |
passtuple->Fill( info->runNum, |
698 |
< |
info->evtNum, |
699 |
< |
info->lumiSec, |
700 |
< |
channel, |
701 |
< |
Z1Candidate.M(), |
702 |
< |
Z2Candidate.M(), |
703 |
< |
ZZSystem.M(), |
704 |
< |
ZZSystem.Pt(), |
705 |
< |
eventweight); |
697 |
> |
unsigned run = info->runNum; |
698 |
> |
unsigned evt = info->evtNum; |
699 |
> |
unsigned lumi = info->lumiSec; |
700 |
> |
unsigned chan = channel; |
701 |
> |
double w = eventweight; |
702 |
> |
float mZ1 = Z1Candidate.M() ; |
703 |
> |
float mZ2 = Z2Candidate.M() ; |
704 |
> |
float m4l = ZZSystem.M() ; |
705 |
> |
float pt4l = ZZSystem.Pt() ; |
706 |
> |
unsigned tZ1 = abs(lepvec[Z1LeptonMinusIndex].type); |
707 |
> |
unsigned tZ2 = abs(lepvec[Z2LeptonMinusIndex].type); |
708 |
> |
passtuple->SetBranchAddress("channel", &channel); |
709 |
> |
passtuple->SetBranchAddress("run", &run); |
710 |
> |
passtuple->SetBranchAddress("evt", &evt); |
711 |
> |
passtuple->SetBranchAddress("lumi", &lumi); |
712 |
> |
passtuple->SetBranchAddress("mZ1", &mZ1); |
713 |
> |
passtuple->SetBranchAddress("mZ2", &mZ2); |
714 |
> |
passtuple->SetBranchAddress("tZ1", &tZ1); |
715 |
> |
passtuple->SetBranchAddress("tZ2", &tZ2); |
716 |
> |
passtuple->SetBranchAddress("m4l", &m4l); |
717 |
> |
passtuple->SetBranchAddress("pt4l", &pt4l); |
718 |
> |
passtuple->SetBranchAddress("w", &w); |
719 |
> |
if( ctrl.mc ) passtuple->SetBranchAddress("gchannel", &gchannel); |
720 |
> |
passtuple->Fill( ); |
721 |
|
} |
722 |
|
|
723 |
< |
cout << "run: " << info->runNum |
723 |
> |
if( ctrl.debug ) cout << "run: " << info->runNum |
724 |
|
<< "\tevt: " << info->evtNum |
725 |
|
<< "\tZ1channel: " << lepvec[Z1LeptonMinusIndex].type |
726 |
|
<< "\tZ2channel: " << lepvec[Z2LeptonMinusIndex].type |