CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | Private Attributes
PFMuonSelector Class Reference

#include <PFMuonSelector.h>

Inheritance diagram for PFMuonSelector:
Selector< pat::Muon >

Public Types

enum  Version_t { TOPPAG12_LJETS, N_VERSIONS }
 
- Public Types inherited from Selector< pat::Muon >
typedef std::pair< index_type, size_t > cut_flow_item
 
typedef std::vector< cut_flow_itemcut_flow_map
 
typedef pat::Muon data_type
 
typedef std::map< index_type, double > double_map
 
typedef pat::strbitset::index_type index_type
 
typedef std::map< index_type, int > int_map
 

Public Member Functions

void initialize (Version_t version, double chi2=10.0, int minTrackerLayers=6, int minValidMuonHits=1, double maxIp=0.2, int minPixelHits=1, int minNMatches=2, double pfiso=0.12)
 
bool operator() (const pat::Muon &muon, pat::strbitset &ret) override
 This provides the interface for base classes to select objects. More...
 
 PFMuonSelector ()
 
 PFMuonSelector (edm::ParameterSet const &parameters)
 
 PFMuonSelector (edm::ParameterSet const &parameters, edm::ConsumesCollector &&iC)
 
bool TopPag12LjetsCuts (const pat::Muon &muon, pat::strbitset &ret)
 
- Public Member Functions inherited from Selector< pat::Muon >
void clear (index_type const &i)
 
void clear (std::string const &s)
 Turn off a given selection cut. More...
 
bool considerCut (index_type const &i) const
 
bool considerCut (std::string const &s) const
 consider the cut at index "s" More...
 
double cut (index_type const &i, double val) const
 Access the double cut values at index "s". More...
 
int cut (index_type const &i, int val) const
 Access the int cut values at index "s". More...
 
double cut (std::string s, double val) const
 Access the double cut values at index "s". More...
 
int cut (std::string s, int val) const
 Access the int cut values at index "s". More...
 
pat::strbitset getBitTemplate () const
 Get an empty bitset with the proper names. More...
 
double getPasses (index_type const &i) const
 
double getPasses (std::string const &s) const
 Return the number of passing cases. More...
 
bool ignoreCut (index_type const &i) const
 
bool ignoreCut (std::string const &s) const
 ignore the cut at index "s" More...
 
virtual bool operator() (pat::Muon const &t)
 This provides an alternative signature without the second ret. More...
 
virtual bool operator() (pat::Muon const &t, edm::EventBase const &e)
 This provides an alternative signature that includes extra information. More...
 
virtual bool operator() (pat::Muon const &t, edm::EventBase const &e, pat::strbitset &ret)
 This provides an alternative signature that includes extra information. More...
 
bool operator[] (index_type const &i) const
 
bool operator[] (std::string const &s) const
 
void passCut (pat::strbitset &ret, index_type const &i)
 
void passCut (pat::strbitset &ret, std::string const &s)
 Passing cuts. More...
 
void print (std::ostream &out) const
 Print the cut flow. More...
 
void printActiveCuts (std::ostream &out) const
 Print the cuts being considered. More...
 
virtual void push_back (std::string const &s)
 This is the registration of an individual cut string. More...
 
virtual void push_back (std::string const &s, double cut)
 This is the registration of an individual cut string, with a double cut value. More...
 
virtual void push_back (std::string const &s, int cut)
 This is the registration of an individual cut string, with an int cut value. More...
 
 Selector ()
 Constructor clears the bits. More...
 
void set (index_type const &i, bool val=true)
 
void set (index_type const &i, double cut, bool val=true)
 
void set (index_type const &i, int cut, bool val=true)
 
void set (std::string const &s, bool val=true)
 Set a given selection cut, on or off. More...
 
void set (std::string const &s, double cut, bool val=true)
 Set a given selection cut, on or off, and reset int cut value. More...
 
void set (std::string const &s, int cut, bool val=true)
 Set a given selection cut, on or off, and reset int cut value. More...
 
void setIgnored (pat::strbitset &ret)
 set ignored bits More...
 
void setIgnoredCuts (std::vector< std::string > const &bitsToIgnore)
 set the bits to ignore from a vector More...
 
virtual ~Selector ()
 

Public Attributes

bool verbose_
 

Private Attributes

index_type indexChi2_
 
index_type indexMaxIp_
 
index_type indexmaxPfRelIso_
 
index_type indexMinTrackerLayers_
 
index_type indexminValidMuHits_
 
index_type indexPixHits_
 
index_type indexStations_
 
