ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Selection/src/ReferenceSelection.cc
Revision: 1.20
Committed: Fri Oct 19 18:14:53 2012 UTC (12 years, 7 months ago) by anlevin
Content type: text/plain
Branch: MAIN
Changes since 1.19: +13 -14 lines
Log Message:
updates for sync on 2012 data

File Contents

# Content
1
2 //***************************************************************************************************
3 //
4 // selection sync'ed with https://twiki.cern.ch/twiki/bin/viewauth/CMS/HiggsZZ4l2012SummerSync
5 //
6 //***************************************************************************************************
7
8 // system headers
9 #include <map>
10 #include <utility>
11
12 // mit headers
13 #include "Vertex.h"
14
15 // 4L stuff
16 #include "SelectionStatus.h"
17 #include "EventData.h"
18 #include "SimpleLepton.h"
19 #include "EfficiencyWeightsInterface.h"
20 #include "ElectronSelection.h"
21 #include "MuonSelection.h"
22 #include "IsolationSelection.h"
23 #include "ReferenceSelection.h"
24 #include "Selection.h"
25 #include "CommonDefs.h"
26 #include "SelectionDefs.h"
27 #include "FSR.h"
28 #include "SelectionFuncs.h"
29 #include "ElectronMomentumCorrection.h"
30 #include "MuonMomentumCorrection.h"
31
32
33 extern vector<SimpleLepton> failingLeptons;
34 extern vector<SimpleLepton> passingLeptons;
35
36 extern vector<unsigned> cutvec;
37 extern vector<vector<unsigned> > zcutvec;
38 extern vector<vector<unsigned> > zzcutvec;
39 extern map<unsigned,float> evtrhoMap;
40 extern bool passes_HLT;
41 extern map<TString, map<TString,int>* > counts;
42
43 //
44 // prototypes
45 //--------------------------------------------------------------------------------------------------
46 void updateSimpleLepton(SimpleLepton &tmplep);
47 void fillVetoArrays( ControlFlags & ctrl,
48 const mithep::Array<mithep::Muon> *muonArr,
49 vector< const mithep::Muon*> & muonsToVeto,
50 const mithep::Array<mithep::Electron> *electronArr,
51 vector< const mithep::Electron*> & electronsToVeto,
52 const mithep::Vertex * vtx ) ;
53 //--------------------------------------------------------------------------------------------------
54 void increment(TString cutName, int z1type=0, int z2type=0)
55 {
56 assert(counts.find(cutName) != counts.end());
57 (*(counts[cutName]))["all"] ++;
58 if(z1type!=0 && z2type!=0) {
59 assert(counts.find(cutName) != counts.end());
60 (*(counts[cutName]))[getChannel(z1type,z2type)] ++;
61 }
62 }
63
64 //--------------------------------------------------------------------------------------------------
65 EventData apply_HZZ4L_reference_selection(ControlFlags &ctrl, // input control
66 const mithep::EventHeader *info, // input event info
67 const mithep::Array<mithep::Vertex> * vtxArr ,
68 const mithep::Array<mithep::PFCandidate> *pfCandidates,
69 const mithep::Array<mithep::PileupEnergyDensity> *puEnergyDensity,
70 const mithep::Array<mithep::Electron> *electronArr, // input electrons
71 SelectionStatus (*ElectronPreSelector)( ControlFlags &,
72 const mithep::Electron*,
73 const mithep::Vertex *),
74 SelectionStatus (*ElectronIDSelector)( ControlFlags &,
75 const mithep::Electron*,
76 const mithep::Vertex *),
77 SelectionStatus (*ElectronIsoSelector)( ControlFlags &,
78 const mithep::Electron*,
79 const mithep::Vertex *,
80 const mithep::Array<mithep::PFCandidate> *,
81 const mithep::Array<mithep::PileupEnergyDensity> *,
82 mithep::ElectronTools::EElectronEffectiveAreaTarget,
83 vector<const mithep::PFCandidate*>),
84 const mithep::Array<mithep::Muon> *muonArr, // input muons
85 SelectionStatus (*MuonPreSelector)( ControlFlags &,
86 const mithep::Muon*,
87 const mithep::Vertex *,
88 const mithep::Array<mithep::PFCandidate> *),
89 SelectionStatus (*MuonIDSelector)( ControlFlags &,
90 const mithep::Muon*,
91 // const mithep::Vertex &),
92 const mithep::Vertex *,
93 const mithep::Array<mithep::PFCandidate> *),
94 SelectionStatus (*MuonIsoSelector)( ControlFlags &,
95 const mithep::Muon*,
96 const mithep::Vertex *,
97 const mithep::Array<mithep::PFCandidate> *,
98 const mithep::Array<mithep::PileupEnergyDensity> *,
99 mithep::MuonTools::EMuonEffectiveAreaTarget,
100 vector<const mithep::PFCandidate*>)
101 )
102 //--------------------------------------------------------------------------------------------------
103 {
104
105 EventData ret;
106 unsigned evtfail = 0x0;
107 TRandom3 r;
108
109 failingLeptons.clear();
110 passingLeptons.clear();
111
112 mithep::MuonTools::EMuonEffectiveAreaTarget eraMu;
113 mithep::ElectronTools::EElectronEffectiveAreaTarget eraEle;
114 getEATargets(ctrl,eraMu,eraEle);
115
116 if( ctrl.debug ) {
117 cout << "presel nlep: " << muonArr->GetEntries() + electronArr->GetEntries()
118 << "\tnmuon: " << muonArr->GetEntries()
119 << "\tnelectron: " << electronArr->GetEntries()
120 << endl;
121 }
122
123 //correct muon momentum
124 if(ctrl.correct_muon_momentum){
125 for(int i=0; i<muonArr->GetEntries(); i++) {
126 const mithep::Muon *const_mu = (mithep::Muon*)((*muonArr)[i]);
127 mithep::Muon *mu = const_cast<mithep::Muon*>(const_mu);
128 correct_muon_momentum(ctrl, mu,info->RunNum());
129
130 }
131 }
132
133 // //********************************************************
134 // // Skim 0 :
135 // //********************************************************
136 // int nlep_above_10=0;
137 // int nlep_above_20=0;
138 // for(int i=0; i<muonArr->GetEntries(); i++)
139 // {
140 // const mithep::Muon *mu = (mithep::Muon*)((*muonArr)[i]);
141
142
143 // if( !(mu->IsTrackerMuon() || mu->IsGlobalMuon()) ) continue;
144 // if( fabs(mu->Eta()) > 2.4 ) continue;
145 // if( mu->Pt() > 10 ) nlep_above_10++;
146 // if( mu->Pt() > 20 ) nlep_above_20++;
147 // }
148 // for(int i=0; i<electronArr->GetEntries(); i++)
149 // {
150 // const mithep::Electron *ele = (mithep::Electron*)((*electronArr)[i]);
151 // if( fabs(ele->Eta()) > 2.5 ) continue;
152 // if( ele->Pt() > 10 ) nlep_above_10++;
153 // if( ele->Pt() > 20 ) nlep_above_20++;
154 // }
155 // if( (nlep_above_10 > 1 && nlep_above_20 > 0) ) {
156 ret.status.selectionBits.flip(PASS_SKIM0);
157 cutvec[PASS_SKIM0] +=1;
158 // } else {
159 // ret.status.setStatus(SelectionStatus::FAIL);
160 // return ret;
161 // }
162
163
164 // //********************************************************
165 // // Skim 0.1 : 1 SF pair with mLL > 40
166 // //********************************************************
167 // bool ossf_pair=false;
168 // for(int i=0; i<muonArr->GetEntries(); i++)
169 // {
170 // const mithep::Muon *mu1 = (mithep::Muon*)((*muonArr)[i]);
171 // if( !(mu1->IsTrackerMuon() || mu1->IsGlobalMuon()) ) continue;
172 // if( fabs(mu1->Eta()) > 2.4 ) continue;
173 // if( fabs(mu1->Pt()) < 3 ) continue;
174 // for(int j=i+1; j<muonArr->GetEntries(); j++)
175 // {
176 // const mithep::Muon *mu2 = (mithep::Muon*)((*muonArr)[j]);
177 // if( !(mu2->IsTrackerMuon() || mu2->IsGlobalMuon()) ) continue;
178 // if( fabs(mu2->Eta()) > 2.4 ) continue;
179 // if( fabs(mu2->Pt()) < 3 ) continue;
180 // TLorentzVector v1,v2;
181 // v1.SetPtEtaPhiM( mu1->Pt(), mu1->Eta(), mu1->Phi(), MUON_MASS);
182 // v2.SetPtEtaPhiM( mu2->Pt(), mu2->Eta(), mu2->Phi(), MUON_MASS);
183 // if( (v1+v2).M() >= 40) ossf_pair = true;
184 // }
185 // }
186 // for(int i=0; i<electronArr->GetEntries(); i++)
187 // {
188 // const mithep::Electron *el1 = (mithep::Electron*)((*electronArr)[i]);
189 // if( fabs(el1->Eta()) > 2.5 ) continue;
190 // if( el1->Pt() < 5 ) continue;
191 // for(int j=i+1; j<electronArr->GetEntries(); j++)
192 // {
193 // const mithep::Electron *el2 = (mithep::Electron*)((*electronArr)[j]);
194 // if( fabs(el2->Eta()) > 2.5 ) continue;
195 // if( el2->Pt() < 5 ) continue;
196 // TLorentzVector v1,v2;
197 // v1.SetPtEtaPhiM( el1->Pt(), el1->Eta(), el1->Phi(), ELECTRON_MASS);
198 // v2.SetPtEtaPhiM( el2->Pt(), el2->Eta(), el2->Phi(), ELECTRON_MASS);
199 // if( (v1+v2).M() >= 40 ) ossf_pair = true;
200 // }
201 // }
202
203 // if( ossf_pair ) {
204 ret.status.selectionBits.flip(PASS_SKIM1);
205 cutvec[PASS_SKIM1] +=1;
206 // } else {
207 // ret.status.setStatus(SelectionStatus::FAIL);
208 // return ret;
209 // }
210
211 const mithep::Vertex * vtx;
212 bool goodVertex = setPV( ctrl, vtxArr, vtx );
213 if(goodVertex) {
214 ret.status.selectionBits.flip(PASS_SKIM2);
215 cutvec[PASS_SKIM2] +=1;
216 } else {
217 if(ctrl.debug) cout << "found bad vertex" << endl;
218 ret.status.setStatus(SelectionStatus::FAIL);
219 return ret;
220 }
221 if(ctrl.debug) {
222 cerr << "vtx :: ntrks: " << vtx->NTracksFit() << endl;
223 cerr.flush();
224 }
225
226 //***********************************************************
227 // Trigger Selection
228 //***********************************************************
229 if( passes_HLT ) {
230 ret.status.selectionBits.flip(PASS_TRIGGER);
231 cutvec[PASS_TRIGGER] +=1;
232 increment("trigger");
233 } else {
234 ret.status.setStatus(SelectionStatus::FAIL);
235 if(ctrl.debug) cout << "fails trigger" << endl;
236 return ret;
237 }
238
239 //***********************************************************
240 // Lepton Selection
241 //***********************************************************
242 vector<SimpleLepton> lepvec;
243
244 // empty, reference is not applying additional vetos
245 // vector<const mithep::Muon*> muonsToVeto;
246 // vector<const mithep::Electron*> electronsToVeto;
247 // fillVetoArrays( ctrl, muonArr, muonsToVeto, electronArr, electronsToVeto, vtx );
248 vector<const mithep::PFCandidate*> photonsToVeto;
249
250
251 //
252 if( ctrl.debug ) cout << "\tnMuons: " << muonArr->GetEntries() << endl;
253 //----------------------------------------------------
254 for(int i=0; i<muonArr->GetEntries(); i++)
255 {
256 const mithep::Muon *mu = (mithep::Muon*)((*muonArr)[i]);
257
258 SelectionStatus musel;
259 if(ctrl.debug) cout << "musel.status before anything: " << musel.getStatus() << endl;
260
261 musel |= (*MuonPreSelector)(ctrl,mu,vtx,pfCandidates);
262 if(ctrl.debug) cout << "musel.status after presel: " << musel.getStatus() << endl;
263 if( !(musel.getStatus() & SelectionStatus::PRESELECTION) ) continue;
264 if( ctrl.debug ) cout << endl;
265
266 musel |= (*MuonIDSelector)(ctrl,mu,vtx,pfCandidates );
267 if(ctrl.debug) cout << "musel.status after ID: " << musel.getStatus() << endl;
268 if( ctrl.debug ) cout << endl;
269
270 if( !(ctrl.doFSR) ) {
271 musel |= (*MuonIsoSelector)(ctrl,mu,vtx,pfCandidates,puEnergyDensity,eraMu,photonsToVeto);
272 if(ctrl.debug) cout << "musel.status after iso: " << musel.getStatus() << endl;
273 if( ctrl.debug ) cout << "isomva : " << musel.isoMVA << endl;
274 if( ctrl.debug ) cout << endl;
275 }
276
277 if( ctrl.debug ) {
278 cout << "muon:: pt: " << mu->Pt()
279 << "\teta: " << mu->Eta()
280 << "\tstatus: " << hex << musel.getStatus() << dec
281 << endl;
282 }
283
284
285 SimpleLepton tmplep;
286 float pt = mu->Pt();
287 tmplep.vec.SetPtEtaPhiM(pt,
288 mu->Eta(),
289 mu->Phi(),
290 MUON_MASS);
291
292 tmplep.type = 13;
293 tmplep.index = i;
294 tmplep.charge = mu->Charge();
295 tmplep.isoTrk = mu->IsoR03SumPt();
296 tmplep.isoEcal = mu->IsoR03EmEt();
297 tmplep.isoHcal = mu->IsoR03HadEt();
298 tmplep.isoPF04 = musel.isoPF04;
299 tmplep.chisoPF04 = musel.chisoPF04;
300 tmplep.gaisoPF04 = musel.gaisoPF04;
301 tmplep.neisoPF04 = musel.neisoPF04;
302 // tmplep.isoPF03 = computePFMuonIso(mu,vtx,pfCandidates,0.3);
303 // tmplep.isoPF04 = computePFMuonIso(mu,vtx,pfCandidates,0.4);
304 tmplep.ip3dSig = mu->Ip3dPVSignificance();
305 tmplep.is4l = false;
306 tmplep.isEB = (fabs(mu->Eta()) < 1.479 ? 1 : 0 );
307 tmplep.isoMVA = musel.isoMVA;
308 tmplep.isTight = musel.tight();
309 tmplep.isLoose = musel.loose();
310 tmplep.status = musel;
311 tmplep.fsrRecoveryAttempted = false;
312 tmplep.isPFMuon = mu->IsPFMuon();
313 tmplep.isGlobalMuon = mu->IsGlobalMuon();
314 lepvec.push_back(tmplep);
315 if( ctrl.debug ) cout << endl;
316 }
317
318
319
320 //
321 if( ctrl.debug ) { cout << "\tnElectron: " << electronArr->GetEntries() << endl; }
322 // --------------------------------------------------------------------------------
323 for(int i=0; i<electronArr->GetEntries(); i++)
324 {
325
326 // const mithep::Electron *ele = (mithep::Electron*)((*electronArr)[i]);
327 const mithep::Electron *const_ele = (mithep::Electron*)((*electronArr)[i]);
328 mithep::Electron *ele = const_cast<mithep::Electron*>(const_ele);
329
330 SelectionStatus elesel;
331 if( ctrl.debug ) cout << endl;
332 if( ctrl.debug ) cout << "--> status before anything: " << hex << elesel.getStatus() << dec << endl;
333
334 elesel |= (*ElectronIDSelector)(ctrl,ele,vtx);
335 if( ctrl.debug ) cout << "--> status after ID: " << hex << elesel.getStatus() << dec << endl;
336 if( ctrl.debug ) cout << endl;
337
338 ElectronMomentumCorrection electron_momentum_correction;
339 electron_momentum_correction.correct_electron_momentum(ctrl, ele,puEnergyDensity->At(0)->RhoKt6PFJets(),vtxArr->GetEntries());
340
341 bool pass = false;
342
343 Int_t subdet = 0;
344 if (fabs(ele->SCluster()->Eta()) < 0.8) subdet = 0;
345 else if (fabs(ele->SCluster()->Eta()) < 1.479) subdet = 1;
346 else subdet = 2;
347 Int_t ptBin = 0;
348 if (ele->Pt() > 10) ptBin = 1;
349
350 Int_t MVABin = -1;
351 if (subdet == 0 && ptBin == 0) MVABin = 0; // eta<0.8, pt<10
352 if (subdet == 1 && ptBin == 0) MVABin = 1; // 0.8<eta<1.479, pt<10
353 if (subdet == 2 && ptBin == 0) MVABin = 2; // eta>1.478, pt<10
354 if (subdet == 0 && ptBin == 1) MVABin = 3; // eta<0.8, pt>10
355 if (subdet == 1 && ptBin == 1) MVABin = 4; // 0.8<eta<1.479, pt>10
356 if (subdet == 2 && ptBin == 1) MVABin = 5; // eta>1.478, pt>10
357
358 if( MVABin == 0 && elesel.idMVA > ELE_REFERENCE_IDMVA_CUT_BIN0 ) pass = true;
359 if( MVABin == 1 && elesel.idMVA > ELE_REFERENCE_IDMVA_CUT_BIN1 ) pass = true;
360 if( MVABin == 2 && elesel.idMVA > ELE_REFERENCE_IDMVA_CUT_BIN2 ) pass = true;
361 if( MVABin == 3 && elesel.idMVA > ELE_REFERENCE_IDMVA_CUT_BIN3 ) pass = true;
362 if( MVABin == 4 && elesel.idMVA > ELE_REFERENCE_IDMVA_CUT_BIN4 ) pass = true;
363 if( MVABin == 5 && elesel.idMVA > ELE_REFERENCE_IDMVA_CUT_BIN5 ) pass = true;
364
365 if( pass ) {
366 elesel.orStatus(SelectionStatus::LOOSEID);
367 elesel.orStatus(SelectionStatus::TIGHTID);
368 }
369
370 elesel |= (*ElectronPreSelector)(ctrl,ele,vtx);
371 if( ctrl.debug ) cout << "--> status after presel: " << hex << elesel.getStatus() << dec << endl;
372 if( !(elesel.getStatus() & SelectionStatus::PRESELECTION) ) continue;
373 if( ctrl.debug ) cout << endl;
374
375 if( !(ctrl.doFSR) ) {
376 elesel |= (*ElectronIsoSelector)(ctrl,ele,vtx,pfCandidates,puEnergyDensity,eraEle,photonsToVeto);
377 if( ctrl.debug ) cout << "--> status after iso: " << hex << elesel.getStatus() << dec << endl;
378 if( ctrl.debug ) cout << endl;
379 }
380
381 if( ctrl.debug ){
382 cout << "\tscEt: " << ele->SCluster()->Et()
383 << "\tscEta: " << ele->SCluster()->Eta()
384 << "\tstatus: " << hex << elesel.getStatus() << dec
385 << endl;
386 }
387
388
389 SimpleLepton tmplep;
390 float pt = ele->Pt();
391 tmplep.vec.SetPtEtaPhiM( pt,
392 ele->Eta(),
393 ele->Phi(),
394 ELECTRON_MASS );
395
396 tmplep.type = 11;
397 tmplep.index = i;
398 tmplep.charge = ele->Charge();
399 tmplep.isoTrk = ele->TrackIsolationDr03();
400 tmplep.isoEcal = ele->EcalRecHitIsoDr03();
401 tmplep.isoHcal = ele->HcalTowerSumEtDr03();
402 tmplep.isoPF04 = elesel.isoPF04;
403 tmplep.chisoPF04 = elesel.chisoPF04;
404 tmplep.gaisoPF04 = elesel.gaisoPF04;
405 tmplep.neisoPF04 = elesel.neisoPF04;
406 // tmplep.isoPF03 = computePFEleIso(ele,vtx,pfCandidates,0.3);
407 // tmplep.isoPF04 = computePFEleIso(ele,vtx,pfCandidates,0.4);
408 tmplep.ip3dSig = ele->Ip3dPVSignificance();
409 tmplep.is4l = false;
410 tmplep.isEB = ele->IsEB();
411 tmplep.scID = ele->SCluster()->GetUniqueID();
412 tmplep.isTight = elesel.tight();
413 tmplep.isLoose = elesel.loose();
414 tmplep.status = elesel;
415 tmplep.idMVA = elesel.idMVA;
416 tmplep.isoMVA = elesel.isoMVA;
417 tmplep.fsrRecoveryAttempted = false;
418 tmplep.isPFMuon = false;
419 tmplep.isGlobalMuon = false;
420 lepvec.push_back(tmplep);
421 if( ctrl.debug ) cout << endl;
422 }
423
424 //********************************************************
425 // Dump Stuff
426 //********************************************************
427 sort( lepvec.begin(), lepvec.end(), SimpleLepton::lep_pt_sort );
428 // sort( lepvec.begin(), lepvec.end(), SimpleLepton::lep_reversept_sort );
429 int nmu=0, nele=0;
430 for( int i=0; i<lepvec.size(); i++ ) {
431 if(ctrl.debug) {
432 cout << "lepvec :: evt: " << info->EvtNum()
433 << "\tindex: " << i
434 << "\ttype: " << lepvec[i].type
435 << "\tpt: " << lepvec[i].vec.Pt()
436 << "\teta: " << lepvec[i].vec.Eta();
437 if( abs(lepvec[i].type) == 11 ) {
438 const mithep::Electron *tmpele = (mithep::Electron*)((*electronArr)[lepvec[i].index]);
439 cout << "\tSCeta: " << tmpele->SCluster()->Eta()
440 << "\tidMVA: " << lepvec[i].idMVA;
441 }
442 cout << "\tloose: " << lepvec[i].isLoose
443 << "\tpf: " << lepvec[i].isoPF04
444 << "\tch: " << lepvec[i].chisoPF04
445 << "\tga: " << lepvec[i].gaisoPF04
446 << "\tne: " << lepvec[i].neisoPF04 ;
447 cout << endl;
448 }
449 if( abs(lepvec[i].type) == 11 ) nele++;
450 else nmu++;
451 }
452 if( ctrl.debug ) {
453 cout << "postsel nlep: " << lepvec.size()
454 << "\tnmuon: " << nmu
455 << "\tnelectron: " << nele
456 << endl;
457 }
458
459 //********************************************************
460 // Step 2: Lepton Cleaning
461 //********************************************************
462 vector<vector<SimpleLepton>::iterator> electrons_to_erase;
463 for (vector<SimpleLepton>::iterator it1=lepvec.begin();
464 it1 != lepvec.end(); it1++ ) {
465 if ( abs(it1->type) != 11 ) continue;
466 TVector3 evec = it1->vec.Vect();
467
468 bool erase_this_electron=false;
469 for (vector<SimpleLepton>::iterator it2=lepvec.begin();
470 it2 != lepvec.end(); it2++ ) {
471 if ( it2 == it1 ) continue;
472 if ( abs(it2->type) != 13 ) continue;
473
474 if( !it2->status.passPre() || (!it2->isPFMuon && !it2->isGlobalMuon) ) continue;
475 TVector3 mvec = it2->vec.Vect();
476
477 if ( evec.DrEtaPhi(mvec) < 0.05 ) {
478 erase_this_electron=true;
479 break;
480 }
481 }
482 if( erase_this_electron ) {
483 if( ctrl.debug ) cout << "erasing electron with pt " << it1->vec.Pt() << endl;
484 electrons_to_erase.push_back(it1);
485 }
486 }
487 for( int i=0; i<electrons_to_erase.size(); i++ ) {
488 lepvec.erase(electrons_to_erase[i]);
489 }
490 if( lepvec.size() >= 4 ) {
491 // ret.status.selectionBits.flip(3);
492 } else {
493 // ret.status.setStatus(SelectionStatus::FAIL);
494 // return ret;
495 }
496
497 //********************************************************
498 // Step 3: Good Leptons
499 //********************************************************
500 vector<double> pt_of_leptons_to_erase;
501 for (int i=0; i<lepvec.size(); i++ ) {
502 bool already_pushed=false;
503 if( !(lepvec[i].status.looseIDAndPre()) ) {
504 pt_of_leptons_to_erase.push_back(lepvec[i].vec.Pt());
505
506 already_pushed = true;
507 if(ctrl.debug)
508 cout << "pushing failed lepton type: " << lepvec[i].type
509 << "\tpt: " << lepvec[i].vec.Pt()
510 << "\teta: " << lepvec[i].vec.Eta()
511 << endl;
512 failingLeptons.push_back(lepvec[i]); // these should pass preselection
513 } else {
514 passingLeptons.push_back(lepvec[i]);
515 }
516 if( !already_pushed && fabs(lepvec[i].ip3dSig)>4 )
517 pt_of_leptons_to_erase.push_back(lepvec[i].vec.Pt());
518 }
519 for( int i=0; i<pt_of_leptons_to_erase.size(); i++ ) {
520 for( vector<SimpleLepton>::iterator it=lepvec.begin();
521 it != lepvec.end(); it++ ) {
522 SimpleLepton flep = *it;
523 if( flep.vec.Pt() != pt_of_leptons_to_erase[i] ) continue;
524 if(ctrl.debug) cout << "erasing lepton : "
525 << flep.vec.Pt() << "\t"
526 << flep.type << "\t"
527 << endl;
528 lepvec.erase(it);
529 break;
530 }
531 }
532 if( ctrl.debug ) cout << "good leptons : " << lepvec.size() << endl;
533
534 //********************************************************
535 // Step 4: Z candidate preselection
536 //********************************************************
537 std::vector<std::pair<int,int> > ZCandidates;
538 std::vector<std::pair<SimpleLepton,SimpleLepton> > ZCandidatesLeptons;
539 std::vector<std::pair<SelectionStatus,SelectionStatus> > ZCandidatesSelectionStatus;
540 for(int i = 0; i < lepvec.size(); ++i) {
541 for(int j = i+1; j < lepvec.size(); ++j) {
542 if( abs(lepvec[i].type) != abs(lepvec[j].type) ) continue;
543 if( lepvec[i].charge == lepvec[j].charge ) continue;
544
545 TLorentzVector Zvec = (lepvec[i].vec+lepvec[j].vec);
546
547 vector<SimpleLepton> lepvec_i = lepvec;
548 vector<SimpleLepton> lepvec_j = lepvec;
549
550 if( ctrl.doFSR ) {
551 cout << endl;
552 cout << "----------------> FSR ("<<i<<","<<j<<") <----------------------" << endl;
553 photonsToVeto.clear();
554 float old_pt_i = lepvec[i].vec.Pt();
555 float old_pt_j = lepvec[j].vec.Pt();
556 float old_M = Zvec.M();
557
558
559 cout << "i: " << i << endl;
560 if( abs(lepvec[i].type) == 13 ) {
561 const mithep::Muon *mu = (mithep::Muon*)((*muonArr)[lepvec[i].index]);
562 mithep::Muon * newmu = const_cast<mithep::Muon *>(mu);
563 if( recover_typeI_Photon( ctrl, newmu, i, lepvec_i, pfCandidates, electronArr, &Zvec, photonsToVeto ) ) {
564 if(ctrl.debug) cout << "FSR TYPEI :: oldpt: " << old_pt_i
565 << "\tnewpt: " << lepvec_i[i].vec.Pt()
566 << "\tindex: " << i
567 << endl;
568 //lepvec[i].fsrRecoveryAttempted=true;
569 }
570 if( recover_typeII_Photon( ctrl, newmu, i, lepvec_i, pfCandidates ) ) {
571 if(ctrl.debug) cout << "FSR TYPEII :: oldpt: " << old_pt_i
572 << "\tnewpt: " << lepvec_i[i].vec.Pt()
573 << "\tindex: " << i
574 << endl;
575 //lepvec[i].fsrRecoveryAttempted=true;
576 }
577 } else {
578 const mithep::Electron *el = (mithep::Electron*)((*electronArr)[lepvec[i].index]);
579 mithep::Electron* newel = const_cast<mithep::Electron*>(el);
580 if( recover_typeI_Photon( ctrl, newel, i, lepvec_i, pfCandidates, electronArr, &Zvec, photonsToVeto ) ) {
581 if(ctrl.debug) cout << "FSR TYPEI :: oldpt: " << old_pt_i
582 << "\tnewpt: " << lepvec_i[i].vec.Pt()
583 << "\tindex: " << i
584 << endl;
585 //lepvec[i].fsrRecoveryAttempted=true;
586 }
587 }
588
589
590 cout << "j: " << j << endl;
591 mithep::ChargedParticle *cp;
592 if( abs(lepvec[j].type) == 13 ) {
593 const mithep::Muon *mu = (mithep::Muon*)((*muonArr)[lepvec[j].index]);
594 mithep::Muon * newmu = const_cast<mithep::Muon *>(mu);
595 if( recover_typeI_Photon( ctrl, newmu, j, lepvec_j, pfCandidates, electronArr, &Zvec, photonsToVeto ) ) {
596 if(ctrl.debug) cout << "FSR TYPEI :: oldpt: " << old_pt_j
597 << "\tnewpt: " << lepvec_j[j].vec.Pt()
598 << "\tindex: " << j
599 << endl;
600
601 //lepvec[j].fsrRecoveryAttempted=true;
602 }
603 if( recover_typeII_Photon( ctrl, newmu, j, lepvec_j, pfCandidates ) ) {
604 if(ctrl.debug) cout << "FSR TYPEII :: oldpt: " << old_pt_j
605 << "\tnewpt: " << lepvec_j[j].vec.Pt()
606 << "\tindex: " << j
607 << endl;
608 //lepvec[j].fsrRecoveryAttempted=true;
609 }
610 } else {
611 const mithep::Electron *el = (mithep::Electron*)((*electronArr)[lepvec[j].index]);
612 mithep::Electron* newel = const_cast<mithep::Electron*>(el);
613 if( recover_typeI_Photon( ctrl, newel, j, lepvec_j, pfCandidates, electronArr, &Zvec, photonsToVeto ) ) {
614 if(ctrl.debug) cout << "FSR TYPEI :: oldpt: " << old_pt_j
615 << "\tnewpt: " << lepvec_j[j].vec.Pt()
616 << "\tindex: " << j
617 << endl;
618 // lepvec[j].fsrRecoveryAttempted=true;
619 }
620 }
621
622 //
623 // now fix isolation
624 //
625
626 if( abs(lepvec[i].type) == 11 ) {
627 const mithep::Electron *el = (mithep::Electron*)((*electronArr)[lepvec_i[i].index]);
628 lepvec_i[i].status |=
629 (*ElectronIsoSelector)(ctrl,el,vtx,pfCandidates,puEnergyDensity,eraEle,photonsToVeto);
630
631 } else {
632 const mithep::Muon *mu = (mithep::Muon*)((*muonArr)[lepvec_i[i].index]);
633 lepvec_i[i].status |=
634 (*MuonIsoSelector)(ctrl,mu,vtx,pfCandidates,puEnergyDensity,eraMu,photonsToVeto);
635 }
636 updateSimpleLepton(lepvec_i[i]);
637
638 if( abs(lepvec[j].type) == 11 ) {
639 const mithep::Electron *el = (mithep::Electron*)((*electronArr)[lepvec_j[j].index]);
640 lepvec_j[j].status |=
641 (*ElectronIsoSelector)(ctrl,el,vtx,pfCandidates,puEnergyDensity,eraEle,photonsToVeto);
642 } else {
643 const mithep::Muon *mu = (mithep::Muon*)((*muonArr)[lepvec_j[j].index]);
644 lepvec_j[j].status |=
645 (*MuonIsoSelector)(ctrl,mu,vtx,pfCandidates,puEnergyDensity,eraMu,photonsToVeto);
646 }
647 updateSimpleLepton(lepvec_j[j]);
648
649 float new_M = (lepvec_i[i].vec+lepvec_j[j].vec).M();
650 float new_pt_i = lepvec_i[i].vec.Pt();
651 float new_pt_j = lepvec_j[j].vec.Pt();
652 if( ctrl.debug ) {
653 cout << "\toldM: " << old_M << "\tnewM:" << new_M << endl;
654 cout << "\told_pt_i: " << old_pt_i << "\tnew_pt_i:" << new_pt_i << endl;
655 cout << "\told_pt_j: " << old_pt_j << "\tnew_pt_j:" << new_pt_j << endl;
656 }
657
658 } // doFSR
659
660
661 if( !(lepvec_i[i].status.loose()) || !(lepvec_j[j].status.loose()) ) continue;
662 ZCandidates.push_back(std::pair<int,int> (i,j) );
663 ZCandidatesLeptons.push_back(std::pair<SimpleLepton,SimpleLepton> (lepvec_i[i],lepvec_j[j]) );
664 if( ctrl.debug ) cout << "Z candidate ("<< i << "," << j << ")"
665 << "\tmass: " << (lepvec_i[i].vec+lepvec_j[j].vec).M() << endl;
666 }
667 }
668 if( ZCandidates.size() > 0 ) {
669 ret.status.selectionBits.flip(PASS_ZCANDIDATE);
670 if( ctrl.debug ) cout << "event has >0 Z candidates" << endl;
671 cutvec[PASS_ZCANDIDATE] +=1;
672 } else {
673 ret.status.setStatus(SelectionStatus::FAIL);
674 return ret;
675 }
676
677 //
678 // !!!!!!!!!!!!!! Z1 SELECTED HERE
679 //
680 int best_Z1_index;
681 float best_Z1_mass = 9999.;
682 TLorentzVector Z1vec;
683 for( int i=0; i<ZCandidates.size(); i++ ) {
684 // TLorentzVector tmpZ1vec = (lepvec[ZCandidates[i].first].vec) +
685 // (lepvec[ZCandidates[i].second].vec);
686 TLorentzVector tmpZ1vec = (ZCandidatesLeptons[i].first.vec) +
687 (ZCandidatesLeptons[i].second.vec);
688 if( fabs(tmpZ1vec.M()-Z_MASS) < fabs(best_Z1_mass-Z_MASS) ) {
689 best_Z1_index=i;
690 best_Z1_mass=tmpZ1vec.M();
691 Z1vec = tmpZ1vec;
692 }
693 }
694 // update the leptons, damn FSR ...
695 // ret.Z1leptons.push_back(lepvec[ZCandidates[best_Z1_index].first]);
696 // ret.Z1leptons.push_back(lepvec[ZCandidates[best_Z1_index].second]);
697 ret.Z1leptons.push_back(ZCandidatesLeptons[best_Z1_index].first);
698 ret.Z1leptons.push_back(ZCandidatesLeptons[best_Z1_index].second);
699
700
701 cout << "best mZ1: " << best_Z1_mass << " from (" <<
702 ZCandidates[best_Z1_index].first << "," << ZCandidates[best_Z1_index].second << ")" << endl;
703 int Z1type;
704 if( abs(ret.Z1leptons[0].type) == 11 ) Z1type=0;
705 else Z1type=1;
706 zcutvec[Z1type][PASS_ZCANDIDATE] +=1;
707
708
709 //******************************************************************************
710 // Step 6.3 : require Z1 with 40<m<120
711 //******************************************************************************
712 if( Z1vec.M() > 40. && Z1vec.M() < 120. ) {
713 ret.status.selectionBits.flip(PASS_GOODZ1);
714 cutvec[PASS_GOODZ1] +=1;
715 zcutvec[Z1type][PASS_GOODZ1] +=1;
716 } else {
717 ret.status.setStatus(SelectionStatus::FAIL);
718 return ret;
719 }
720
721 //******************************************************************************
722 // Step 6.3 : 4 good leptons
723 //******************************************************************************
724 if( lepvec.size() >= 4 ) {
725 if( ctrl.debug) cout << "pass4L: " << info->EvtNum() << endl;
726 ret.status.selectionBits.flip(PASS_4L);
727 cutvec[PASS_4L] +=1;
728 zcutvec[Z1type][PASS_4L] +=1;
729 } else {
730 ret.status.setStatus(SelectionStatus::FAIL);
731 return ret;
732 }
733 int nEl=0, nMu=0;
734 for( int i=0; i<4; i++ ) {
735 if(abs(lepvec[i].type) == 11 ) nEl++;
736 if(abs(lepvec[i].type) == 13 ) nMu++;
737 }
738 if( nEl >= 4 ) zzcutvec[0][PASS_4L] +=1;
739 else if( nMu >= 4 ) zzcutvec[1][PASS_4L] +=1;
740 else zzcutvec[2][PASS_4L] +=1;
741
742 //********************************************************
743 // Step 5: ZZ candidates
744 //********************************************************
745 int nZZCandidates=0;
746 std::vector<std::pair<int,int> > ZZCandidates;
747 int Z2type;
748 for(int z2index=0; z2index<ZCandidates.size(); ++z2index) {
749 int z1index = best_Z1_index;
750 if ( z2index == z1index ) continue;
751 if( ZCandidates[z1index].first == ZCandidates[z2index].first ) continue;
752 if( ZCandidates[z1index].first == ZCandidates[z2index].second ) continue;
753 if( ZCandidates[z1index].second == ZCandidates[z2index].first ) continue;
754 if( ZCandidates[z1index].second == ZCandidates[z2index].second ) continue;
755
756 //ghost removal
757 if(mithep::MathUtils::DeltaR(ZCandidatesLeptons[z1index].first.vec.Phi(),ZCandidatesLeptons[z1index].first.vec.Eta(),ZCandidatesLeptons[z2index].first.vec.Phi(),ZCandidatesLeptons[z2index].first.vec.Eta()) < 0.02) continue;
758 if(mithep::MathUtils::DeltaR(ZCandidatesLeptons[z1index].first.vec.Phi(),ZCandidatesLeptons[z1index].first.vec.Eta(),ZCandidatesLeptons[z2index].second.vec.Phi(),ZCandidatesLeptons[z2index].second.vec.Eta()) < 0.02) continue;
759 if(mithep::MathUtils::DeltaR(ZCandidatesLeptons[z1index].second.vec.Phi(),ZCandidatesLeptons[z1index].second.vec.Eta(),ZCandidatesLeptons[z2index].first.vec.Phi(),ZCandidatesLeptons[z2index].first.vec.Eta()) < 0.02) continue;
760 if(mithep::MathUtils::DeltaR(ZCandidatesLeptons[z1index].second.vec.Phi(),ZCandidatesLeptons[z1index].second.vec.Eta(),ZCandidatesLeptons[z2index].second.vec.Phi(),ZCandidatesLeptons[z2index].second.vec.Eta()) < 0.02) continue;
761
762 ZZCandidates.push_back(std::pair<int,int> (z1index,z2index));
763 // Z2type = abs(lepvec[ZCandidates[z2index].first].type);
764 Z2type = abs(ZCandidatesLeptons[z2index].first.type);
765 }
766 if( ZZCandidates.size() > 0 ) {
767
768 if( ctrl.debug) cout << "passZZ: " << info->EvtNum() << endl;
769 ret.status.selectionBits.flip(PASS_ZZCANDIDATE);
770 cutvec[PASS_ZZCANDIDATE] +=1;
771 if( ZZCandidates.size() > 1 ) Z2type=999;
772 if( ctrl.debug ) cout << "nZZcandidates: " << ZZCandidates.size() << endl;
773 // if( ctrl.debug ) {
774 cout << "evt: " << info->EvtNum() << "\tnZZcandidates: " << ZZCandidates.size()
775 << "\tZ1f: " << abs(ret.Z1leptons[0].type) << "\tZ2f: " << Z2type << endl;
776 cout << "-------------------------------------------------------" << endl;
777 for( int l=0; l<lepvec.size(); l++ ) lepvec[l].print();
778 cout << "-------------------------------------------------------" << endl;
779 // }
780 } else {
781 ret.status.setStatus(SelectionStatus::FAIL);
782 return ret;
783 }
784
785 //
786 // !!!!!!!!!!!!!! Z2 SELECTED HERE
787 //
788 int best_Z2_index;
789 float best_Z2_pt = -1.;
790 for( int i=0; i<ZZCandidates.size(); i++ ) {
791 int z2index = ZZCandidates[i].second;
792 // TLorentzVector Z2 = (lepvec[ZCandidates[z2index].first].vec) +
793 // (lepvec[ZCandidates[z2index].second].vec);
794 TLorentzVector Z2 = (ZCandidatesLeptons[z2index].first.vec) +
795 (ZCandidatesLeptons[z2index].second.vec);
796 if( Z2.Pt() > best_Z2_pt ) {
797 best_Z2_index=z2index;
798 best_Z2_pt=Z2.Pt();
799 }
800 }
801 // update the leptons, damn FSR ...
802 // ret.Z2leptons.push_back(lepvec[ZCandidates[best_Z2_index].first]);
803 // ret.Z2leptons.push_back(lepvec[ZCandidates[best_Z2_index].second]);
804 ret.Z2leptons.push_back(ZCandidatesLeptons[best_Z2_index].first);
805 ret.Z2leptons.push_back(ZCandidatesLeptons[best_Z2_index].second);
806
807 int theZ1type = abs(ZCandidatesLeptons[best_Z1_index].first.type);
808 int theZ2type = abs(ZCandidatesLeptons[best_Z2_index].first.type);
809
810 cout << "best mZ2: " << (ret.Z2leptons[0].vec+ret.Z2leptons[1].vec).M() << endl;
811 int ZZtype;
812 if( Z1type == 0 && abs(ret.Z2leptons[0].type) == 11 ) ZZtype=0;
813 else if ( Z1type == 1 && abs(ret.Z2leptons[0].type) == 13 ) ZZtype=1;
814 else ZZtype=2;
815 zzcutvec[ZZtype][PASS_ZZCANDIDATE] += 1;
816 increment("sfOsHiPt",theZ1type,theZ2type);
817
818 if(ctrl.debug)cout << "ZZ :: evt: " << info->EvtNum()
819 << "\tmZ1: " << (ret.Z1leptons[0].vec+ret.Z1leptons[1].vec).M()
820 << "\tmZ2: " << (ret.Z2leptons[0].vec+ret.Z2leptons[1].vec).M()
821 << endl;
822
823 //******************************************************************************
824 // Step 6.4 : require Z2 with 4<m<120
825 //******************************************************************************
826 TLorentzVector Z2vec = (ZCandidatesLeptons[best_Z2_index].first.vec) +
827 (ZCandidatesLeptons[best_Z2_index].second.vec);
828 if( Z2vec.M() > 4 && Z2vec.M() < 120 ) {
829 ret.status.selectionBits.flip(PASS_GOODZ2);
830 cutvec[PASS_GOODZ2] +=1;
831 zzcutvec[ZZtype][PASS_GOODZ2] += 1;
832 increment("4<mZ2<120",theZ1type,theZ2type);
833 } else {
834 ret.status.setStatus(SelectionStatus::FAIL);
835 return ret;
836 }
837
838 //******************************************************************************
839 // Step 6.1 : any two leptons 20/10
840 //******************************************************************************
841 vector<SimpleLepton> zzleptons;
842 zzleptons.push_back( ZCandidatesLeptons[best_Z1_index].first );
843 zzleptons.push_back( ZCandidatesLeptons[best_Z1_index].second );
844 zzleptons.push_back( ZCandidatesLeptons[best_Z2_index].first );
845 zzleptons.push_back( ZCandidatesLeptons[best_Z2_index].second );
846 int nlep_above_10=0,nlep_above_20=0;
847 for( int i=0; i<zzleptons.size(); i++ ) {
848 if( zzleptons[i].vec.Pt() > 10 ) nlep_above_10++;
849 if( zzleptons[i].vec.Pt() > 20 ) nlep_above_20++;
850 }
851 if( nlep_above_10 > 1 && nlep_above_20 > 0 ) {
852 ret.status.selectionBits.flip(PASS_ZZ_20_10);
853 cutvec[PASS_ZZ_20_10] +=1;
854 zzcutvec[ZZtype][PASS_ZZ_20_10] += 1;
855 increment("pt>20,10",theZ1type,theZ2type);
856 if( ctrl.debug ) cout << "passess 20/10 ..." << endl;
857 } else {
858 ret.status.setStatus(SelectionStatus::FAIL);
859 return ret;
860 }
861
862 //******************************************************************************
863 // Step 6.5 : resonance killing (4/4)
864 //******************************************************************************
865 bool resonance = false;
866 for( int i=0; i<zzleptons.size(); i++ ) {
867 for( int j=i+1; j<zzleptons.size(); j++ ) {
868 if( zzleptons[i].charge == zzleptons[j].charge ) continue; // 4/4
869 if( (zzleptons[i].vec+zzleptons[j].vec).M() < 4. ) {
870 resonance = true;
871 break;
872 }
873 }
874 }
875 if( !resonance ) {
876 ret.status.selectionBits.flip(PASS_RESONANCE);
877 cutvec[PASS_RESONANCE] +=1;
878 zzcutvec[ZZtype][PASS_RESONANCE] += 1;
879 increment("mll>4",theZ1type,theZ2type);
880 if( ctrl.debug ) cout << "\tpasses resonance killing ... " << endl;
881 } else {
882 ret.status.setStatus(SelectionStatus::FAIL);
883 return ret;
884 }
885
886 //******************************************************************************
887 // Step 6.6 : m(4l) > 70 , m(4l) > 100
888 //******************************************************************************
889 TLorentzVector zzvec = (ZCandidatesLeptons[best_Z1_index].first.vec) +
890 (ZCandidatesLeptons[best_Z1_index].second.vec) +
891 (ZCandidatesLeptons[best_Z2_index].first.vec) +
892 (ZCandidatesLeptons[best_Z2_index].second.vec);
893
894 if( zzvec.M() > 70. ) {
895 if(ctrl.debug) cout << "passes mzz > 70, mzz: " << zzvec.M() << endl;
896 ret.status.selectionBits.flip(PASS_m4l_GT_70);
897 cutvec[PASS_m4l_GT_70] +=1;
898 zzcutvec[ZZtype][PASS_m4l_GT_70] += 1;
899 increment("m4l>70",theZ1type,theZ2type);
900 } else {
901 ret.status.setStatus(SelectionStatus::FAIL);
902 return ret;
903 }
904
905 if( zzvec.M() > 70. && (ret.Z2leptons[0].vec+ret.Z2leptons[1].vec).M() > 12) {
906 if(ctrl.debug) cout << "passes mzz > 70, mzz: " << zzvec.M() << "\t mZ2 > 12" << endl;
907 ret.status.selectionBits.flip(PASS_m4l_GT_100);
908 increment("m4l>70,mZ2>12",theZ1type,theZ2type);
909 } else {
910 ret.status.setStatus(SelectionStatus::FAIL);
911 return ret;
912 }
913
914 if( zzvec.M() > 100. && (ret.Z2leptons[0].vec+ret.Z2leptons[1].vec).M() > 12) {
915 if(ctrl.debug) cout << "passes mzz > 100, mzz: " << zzvec.M() << "\t mZ2 > 12" << endl;
916 cutvec[PASS_m4l_GT_100] +=1;
917 zzcutvec[ZZtype][PASS_m4l_GT_100] += 1;
918 increment("m4l>100,mZ2>12",theZ1type,theZ2type);
919 }
920
921 //***************************************************************
922 // finish
923 //***************************************************************
924
925 TLorentzVector theZ1 = (ZCandidatesLeptons[best_Z1_index].first.vec) +
926 (ZCandidatesLeptons[best_Z1_index].second.vec);
927 TLorentzVector theZ2 = (ZCandidatesLeptons[best_Z2_index].first.vec) +
928 (ZCandidatesLeptons[best_Z2_index].second.vec);
929 TLorentzVector theZZ = theZ1 + theZ2;
930
931 if( ctrl.debug ) cout << "run: " << info->RunNum()
932 << "\tevt: " << info->EvtNum()
933 << "\tZ1channel: " << theZ1type
934 << "\tZ2channel: " << theZ2type
935 << "\tmZ1: " << theZ1.M()
936 << "\tmZ2: " << theZ2.M()
937 << "\tm4l: " << theZZ.M()
938 << "\tevtfail: " << hex << evtfail << dec
939 // << "\ttrigbits: " << hex << info->triggerBits << dec
940 // << "\ttree: " << inputFiles[q][f]
941 << endl;
942
943 if( !evtfail ) {
944 ret.status.setStatus(SelectionStatus::EVTPASS);
945 // already done ..
946 // ret.Z1leptons.push_back(lepvec[ZCandidates[best_Z1_index].first]);
947 // ret.Z1leptons.push_back(lepvec[ZCandidates[best_Z1_index].second]);
948 // ret.Z2leptons.push_back(lepvec[ZCandidates[best_Z2_index].first]);
949 // ret.Z2leptons.push_back(lepvec[ZCandidates[best_Z2_index].second]);
950 }
951
952 return ret;
953 }
954 //--------------------------------------------------------------------------------------------------
955 void fillVetoArrays( ControlFlags & ctrl,
956 const mithep::Array<mithep::Muon> *muonArr,
957 vector< const mithep::Muon*> & muonsToVeto,
958 const mithep::Array<mithep::Electron> *electronArr,
959 vector< const mithep::Electron*> & electronsToVeto,
960 const mithep::Vertex * vtx )
961 //--------------------------------------------------------------------------------------------------
962 {
963
964 if( ctrl.debug ) cout << "looping for isolation ..." << endl;
965 /*
966 for(int i=0; i<muonArr->GetEntries(); i++)
967 {
968 const mithep::Muon *mu = (const mithep::Muon*)((*muonArr)[i]);
969 SelectionStatus musel;
970 // musel |= muonCutBasedVeto(ctrl,mu,vtx);
971 musel |= muonDummyVeto(ctrl,mu,vtx);
972 if( !(musel.getStatus() & SelectionStatus::PRESELECTION) ) continue;
973 if(ctrl.debug) cout << "pushing mu for isol veto ... " << endl;
974 muonsToVeto.push_back( mu );
975 }
976 */
977 for(int i=0; i<electronArr->GetEntries(); i++)
978 {
979 const mithep::Electron *ele = (const mithep::Electron*)((*electronArr)[i]);
980 SelectionStatus esel;
981 // esel |= electronCutBasedVeto(ctrl,ele,vtx);
982 esel |= electronDummyVeto(ctrl,ele,vtx);
983 if( !(esel.getStatus() & SelectionStatus::PRESELECTION) ) continue;
984 if(ctrl.debug) cout << "pushing ele for isol veto ... " << endl;
985 electronsToVeto.push_back( ele );
986 }
987 if( ctrl.debug ) cout << "done selecting for isolation veto ..." << endl << endl;;
988 }
989
990
991
992
993 //----------------------------------------------------------------------------
994 void updateSimpleLepton(SimpleLepton &tmplep)
995 //----------------------------------------------------------------------------
996 {
997 tmplep.isoPF04 = tmplep.status.isoPF04;
998 tmplep.chisoPF04 = tmplep.status.chisoPF04;
999 tmplep.gaisoPF04 = tmplep.status.gaisoPF04;
1000 tmplep.neisoPF04 = tmplep.status.neisoPF04;
1001 tmplep.isTight = tmplep.status.tight();
1002 tmplep.isLoose = tmplep.status.loose();
1003 // tmplep.fsrRecoveryAttempted = true;
1004 }