CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonSelector.cc
Go to the documentation of this file.
3 
5 
7 using namespace reco;
8 
9 
10 //______________________________________________________________________________
12 MuonSelector::filter( const unsigned int& index,
13  const edm::View<Muon>& muons ) const
14 {
15 
16  // List of possible selections
17  if ( config_.selectionType == "none" )
18  {
19  return GOOD;
20  }
21  else if ( config_.selectionType == "globalMuons" )
22  {
23  if ( muons[index].isGlobalMuon() ) return GOOD;
24  else return BAD;
25  }
26  else if ( config_.selectionType == "muonPOG" )
27  {
28  return muIdSelection_( index, muons );
29  }
30  else if ( config_.selectionType == "custom" )
31  {
32  return customSelection_( index, muons );
33  }
34 
35  // Throw! unknown configuration
37  << "Unknown electron ID selection " << config_.selectionType;
38 
39 }
40 
41 //______________________________________________________________________________
43 MuonSelector::customSelection_( const unsigned int& index,
44  const edm::View<Muon>& muons ) const
45 {
46 
47  // Custom muon selection from SusyAnalyzer (TQAF has a subset of these cuts)
48 
49  // Use global muon if possible
50  TrackRef muontrack;
51  if ( muons[index].isGlobalMuon() )
52  muontrack = muons[index].track();
53  else
54  muontrack = muons[index].combinedMuon();
55 
56  float pt_track = muontrack->pt();
57  float dpt_track = muontrack->error(0)/muontrack->qoverp()*muontrack->pt();
58  float chisq = muontrack->normalizedChi2();
59  int nHitsValid = muontrack->numberOfValidHits();
60 
61  if ( dpt_track >= config_.dPbyPmax * pt_track ) return BAD;
62 
63  if ( chisq > config_.chi2max ) return BAD;
64 
65  if ( nHitsValid < config_.nHitsMin ) return BAD;
66 
67  return GOOD;
68 
69 }
70 
71 
72 //______________________________________________________________________________
74 MuonSelector::muIdSelection_( const unsigned int& index,
75  const edm::View<Muon>& muons ) const
76 {
77  // MuonID algorithm
78  if ( muon::isGoodMuon((muons[index]),config_.flag) )
79  {
80  return BAD;
81  }
82 
83  // Direct cuts on compatibility
84  if ( muons[index].caloCompatibility() <= config_.minCaloCompatibility
85  || muon::segmentCompatibility(muons[index]) <= config_.minSegmentCompatibility )
86  {
87  return BAD;
88  }
89 
90  return GOOD;
91 }
SingleObjectSelector< edm::View< reco::Muon >, StringCutObjectSelector< reco::Muon >, reco::MuonCollection > MuonSelector
Definition: MuonSelector.cc:36
float caloCompatibility(const reco::Muon &muon)
1: Failed selection (without additional info)
Definition: ParticleCode.h:34
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
0: Passed selection
Definition: ParticleCode.h:33
tuple muons
Definition: patZpeak.py:38
ParticleStatus
Definition of particle status after selection.
Definition: ParticleCode.h:32