CMS 3D CMS Logo

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 48 of file MuonSelector.h.

Constructor & Destructor Documentation

◆ MuonSelector()

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

Definition at line 50 of file MuonSelector.h.

50 : config_(cfg) {}
MuonSelection config_
Definition: MuonSelector.h:58

◆ ~MuonSelector()

pat::MuonSelector::~MuonSelector ( )
inline

Definition at line 51 of file MuonSelector.h.

51 {}

Member Function Documentation

◆ customSelection_()

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 30 of file MuonSelector.cc.

References hcaldqm::constants::BAD, hcaldqm::constants::GOOD, and PDWG_BPHSkim_cff::muons.

31  {
32  // Custom muon selection from SusyAnalyzer (TQAF has a subset of these cuts)
33 
34  // Use global muon if possible
35  TrackRef muontrack;
36  if (muons[index].isGlobalMuon())
37  muontrack = muons[index].track();
38  else
39  muontrack = muons[index].combinedMuon();
40 
41  float pt_track = muontrack->pt();
42  float dpt_track = muontrack->error(0) / muontrack->qoverp() * muontrack->pt();
43  float chisq = muontrack->normalizedChi2();
44  int nHitsValid = muontrack->numberOfValidHits();
45 
46  if (dpt_track >= config_.dPbyPmax * pt_track)
47  return BAD;
48 
49  if (chisq > config_.chi2max)
50  return BAD;
51 
52  if (nHitsValid < config_.nHitsMin)
53  return BAD;
54 
55  return GOOD;
56 }
1: Failed selection (without additional info)
Definition: ParticleCode.h:32
MuonSelection config_
Definition: MuonSelector.h:58
0: Passed selection
Definition: ParticleCode.h:31

◆ filter()

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 10 of file MuonSelector.cc.

References hcaldqm::constants::BAD, edm::errors::Configuration, Exception, hcaldqm::constants::GOOD, and PDWG_BPHSkim_cff::muons.

10  {
11  // List of possible selections
12  if (config_.selectionType == "none") {
13  return GOOD;
14  } else if (config_.selectionType == "globalMuons") {
15  if (muons[index].isGlobalMuon())
16  return GOOD;
17  else
18  return BAD;
19  } else if (config_.selectionType == "muonPOG") {
20  return muIdSelection_(index, muons);
21  } else if (config_.selectionType == "custom") {
22  return customSelection_(index, muons);
23  }
24 
25  // Throw! unknown configuration
26  throw edm::Exception(edm::errors::Configuration) << "Unknown electron ID selection " << config_.selectionType;
27 }
const pat::ParticleStatus customSelection_(const unsigned int &index, const edm::View< reco::Muon > &muons) const
Full-fledged selection based on SusyAnalyser.
Definition: MuonSelector.cc:30
1: Failed selection (without additional info)
Definition: ParticleCode.h:32
const pat::ParticleStatus muIdSelection_(const unsigned int &index, const edm::View< reco::Muon > &muons) const
Definition: MuonSelector.cc:59
std::string selectionType
Choose selection type (see PATMuonCleaner)
Definition: MuonSelector.h:31
MuonSelection config_
Definition: MuonSelector.h:58
0: Passed selection
Definition: ParticleCode.h:31

◆ muIdSelection_()

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

Definition at line 59 of file MuonSelector.cc.

References hcaldqm::constants::BAD, muon::caloCompatibility(), hcaldqm::constants::GOOD, muon::isGoodMuon(), PDWG_BPHSkim_cff::muons, and muon::segmentCompatibility().

59  {
60  // MuonID algorithm
62  return BAD;
63  }
64 
65  // Direct cuts on compatibility
68  return BAD;
69  }
70 
71  return GOOD;
72 }
float caloCompatibility(const reco::Muon &muon)
1: Failed selection (without additional info)
Definition: ParticleCode.h:32
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:58
muon::SelectionType flag
Definition: MuonSelector.h:42
0: Passed selection
Definition: ParticleCode.h:31
double minSegmentCompatibility
Definition: MuonSelector.h:44

Member Data Documentation

◆ config_

MuonSelection pat::MuonSelector::config_
private

Definition at line 58 of file MuonSelector.h.