ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/NonMCBackground/src/SelectionEMU.cc
(Generate patch)

Comparing UserCode/MitHzz4l/NonMCBackground/src/SelectionEMU.cc (file contents):
Revision 1.6 by dkralph, Wed Jun 13 14:11:22 2012 UTC vs.
Revision 1.8 by dkralph, Thu Jun 21 21:25:38 2012 UTC

# Line 106 | Line 106 | EventData apply_HZZ4L_EMU_selection(Cont
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();
# Line 156 | Line 155 | EventData apply_HZZ4L_EMU_selection(Cont
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);
162        if( !(elesel.getStatus() & SelectionStatus::PRESELECTION) ) continue;
163        
164          elesel |= (*ElectronIDSelector)(ctrl,ele,vtx);
165 <        
166 <        if( !(ctrl.doFSR) ) {
167 <          elesel |= (*ElectronIsoSelector)(ctrl,ele,vtx,pfCandidates,puEnergyDensity,eraEle,photonsToVeto);
168 <        }
165 >        elesel |= (*ElectronIsoSelector)(ctrl,ele,vtx,pfCandidates,puEnergyDensity,eraEle,photonsToVeto);
166          
167          SimpleLepton tmplep;
168          float pt = ele->Pt();
# Line 216 | Line 213 | EventData apply_HZZ4L_EMU_selection(Cont
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 ) {
# Line 261 | Line 258 | EventData apply_HZZ4L_EMU_selection(Cont
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 {
272 <        ret.status.setStatus(SelectionStatus::FAIL);
273 <      }
274 <      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   }
277
278 // //----------------------------------------------------------------------------
279 // //
280 // // Get primary vertices
281 // // Assumes primary vertices are ordered by sum-pT^2 (as should be in CMSSW)
282 // // NOTE: if no PV is found from fitting tracks, the beamspot is used
283 // //
284 // //----------------------------------------------------------------------------
285 // bool setPV(ControlFlags ctrl,
286 //         const mithep::Array<mithep::Vertex> * vtxArr,
287 //         const mithep::Vertex* &vtx)
288 // //----------------------------------------------------------------------------
289 // {
290
291 //   const mithep::Vertex *bestPV = 0;    
292 //   float best_sumpt=-1;
293
294 //   // good PV requirements
295 //   const UInt_t   fMinNTracksFit = 0;
296 //   const Double_t fMinNdof       = 4;
297 //   const Double_t fMaxAbsZ       = 24;
298 //   const Double_t fMaxRho        = 2;
299  
300 //   for(int i=0; i<vtxArr->GetEntries(); ++i) {
301 //     const mithep::Vertex *pv = (mithep::Vertex*)(vtxArr->At(i));
302 //     if( ctrl.debug ) cout << "vertex :: " << i << "\tntrks: " << pv->NTracks() << endl;
303    
304 //     // Select best PV for corrected d0; if no PV passing cuts, the first PV in the collection will be used
305 //     if(!pv->IsValid())                                continue;
306 //     if(pv->NTracksFit()       < fMinNTracksFit)       continue;
307 //     if(pv->Ndof()              < fMinNdof)         continue;
308 //     if(fabs(pv->Z()) > fMaxAbsZ)                   continue;
309 //     if(pv->Position().Rho()   > fMaxRho)           continue;    
310    
311 //     // take the first ...
312 //     bestPV = pv;
313 //     break;
314
315 //     // this never reached ...    
316 //     float tmp_sumpt=0;
317 //     for( int t=0; t<pv->NTracks(); t++ )
318 //       tmp_sumpt += pv->Trk(t)->Pt();
319    
320 //     if( tmp_sumpt > best_sumpt  ) {
321 //       bestPV = pv;
322 //       best_sumpt = tmp_sumpt;
323 //       if( ctrl.debug) cout << "new PV set, pt : " << best_sumpt << endl;
324 //     }
325 //   }
326        
327 //   // sync
328 //   if(!bestPV)
329 //     return false;
330 //   else {    
331 //     vtx = bestPV;
332 //     return true;
333 //   }  
334 // };
272   //----------------------------------------------------------------------------------------
273   bool has_ssof_lepton(ControlFlags &ctrl)
274   {
# Line 362 | Line 299 | bool has_ssof_lepton(ControlFlags &ctrl)
299  
300    return has_ssof;
301   }
365 // //----------------------------------------------------------------------------------------
366 // void getEATargets(ControlFlags &ctrl, mithep::MuonTools::EMuonEffectiveAreaTarget &eraMu, mithep::ElectronTools::EElectronEffectiveAreaTarget &eraEle)
367 // {
368 //   if( !ctrl.mc && ctrl.era == 2011 ) {
369 //     eraMu  = mithep::MuonTools::kMuEAData2011;
370 //     eraEle = mithep::ElectronTools::kEleEAData2011;
371 //   } else if( !ctrl.mc && ctrl.era == 2012 ) {
372 //     eraMu  = mithep::MuonTools::kMuEAData2012;
373 //     eraEle = mithep::ElectronTools::kEleEAData2012;
374 //   } else if( ctrl.mc && ctrl.era == 2011 ) {
375 //     eraMu  = mithep::MuonTools::kMuEAFall11MC;
376 //     eraEle = mithep::ElectronTools::kEleEAFall11MC;
377 //   } else if( ctrl.mc && ctrl.era == 2012 ) {
378 //     eraMu  = mithep::MuonTools::kMuEAData2012;
379 //     eraEle = mithep::ElectronTools::kEleEAData2012;
380 //   } else {
381 //     cerr << "unknown era for effective areas ... quitting." << endl;
382 //     exit(1);
383 //   }
384 // }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines