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) {}

◆ ~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.

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 }

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

◆ 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.

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 }

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

◆ 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.

59  {
60  // MuonID algorithm
62  return BAD;
63  }
64 
65  // Direct cuts on compatibility
68  return BAD;
69  }
70 
71  return GOOD;
72 }

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

Member Data Documentation

◆ config_

MuonSelection pat::MuonSelector::config_
private

Definition at line 58 of file MuonSelector.h.

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
pat::MuonSelection::chi2max
double chi2max
Definition: MuonSelector.h:36
pat::MuonSelection::dPbyPmax
double dPbyPmax
Definition: MuonSelector.h:35
muon::segmentCompatibility
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
Definition: MuonSelectors.cc:61
pat::MuonSelection::flag
muon::SelectionType flag
Definition: MuonSelector.h:42
pat::GOOD
0: Passed selection
Definition: ParticleCode.h:31
edm::Ref< TrackCollection >
muon::isGoodMuon
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
Definition: MuonSelectors.cc:664
pat::MuonSelection::minCaloCompatibility
double minCaloCompatibility
Definition: MuonSelector.h:43
muon::caloCompatibility
float caloCompatibility(const reco::Muon &muon)
Definition: MuonSelectors.cc:58
pat::MuonSelector::config_
MuonSelection config_
Definition: MuonSelector.h:58
pat::MuonSelection::nHitsMin
int nHitsMin
Definition: MuonSelector.h:37
pat::MuonSelection::selectionType
std::string selectionType
Choose selection type (see PATMuonCleaner)
Definition: MuonSelector.h:31
pat::MuonSelector::customSelection_
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
looper.cfg
cfg
Definition: looper.py:297
pat::MuonSelector::muIdSelection_
const pat::ParticleStatus muIdSelection_(const unsigned int &index, const edm::View< reco::Muon > &muons) const
Definition: MuonSelector.cc:59
Exception
Definition: hltDiff.cc:246
pat::BAD
1: Failed selection (without additional info)
Definition: ParticleCode.h:32
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::errors::Configuration
Definition: EDMException.h:36
pat::MuonSelection::minSegmentCompatibility
double minSegmentCompatibility
Definition: MuonSelector.h:44