Version_t version_
 

Additional Inherited Members

- Protected Attributes inherited from Selector< pat::Muon >
pat::strbitset bits_
 the bitset indexed by strings More...
 
cut_flow_map cutFlow_
 map of cut flows in "human" order More...
 
double_map doubleCuts_
 the double-value cut map More...
 
int_map intCuts_
 the int-value cut map More...
 
pat::strbitset retInternal_
 internal ret if users don't care about return bits More...
 

Detailed Description

Definition at line 16 of file PFMuonSelector.h.

Member Enumeration Documentation

◆ Version_t

Enumerator
TOPPAG12_LJETS 
N_VERSIONS 

Definition at line 20 of file PFMuonSelector.h.

Constructor & Destructor Documentation

◆ PFMuonSelector() [1/3]

PFMuonSelector::PFMuonSelector ( )
inline

Definition at line 22 of file PFMuonSelector.h.

22 {}

◆ PFMuonSelector() [2/3]

PFMuonSelector::PFMuonSelector ( edm::ParameterSet const &  parameters,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 25 of file PFMuonSelector.h.

◆ PFMuonSelector() [3/3]

PFMuonSelector::PFMuonSelector ( edm::ParameterSet const &  parameters)
inline

Definition at line 28 of file PFMuonSelector.h.

28  {
29  verbose_ = false;
30 
31  std::string versionStr = parameters.getParameter<std::string>("version");
32 
34 
35  if (versionStr == "TOPPAG12_LJETS") {
37  } else {
38  throw cms::Exception("InvalidInput") << "Expect version to be one of SPRING11" << std::endl;
39  }
40 
42  parameters.getParameter<double>("Chi2"),
43  parameters.getParameter<int>("minTrackerLayers"),
44  parameters.getParameter<int>("minValidMuHits"),
45  parameters.getParameter<double>("maxIp"),
46  parameters.getParameter<int>("minPixelHits"),
47  parameters.getParameter<int>("minMatchedStations"),
48  parameters.getParameter<double>("maxPfRelIso"));
49  if (parameters.exists("cutsToIgnore"))
50  setIgnoredCuts(parameters.getParameter<std::vector<std::string> >("cutsToIgnore"));
51 
53  }

References Exception, Selector< pat::Muon >::getBitTemplate(), initialize(), N_VERSIONS, Selector< pat::Muon >::retInternal_, Selector< pat::Muon >::setIgnoredCuts(), AlCaHLTBitMon_QueryRunRegistry::string, TOPPAG12_LJETS, verbose_, and BeamSplash_cfg::version.

Member Function Documentation

◆ initialize()

void PFMuonSelector::initialize ( Version_t  version,
double  chi2 = 10.0,
int  minTrackerLayers = 6,
int  minValidMuonHits = 1,
double  maxIp = 0.2,
int  minPixelHits = 1,
int  minNMatches = 2,
double  pfiso = 0.12 
)
inline

Definition at line 55 of file PFMuonSelector.h.

62  {
63  version_ = version;
64 
65  push_back("GlobalMuon", true);
66  push_back("TrackerMuon", true);
67  push_back("Chi2", chi2);
68  push_back("minTrackerLayers", minTrackerLayers);
69  push_back("minValidMuHits", minValidMuonHits);
70  push_back("maxIp", maxIp);
71  push_back("minPixelHits", minPixelHits);
72  push_back("minMatchedStations", minNMatches);
73  push_back("maxPfRelIso", pfiso);
74 
75  set("GlobalMuon");
76  set("TrackerMuon");
77  set("Chi2");
78  set("minTrackerLayers");
79  set("minValidMuHits");
80  set("maxIp");
81  set("minPixelHits");
82  set("minMatchedStations");
83  set("maxPfRelIso");
84 
85  indexChi2_ = index_type(&bits_, "Chi2");
86  indexMinTrackerLayers_ = index_type(&bits_, "minTrackerLayers");
87  indexminValidMuHits_ = index_type(&bits_, "minValidMuHits");
88  indexMaxIp_ = index_type(&bits_, "maxIp");
89  indexPixHits_ = index_type(&bits_, "minPixelHits");
90  indexStations_ = index_type(&bits_, "minMatchedStations");
91  indexmaxPfRelIso_ = index_type(&bits_, "maxPfRelIso");
92 
93  if (version_ == TOPPAG12_LJETS) {
94  set("TrackerMuon", false);
95  }
96  }

