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

Comparing UserCode/MitHzz4l/LeptonSelection/src/MuonSelection.cc (file contents):
Revision 1.7 by khahn, Mon Apr 30 21:42:16 2012 UTC vs.
Revision 1.11 by khahn, Thu May 3 22:06:47 2012 UTC

# Line 19 | Line 19 | extern Float_t computePFMuonIso(const mi
19                          const Double_t dRMax);
20  
21   //--------------------------------------------------------------------------------------------------
22 + SelectionStatus muonDummyVeto(ControlFlags &ctrl,
23 +                              const mithep::Muon *muon,
24 +                              const mithep::Vertex &vtx)
25 + //--------------------------------------------------------------------------------------------------
26 + {
27 +  SelectionStatus status;
28 +  status.setStatus(SelectionStatus::PRESELECTION);
29 +  return status;  
30 + }
31 +
32 + //--------------------------------------------------------------------------------------------------
33 + SelectionStatus muonCutBasedVeto(ControlFlags &ctrl,
34 +                                 const mithep::Muon *muon,
35 +                                 const mithep::Vertex &vtx)
36 + //--------------------------------------------------------------------------------------------------
37 + {
38 +  //
39 +  // Loose cut-based ID for isolation veto
40 +  //
41 +  bool ret = true;
42 +  
43 +  if(!(muon->IsGlobalMuon() || muon->IsTrackerMuon())) ret = false;
44 +  if( muon->NValidHits() < 11 )                        ret = false;
45 +  if( fabs(muon->Ip3dPVSignificance()) >= 4 )          ret = false;
46 +
47 +  SelectionStatus status;
48 +  if( ret ) status.setStatus(SelectionStatus::PRESELECTION);
49 +  return status;
50 + }
51 +
52 +
53 + //--------------------------------------------------------------------------------------------------
54   SelectionStatus noPreSelection( ControlFlags &ctrl,  const mithep::Muon * mu )
55  
56   //--------------------------------------------------------------------------------------------------
# Line 46 | Line 78 | SelectionStatus muonPreSelection( Contro
78    if(ctrl.debug) cout << "and >5 GeV (" << mu->Pt() << ") ? ... " << ret << endl;  
79    ret &= ( fabs(mu->Eta()) <= 2.4 );
80    if(ctrl.debug) cout << "and < 2.4 eta (" << mu->Eta() << ")? ... " << ret << endl;  
81 <  ret &=  (mu->IsTrackerMuon() && mu->HasTrackerTrk() &&
82 <           (mu->Quality().QualityMask().Mask() & mithep::MuonQuality::AllArbitrated));
83 <  if(ctrl.debug) cout << "and isTrackerMuon ? ... " << ret << endl;  
84 <  //  ret &=  (mu->IsoR03SumPt()/mu->Pt() < 0.7 );
85 <  ret &=  (mu->IsoR03SumPt()/mu->Pt() < 0.7 );
86 <  if(ctrl.debug) cout << "and loose trk iso ? ... " << ret << endl;  
81 >  ret &= ( mu->IsTrackerMuon() || mu->IsGlobalMuon() );
82 >  if(ctrl.debug) cout << "is Tracker or Global? ... " << ret << endl;  
83 >  if( mu->IsTrackerMuon() && mu->HasTrackerTrk() && !mu->IsGlobalMuon() )  
84 >    ret &=  ( mu->Quality().QualityMask().Mask() & mithep::MuonQuality::AllArbitrated);
85 >  if(ctrl.debug) cout << "if isTrackerMuon, arbitrated ? ... " << ret << endl;  
86 >  ret &= ( mu->BestTrk()->DzCorrected(vtx) < 0.1);  
87 >  if( ctrl.debug ) cout << "elepresel : ret after dZcorr : " << ret <<  endl;
88 >
89  
90    SelectionStatus status;
91    if( ret ) status.setStatus(SelectionStatus::PRESELECTION);
# Line 315 | Line 349 | SelectionStatus muonIDMVASelection(Contr
349                                   const mithep::Vertex & vtx   )
350   //--------------------------------------------------------------------------------------------------
351   {
318  assert(mu->IsTrackerMuon()); // must be
319  assert(mu->HasTrackerTrk());
320  assert(mu->TrackerTrk());
321
322  /*
323  cerr << "TrackerTrk: " << mu->TrackerTrk() << endl;
324  flush(cerr);
325  cerr << "Rchi2: " << mu->TrackerTrk()->RChi2() << endl;
326  flush(cerr);
327
328  cerr << "calling MVa ... "<< endl;
329  flush(cerr);
330  */
331
352    double global_rchi2 = (mu->IsGlobalMuon()) ? mu->GlobalTrk()->RChi2() : 0.;
353  
354    double mvaval = muIDMVA->MVAValue_ID(mu->Pt(),
# Line 338 | Line 358 | SelectionStatus muonIDMVASelection(Contr
358                                      mu->TrackerTrk()->RChi2(),
359                                      global_rchi2,
360                                      (Double_t)(mu->NValidHits()),
361 <                                    (Double_t)(mu->TrackerTrk()->NHits()),
361 >                                    (Double_t)(mu->TrackerTrk()->NHits()),
362                                      (Double_t)(mu->TrackerTrk()->NPixelHits()),
363                                      (Double_t)(mu->NMatches()),
364                                      mu->TrkKink(),
# Line 362 | Line 382 | SelectionStatus muonIDMVASelection(Contr
382             && fabs(mu->Eta()) > 1.5 && mu->Pt() <= 10 && mvaval >= MUON_IDMVA_CUT_BIN2)  pass = true;
383    else if( mu->IsGlobalMuon() && mu->IsTrackerMuon()
384             && fabs(mu->Eta()) > 1.5 && mu->Pt() > 10 && mvaval >= MUON_IDMVA_CUT_BIN3)  pass = true;
385 <  else if( !(mu->IsGlobalMuon()) && mu->IsTrackerMuon()
386 <           && (mu->Quality().QualityMask().Mask() & mithep::MuonQuality::AllArbitrated) && mvaval >= MUON_IDMVA_CUT_BIN4)
387 <    pass = true;
385 >  else if( !(mu->IsGlobalMuon()) && mu->IsTrackerMuon() && mvaval >= MUON_IDMVA_CUT_BIN4 )  pass = true;
386 >  else if( mu->IsGlobalMuon() && !(mu->IsTrackerMuon()) && mvaval >= MUON_IDMVA_CUT_BIN5 )  pass = true;
387 >  
388  
389  
390    if( pass ) {
# Line 391 | Line 411 | void initMuonIDMVA()
411                         mithep::MuonIDMVA::kIDV0,
412                         kTRUE, weightFiles);
413   }
414 +
415 + //--------------------------------------------------------------------------------------------------
416 + SelectionStatus muonIDPFSelection(ControlFlags &ctrl,
417 +                                  const mithep::Muon *mu,
418 +                                  const mithep::Vertex & vtx,
419 +                                  const mithep::Array<mithep::PFCandidate> * pfCandidates )
420 + //--------------------------------------------------------------------------------------------------
421 + {
422 +  bool pass = false;
423 +  SelectionStatus status; // init'ed to FAIL
424 +
425 +  // check that it matches to a PF muon
426 +  for( int i=0; i<pfCandidates->GetEntries(); i++ ) {
427 +    const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*pfCandidates)[i]);
428 +    if( pf->HasTrackerTrk() ) {
429 +      if( (pf->TrackerTrk() == mu->TrackerTrk()) && abs(pf->PFType()) == mithep::PFCandidate::eMuon ) {
430 +        pass = true;
431 +        break;
432 +      }
433 +    }
434 +  }
435 +
436 +  if( pass ) {
437 +    status.orStatus(SelectionStatus::LOOSEID);
438 +    status.orStatus(SelectionStatus::TIGHTID);
439 +  }
440 +
441 +  return status;
442 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines