CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
pat::MuonSelector Class Reference

Selects good muons. More...

#include "PhysicsTools/PatUtils/MuonSelector.h"

Public Member Functions

const pat::ParticleStatus filter (const unsigned int &index, const edm::View< reco::Muon > &muons) const
 
 MuonSelector (const MuonSelection &cfg)
 
 ~MuonSelector ()
 

Private Member Functions

const pat::ParticleStatus customSelection_ (const unsigned int &index, const edm::View< reco::Muon > &muons) const
 Full-fledged selection based on SusyAnalyser. More...
 
const pat::ParticleStatus muIdSelection_ (const unsigned int &index, const edm::View< reco::Muon > &muons) const
 

Private Attributes

MuonSelection config_
 

Detailed Description

Selects good muons.

The muon selector returns a flag (see pat::ParticleStatus) based on one of the possible selections: reconstruction-based (global muons) or muId based (various algorithms), or custom (user-defined set of cuts). This is driven by the configuration parameters (see the PATMuonCleaner documentation for configuration details).

The parameters are passed to the selector through an MuonSelection struct. (An adapter exists for use in CMSSW: reco::modules::ParameterAdapter< pat::MuonSelector >.)

Author
F.J. Ronga (ETH Zurich)
Version
Id:
MuonSelector.h,v 1.7 2008/10/10 13:59:06 lowette Exp

Definition at line 50 of file MuonSelector.h.

Constructor & Destructor Documentation

pat::MuonSelector::MuonSelector ( const MuonSelection cfg)
inline

Definition at line 54 of file MuonSelector.h.

54 : config_( cfg ) {}
tuple cfg
Definition: looper.py:259
MuonSelection config_
Definition: MuonSelector.h:65
pat::MuonSelector::~MuonSelector ( )
inline

Definition at line 55 of file MuonSelector.h.

55 {}

Member Function Documentation

const pat::ParticleStatus MuonSelector::customSelection_ ( const unsigned int &  index,
const edm::View< reco::Muon > &  muons 
) const
private

Full-fledged selection based on SusyAnalyser.

Definition at line 43 of file MuonSelector.cc.

References pat::BAD, pat::GOOD, and cmsHarvester::index.

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 }
1: Failed selection (without additional info)
Definition: ParticleCode.h:34
MuonSelection config_
Definition: MuonSelector.h:65
0: Passed selection
Definition: ParticleCode.h:33
const pat::ParticleStatus MuonSelector::filter ( const unsigned int &  index,
const edm::View< reco::Muon > &  muons 
) const

Returns 0 if muon matches criteria, a flag otherwise. Criteria depend on the selector's configuration.

Definition at line 12 of file MuonSelector.cc.

References pat::BAD, edm::errors::Configuration, edm::hlt::Exception, and pat::GOOD.

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 }
const pat::ParticleStatus customSelection_(const unsigned int &index, const edm::View< reco::Muon > &muons) const
Full-fledged selection based on SusyAnalyser.
Definition: MuonSelector.cc:43
1: Failed selection (without additional info)
Definition: ParticleCode.h:34
std::string selectionType
Choose selection type (see PATMuonCleaner)
Definition: MuonSelector.h:31
const pat::ParticleStatus muIdSelection_(const unsigned int &index, const edm::View< reco::Muon > &muons) const
Definition: MuonSelector.cc:74
MuonSelection config_
Definition: MuonSelector.h:65
0: Passed selection
Definition: ParticleCode.h:33
const pat::ParticleStatus MuonSelector::muIdSelection_ ( const unsigned int &  index,
const edm::View< reco::Muon > &  muons 
) const
private

Definition at line 74 of file MuonSelector.cc.

References pat::BAD, muon::caloCompatibility(), pat::GOOD, muon::isGoodMuon(), and muon::segmentCompatibility().

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
86  {
87  return BAD;
88  }
89 
90  return GOOD;
91 }
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)
double minCaloCompatibility
Definition: MuonSelector.h:43
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
MuonSelection config_
Definition: MuonSelector.h:65
muon::SelectionType flag
Definition: MuonSelector.h:42
0: Passed selection
Definition: ParticleCode.h:33
double minSegmentCompatibility
Definition: MuonSelector.h:44

Member Data Documentation

MuonSelection pat::MuonSelector::config_
private

Definition at line 65 of file MuonSelector.h.