References Selector< pat::Muon >::bits_, hltPixelTracks_cff::chi2, indexChi2_, indexMaxIp_, indexmaxPfRelIso_, indexMinTrackerLayers_, indexminValidMuHits_, indexPixHits_, indexStations_, pfMuonSelector_cfi::maxIp, beam_dqm_sourceclient-live_cfg::minPixelHits, pfMuonSelector_cfi::minTrackerLayers, Selector< pat::Muon >::push_back(), Selector< pat::Muon >::set(), TOPPAG12_LJETS, BeamSplash_cfg::version, and version_.

Referenced by PFMuonSelector().

◆ operator()()

bool PFMuonSelector::operator() ( const pat::Muon t,
pat::strbitset ret 
)
inlineoverridevirtual

This provides the interface for base classes to select objects.

Implements Selector< pat::Muon >.

Definition at line 99 of file PFMuonSelector.h.

99  {
100  if (version_ == TOPPAG12_LJETS)
101  return TopPag12LjetsCuts(muon, ret);
102  else {
103  return false;
104  }
105  }

References runTheMatrix::ret, TOPPAG12_LJETS, TopPag12LjetsCuts(), and version_.

◆ TopPag12LjetsCuts()

bool PFMuonSelector::TopPag12LjetsCuts ( const pat::Muon muon,
pat::strbitset ret 
)
inline

Definition at line 109 of file PFMuonSelector.h.

109  {
110  ret.set(false);
111 
112  bool isGlobal = muon.isGlobalMuon();
113  bool isTracker = muon.isTrackerMuon();
114 
115  double norm_chi2 = 9999999.0;
116  int minTrackerLayers = 0;
117  int minValidMuonHits = 0;
118  int _ip = 0.0;
119  int minPixelHits = 0;
120  if (muon.globalTrack().isNonnull() && muon.globalTrack().isAvailable()) {
121  norm_chi2 = muon.normChi2();
122  minTrackerLayers = static_cast<int>(muon.track()->hitPattern().trackerLayersWithMeasurement());
123  minValidMuonHits = static_cast<int>(muon.globalTrack()->hitPattern().numberOfValidMuonHits());
124  _ip = muon.dB();
125  minPixelHits = muon.innerTrack()->hitPattern().numberOfValidPixelHits();
126  }
127 
128  int minMatchedStations = muon.numberOfMatches();
129 
130  double chIso = muon.userIsolation(pat::PfChargedHadronIso);
131  double nhIso = muon.userIsolation(pat::PfNeutralHadronIso);
132  double gIso = muon.userIsolation(pat::PfGammaIso);
133  double pt = muon.pt();
134 
135  double pfIso = (chIso + nhIso + gIso) / pt;
136 
137  if (isGlobal || ignoreCut("GlobalMuon"))
138  passCut(ret, "GlobalMuon");
139  if (isTracker || ignoreCut("TrackerMuon"))
140  passCut(ret, "TrackerMuon");
141  if (norm_chi2 < cut(indexChi2_, double()) || ignoreCut(indexChi2_))
145  if (minValidMuonHits >= cut(indexminValidMuHits_, int()) || ignoreCut(indexminValidMuHits_))
147  if (_ip < cut(indexMaxIp_, double()) || ignoreCut(indexMaxIp_))
153  if (pfIso < cut(indexmaxPfRelIso_, double()) || ignoreCut(indexmaxPfRelIso_))
155 
156  setIgnored(ret);
157 
158  return (bool)ret;
159  }

References Selector< pat::Muon >::cut(), Selector< pat::Muon >::ignoreCut(), indexChi2_, indexMaxIp_, indexmaxPfRelIso_, indexMinTrackerLayers_, indexminValidMuHits_, indexPixHits_, indexStations_, muons_cff::isGlobal, muons_cff::isTracker, pfMuonSelector_cfi::minMatchedStations, beam_dqm_sourceclient-live_cfg::minPixelHits, pfMuonSelector_cfi::minTrackerLayers, Selector< pat::Muon >::passCut(), pat::PfChargedHadronIso, pat::PfGammaIso, pat::PfNeutralHadronIso, DiDispStaMuonMonitor_cfi::pt, runTheMatrix::ret, and Selector< pat::Muon >::setIgnored().

Referenced by operator()().

Member Data Documentation

◆ indexChi2_

index_type PFMuonSelector::indexChi2_
private

Definition at line 164 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

◆ indexMaxIp_

index_type PFMuonSelector::indexMaxIp_
private

Definition at line 167 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

◆ indexmaxPfRelIso_

index_type PFMuonSelector::indexmaxPfRelIso_
private

