25 |
|
#include "CommonDefs.h" |
26 |
|
#include "SelectionDefs.h" |
27 |
|
#include "FSR.h" |
28 |
< |
#include "UtilFuncs.h" |
28 |
> |
#include "SelectionFuncs.h" |
29 |
|
|
30 |
|
|
31 |
|
extern vector<SimpleLepton> failingLeptons; |
106 |
|
{ |
107 |
|
const mithep::Muon *mu = (mithep::Muon*)((*muonArr)[i]); |
108 |
|
|
109 |
– |
SelectionStatus musel; |
109 |
|
|
110 |
< |
musel |= (*MuonPreSelector)(ctrl,mu,vtx,pfCandidates); |
111 |
< |
if( !(musel.getStatus() & SelectionStatus::PRESELECTION) ) continue; |
110 |
> |
SelectionStatus denomSel; |
111 |
> |
denomSel |= muonDenominatorSelection(ctrl,mu,vtx,pfCandidates); |
112 |
> |
if( !(denomSel.getStatus() & SelectionStatus::PRESELECTION) ) continue; |
113 |
|
|
114 |
+ |
SelectionStatus musel; |
115 |
+ |
musel |= (*MuonPreSelector)(ctrl,mu,vtx,pfCandidates); |
116 |
|
musel |= (*MuonIDSelector)(ctrl,mu,vtx,pfCandidates ); |
117 |
< |
|
116 |
< |
if( !(ctrl.doFSR) ) { |
117 |
< |
musel |= (*MuonIsoSelector)(ctrl,mu,vtx,pfCandidates,puEnergyDensity,eraMu,photonsToVeto); |
118 |
< |
} |
117 |
> |
musel |= (*MuonIsoSelector)(ctrl,mu,vtx,pfCandidates,puEnergyDensity,eraMu,photonsToVeto); |
118 |
|
|
119 |
|
SimpleLepton tmplep; |
120 |
|
float pt = mu->Pt(); |
143 |
|
tmplep.isLoose = musel.loose(); |
144 |
|
tmplep.status = musel; |
145 |
|
tmplep.fsrRecoveryAttempted = false; |
146 |
< |
tmplep.tightCutsApplied = false; |
146 |
> |
SelectionStatus tmpstat = PassWwMuonSel(mu,vtx,pfCandidates); |
147 |
> |
tmplep.tightCutsApplied = tmpstat.tight(); |
148 |
|
lepvec.push_back(tmplep); |
149 |
|
if( ctrl.debug ) cout << endl; |
150 |
|
} |
155 |
|
{ |
156 |
|
const mithep::Electron *ele = (mithep::Electron*)((*electronArr)[i]); |
157 |
|
|
158 |
< |
SelectionStatus elesel; |
158 |
> |
SelectionStatus denomSel; |
159 |
> |
denomSel |= electronDenominatorSelection(ctrl,ele,vtx); |
160 |
> |
if( !(denomSel.getStatus() & SelectionStatus::PRESELECTION) ) continue; |
161 |
|
|
162 |
+ |
SelectionStatus elesel; |
163 |
|
elesel |= (*ElectronPreSelector)(ctrl,ele,vtx); |
161 |
– |
if( !(elesel.getStatus() & SelectionStatus::PRESELECTION) ) continue; |
162 |
– |
|
164 |
|
elesel |= (*ElectronIDSelector)(ctrl,ele,vtx); |
165 |
< |
|
165 |
< |
if( !(ctrl.doFSR) ) { |
166 |
< |
elesel |= (*ElectronIsoSelector)(ctrl,ele,vtx,pfCandidates,puEnergyDensity,eraEle,photonsToVeto); |
167 |
< |
} |
165 |
> |
elesel |= (*ElectronIsoSelector)(ctrl,ele,vtx,pfCandidates,puEnergyDensity,eraEle,photonsToVeto); |
166 |
|
|
167 |
|
SimpleLepton tmplep; |
168 |
|
float pt = ele->Pt(); |
213 |
|
for (vector<SimpleLepton>::iterator it2=lepvec.begin(); it2 != lepvec.end(); it2++ ) { |
214 |
|
if ( it2 == it1 ) continue; |
215 |
|
if ( abs(it2->type) != 13 ) continue; |
216 |
< |
if( !(it2->status.looseIDAndPre()) ) continue; |
216 |
> |
// if( !(it2->status.looseIDAndPre()) ) continue; |
217 |
|
TVector3 mvec = it2->vec.Vect(); |
218 |
|
|
219 |
|
if ( evec.DrEtaPhi(mvec) < 0.05 ) { |
258 |
|
//****************************************************************************** |
259 |
|
// W + (OF SS lepton) Selection |
260 |
|
//****************************************************************************** |
261 |
< |
if(ctrl.fakeScheme.Contains("emu-")) { |
262 |
< |
if(has_ssof_lepton(ctrl)) { |
263 |
< |
ret.status.setStatus(SelectionStatus::EVTPASS); |
264 |
< |
ret.Z1leptons.push_back(passingLeptons[0]); |
265 |
< |
ret.Z1leptons.push_back(passingLeptons[0]); |
266 |
< |
ret.Z2leptons.push_back(passingLeptons[0]); |
267 |
< |
ret.Z2leptons.push_back(passingLeptons[0]); |
268 |
< |
} else { |
271 |
< |
ret.status.setStatus(SelectionStatus::FAIL); |
272 |
< |
} |
273 |
< |
return ret; |
261 |
> |
if(has_ssof_lepton(ctrl)) { |
262 |
> |
ret.status.setStatus(SelectionStatus::EVTPASS); |
263 |
> |
ret.Z1leptons.push_back(passingLeptons[0]); |
264 |
> |
ret.Z1leptons.push_back(passingLeptons[0]); |
265 |
> |
ret.Z2leptons.push_back(passingLeptons[0]); |
266 |
> |
ret.Z2leptons.push_back(passingLeptons[0]); |
267 |
> |
} else { |
268 |
> |
ret.status.setStatus(SelectionStatus::FAIL); |
269 |
|
} |
270 |
+ |
return ret; |
271 |
|
} |
276 |
– |
|
277 |
– |
// //---------------------------------------------------------------------------- |
278 |
– |
// // |
279 |
– |
// // Get primary vertices |
280 |
– |
// // Assumes primary vertices are ordered by sum-pT^2 (as should be in CMSSW) |
281 |
– |
// // NOTE: if no PV is found from fitting tracks, the beamspot is used |
282 |
– |
// // |
283 |
– |
// //---------------------------------------------------------------------------- |
284 |
– |
// bool setPV(ControlFlags ctrl, |
285 |
– |
// const mithep::Array<mithep::Vertex> * vtxArr, |
286 |
– |
// const mithep::Vertex* &vtx) |
287 |
– |
// //---------------------------------------------------------------------------- |
288 |
– |
// { |
289 |
– |
|
290 |
– |
// const mithep::Vertex *bestPV = 0; |
291 |
– |
// float best_sumpt=-1; |
292 |
– |
|
293 |
– |
// // good PV requirements |
294 |
– |
// const UInt_t fMinNTracksFit = 0; |
295 |
– |
// const Double_t fMinNdof = 4; |
296 |
– |
// const Double_t fMaxAbsZ = 24; |
297 |
– |
// const Double_t fMaxRho = 2; |
298 |
– |
|
299 |
– |
// for(int i=0; i<vtxArr->GetEntries(); ++i) { |
300 |
– |
// const mithep::Vertex *pv = (mithep::Vertex*)(vtxArr->At(i)); |
301 |
– |
// if( ctrl.debug ) cout << "vertex :: " << i << "\tntrks: " << pv->NTracks() << endl; |
302 |
– |
|
303 |
– |
// // Select best PV for corrected d0; if no PV passing cuts, the first PV in the collection will be used |
304 |
– |
// if(!pv->IsValid()) continue; |
305 |
– |
// if(pv->NTracksFit() < fMinNTracksFit) continue; |
306 |
– |
// if(pv->Ndof() < fMinNdof) continue; |
307 |
– |
// if(fabs(pv->Z()) > fMaxAbsZ) continue; |
308 |
– |
// if(pv->Position().Rho() > fMaxRho) continue; |
309 |
– |
|
310 |
– |
// // take the first ... |
311 |
– |
// bestPV = pv; |
312 |
– |
// break; |
313 |
– |
|
314 |
– |
// // this never reached ... |
315 |
– |
// float tmp_sumpt=0; |
316 |
– |
// for( int t=0; t<pv->NTracks(); t++ ) |
317 |
– |
// tmp_sumpt += pv->Trk(t)->Pt(); |
318 |
– |
|
319 |
– |
// if( tmp_sumpt > best_sumpt ) { |
320 |
– |
// bestPV = pv; |
321 |
– |
// best_sumpt = tmp_sumpt; |
322 |
– |
// if( ctrl.debug) cout << "new PV set, pt : " << best_sumpt << endl; |
323 |
– |
// } |
324 |
– |
// } |
325 |
– |
|
326 |
– |
// // sync |
327 |
– |
// if(!bestPV) |
328 |
– |
// return false; |
329 |
– |
// else { |
330 |
– |
// vtx = bestPV; |
331 |
– |
// return true; |
332 |
– |
// } |
333 |
– |
// }; |
272 |
|
//---------------------------------------------------------------------------------------- |
273 |
|
bool has_ssof_lepton(ControlFlags &ctrl) |
274 |
|
{ |
299 |
|
|
300 |
|
return has_ssof; |
301 |
|
} |
364 |
– |
// //---------------------------------------------------------------------------------------- |
365 |
– |
// void getEATargets(ControlFlags &ctrl, mithep::MuonTools::EMuonEffectiveAreaTarget &eraMu, mithep::ElectronTools::EElectronEffectiveAreaTarget &eraEle) |
366 |
– |
// { |
367 |
– |
// if( !ctrl.mc && ctrl.era == 2011 ) { |
368 |
– |
// eraMu = mithep::MuonTools::kMuEAData2011; |
369 |
– |
// eraEle = mithep::ElectronTools::kEleEAData2011; |
370 |
– |
// } else if( !ctrl.mc && ctrl.era == 2012 ) { |
371 |
– |
// eraMu = mithep::MuonTools::kMuEAData2012; |
372 |
– |
// eraEle = mithep::ElectronTools::kEleEAData2012; |
373 |
– |
// } else if( ctrl.mc && ctrl.era == 2011 ) { |
374 |
– |
// eraMu = mithep::MuonTools::kMuEAFall11MC; |
375 |
– |
// eraEle = mithep::ElectronTools::kEleEAFall11MC; |
376 |
– |
// } else if( ctrl.mc && ctrl.era == 2012 ) { |
377 |
– |
// eraMu = mithep::MuonTools::kMuEAData2012; |
378 |
– |
// eraEle = mithep::ElectronTools::kEleEAData2012; |
379 |
– |
// } else { |
380 |
– |
// cerr << "unknown era for effective areas ... quitting." << endl; |
381 |
– |
// exit(1); |
382 |
– |
// } |
383 |
– |
// } |