Definition at line 170 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

◆ indexMinTrackerLayers_

index_type PFMuonSelector::indexMinTrackerLayers_
private

Definition at line 165 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

◆ indexminValidMuHits_

index_type PFMuonSelector::indexminValidMuHits_
private

Definition at line 166 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

◆ indexPixHits_

index_type PFMuonSelector::indexPixHits_
private

Definition at line 168 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

◆ indexStations_

index_type PFMuonSelector::indexStations_
private

Definition at line 169 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

◆ verbose_

bool PFMuonSelector::verbose_

Definition at line 18 of file PFMuonSelector.h.

Referenced by PFMuonSelector().

◆ version_

Version_t PFMuonSelector::version_
private

Definition at line 162 of file PFMuonSelector.h.

Referenced by initialize(), and operator()().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
PFMuonSelector::indexmaxPfRelIso_
index_type indexmaxPfRelIso_
Definition: PFMuonSelector.h:170
Selector< pat::Muon >::setIgnored
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:181
Selector< pat::Muon >::bits_
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:241
Selector< pat::Muon >::index_type
pat::strbitset::index_type index_type
Definition: Selector.h:25
muon
Definition: MuonCocktails.h:17
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
Selector< pat::Muon >::retInternal_
pat::strbitset retInternal_
internal ret if users don't care about return bits
Definition: Selector.h:242
Selector< pat::Muon >::ignoreCut
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:127
PFMuonSelector::N_VERSIONS
Definition: PFMuonSelector.h:20
PFMuonSelector::indexChi2_
index_type indexChi2_
Definition: PFMuonSelector.h:164
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
PFMuonSelector::indexMinTrackerLayers_
index_type indexMinTrackerLayers_
Definition: PFMuonSelector.h:165
PFMuonSelector::indexminValidMuHits_
index_type indexminValidMuHits_
Definition: PFMuonSelector.h:166
pat::PfChargedHadronIso
Definition: Isolation.h:14
Selector< pat::Muon >::push_back
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Definition: Selector.h:42
pfMuonSelector_cfi.minTrackerLayers
minTrackerLayers
Definition: pfMuonSelector_cfi.py:6
PFMuonSelector::PFMuonSelector
PFMuonSelector()
Definition: PFMuonSelector.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
beam_dqm_sourceclient-live_cfg.minPixelHits
minPixelHits
Definition: beam_dqm_sourceclient-live_cfg.py:125
Selector< pat::Muon >::getBitTemplate
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:168
PFMuonSelector::Version_t
Version_t
Definition: PFMuonSelector.h:20
pat::PfGammaIso
Definition: Isolation.h:16
Selector< pat::Muon >::passCut
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:142
PFMuonSelector::indexMaxIp_
index_type indexMaxIp_
Definition: PFMuonSelector.h:167
PFMuonSelector::verbose_
bool verbose_
Definition: PFMuonSelector.h:18
PFMuonSelector::initialize
void initialize(Version_t version, double chi2=10.0, int minTrackerLayers=6, int minValidMuonHits=1, double maxIp=0.2, int minPixelHits=1, int minNMatches=2, double pfiso=0.12)
Definition: PFMuonSelector.h:55
pfMuonSelector_cfi.minMatchedStations
minMatchedStations
Definition: pfMuonSelector_cfi.py:10
pat::PfNeutralHadronIso
Definition: Isolation.h:15
Selector< pat::Muon >::setIgnoredCuts
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
Definition: Selector.h:131
muons_cff.isGlobal
isGlobal
Definition: muons_cff.py:149
PFMuonSelector::TOPPAG12_LJETS
Definition: PFMuonSelector.h:20
PFMuonSelector::version_
Version_t version_
Definition: PFMuonSelector.h:162
pfMuonSelector_cfi.maxIp
maxIp
Definition: pfMuonSelector_cfi.py:8
PFMuonSelector::indexStations_
index_type indexStations_
Definition: PFMuonSelector.h:169
Selector< pat::Muon >::cut
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
Definition: Selector.h:158
Exception
Definition: hltDiff.cc:246
Selector< pat::Muon >::set
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
Definition: Selector.h:93
muons_cff.isTracker
isTracker
Definition: muons_cff.py:150
PFMuonSelector::TopPag12LjetsCuts
bool TopPag12LjetsCuts(const pat::Muon &muon, pat::strbitset &ret)
Definition: PFMuonSelector.h:109
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
PFMuonSelector::indexPixHits_
index_type indexPixHits_
Definition: PFMuonSelector.h:168