CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::binary_function
< pat::Muon, pat::strbitset,
bool > 
base_type
 
typedef std::pair< index_type,
size_t > 
cut_flow_item
 
typedef std::vector
< cut_flow_item
cut_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)
 This provides the interface for base classes to select objects. More...
 
 PFMuonSelector ()
 
 PFMuonSelector (edm::ParameterSet const &parameters)
 
bool TopPag12LjetsCuts (const pat::Muon &muon, pat::strbitset &ret)
 
- Public Member Functions inherited from Selector< pat::Muon >
void clear (std::string const &s)
 Turn off a given selection cut. More...
 
void clear (index_type const &i)
 
bool considerCut (std::string const &s) const
 consider the cut at index "s" More...
 
bool considerCut (index_type const &i) const
 
int cut (index_type const &i, int val) const
 Access the int cut values at index "s". More...
 
double cut (index_type const &i, 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...
 
double cut (std::string s, double val) const
 Access the double cut values at index "s". More...
 
pat::strbitset getBitTemplate () const
 Get an empty bitset with the proper names. More...
 
double getPasses (std::string const &s) const
 Return the number of passing cases. More...
 
double getPasses (index_type const &i) const
 
bool ignoreCut (std::string const &s) const
 ignore the cut at index "s" More...
 
bool ignoreCut (index_type const &i) const
 
virtual bool operator() (pat::Muonconst &t)
 This provides an alternative signature without the second ret. More...
 
virtual bool operator() (pat::Muonconst &t, edm::EventBase const &e, pat::strbitset &ret)
 This provides an alternative signature that includes extra information. More...
 
virtual bool operator() (pat::Muonconst &t, edm::EventBase const &e)
 This provides an alternative signature that includes extra information. More...
 
bool operator[] (std::string const &s) const
 
bool operator[] (index_type const &i) const
 
void passCut (pat::strbitset &ret, std::string const &s)
 Passing cuts. More...
 
void passCut (pat::strbitset &ret, index_type const &i)
 
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, int cut)
 This is the registration of an individual cut string, with an int cut value. 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...
 
 Selector ()
 Constructor clears the bits. More...
 
void set (std::string const &s, bool val=true)
 Set a given selection cut, on or off. More...
 
void set (index_type const &i, bool val=true)
 
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 set (index_type const &i, int cut, bool val=true)
 
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 (index_type const &i, double cut, bool val=true)
 
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 13 of file PFMuonSelector.h.

Member Enumeration Documentation

Enumerator
TOPPAG12_LJETS 
N_VERSIONS 

Definition at line 19 of file PFMuonSelector.h.

Constructor & Destructor Documentation

PFMuonSelector::PFMuonSelector ( )
inline

Definition at line 21 of file PFMuonSelector.h.

21 {}
PFMuonSelector::PFMuonSelector ( edm::ParameterSet const &  parameters)
inline

Definition at line 23 of file PFMuonSelector.h.

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

23  {
24 
25  verbose_ = false;
26 
27  std::string versionStr = parameters.getParameter<std::string>("version");
28 
30 
31  if ( versionStr == "TOPPAG12_LJETS" ) {
32  version = TOPPAG12_LJETS;
33  }
34  else {
35  throw cms::Exception("InvalidInput") << "Expect version to be one of SPRING11" << std::endl;
36  }
37 
38  initialize( version,
39  parameters.getParameter<double>("Chi2"),
40  parameters.getParameter<int> ("minTrackerLayers"),
41  parameters.getParameter<int> ("minValidMuHits"),
42  parameters.getParameter<double>("maxIp"),
43  parameters.getParameter<int> ("minPixelHits"),
44  parameters.getParameter<int> ("minMatchedStations"),
45  parameters.getParameter<double>("maxPfRelIso")
46  );
47  if ( parameters.exists("cutsToIgnore") )
48  setIgnoredCuts( parameters.getParameter<std::vector<std::string> >("cutsToIgnore") );
49 
51 
52  }
dictionary parameters
Definition: Parameters.py:2
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:287
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)
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:212
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
Definition: Selector.h:167

Member Function Documentation

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 54 of file PFMuonSelector.h.

References Selector< pat::Muon >::bits_, indexChi2_, indexMaxIp_, indexmaxPfRelIso_, indexMinTrackerLayers_, indexminValidMuHits_, indexPixHits_, indexStations_, Selector< pat::Muon >::push_back(), Selector< pat::Muon >::set(), TOPPAG12_LJETS, BeamSplash_cfg::version, and version_.

Referenced by PFMuonSelector().

63  {
64  version_ = version;
65 
66  push_back("GlobalMuon", true);
67  push_back("TrackerMuon", true);
68  push_back("Chi2", chi2 );
69  push_back("minTrackerLayers", minTrackerLayers);
70  push_back("minValidMuHits", minValidMuonHits );
71  push_back("maxIp", maxIp );
72  push_back("minPixelHits", minPixelHits);
73  push_back("minMatchedStations", minNMatches);
74  push_back("maxPfRelIso", pfiso );
75 
76  set("GlobalMuon");
77  set("TrackerMuon");
78  set("Chi2");
79  set("minTrackerLayers");
80  set("minValidMuHits");
81  set("maxIp");
82  set("minPixelHits");
83  set("minMatchedStations");
84  set("maxPfRelIso");
85 
86  indexChi2_ = index_type(&bits_, "Chi2" );
87  indexMinTrackerLayers_ = index_type(&bits_, "minTrackerLayers" );
88  indexminValidMuHits_ = index_type(&bits_, "minValidMuHits" );
89  indexMaxIp_ = index_type(&bits_, "maxIp" );
90  indexPixHits_ = index_type(&bits_, "minPixelHits" );
91  indexStations_ = index_type(&bits_, "minMatchedStations");
92  indexmaxPfRelIso_ = index_type(&bits_, "maxPfRelIso" );
93 
94 
95  if (version_ == TOPPAG12_LJETS ){
96  set("TrackerMuon", false);
97  }
98 
99  }
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
Definition: Selector.h:105
index_type indexPixHits_
Version_t version_
pat::strbitset::index_type index_type
Definition: Selector.h:29
index_type indexStations_
index_type indexminValidMuHits_
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:286
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Definition: Selector.h:46
index_type indexMinTrackerLayers_
index_type indexMaxIp_
index_type indexmaxPfRelIso_
index_type indexChi2_
bool PFMuonSelector::operator() ( const pat::Muon t,
pat::strbitset ret 
)
inlinevirtual

This provides the interface for base classes to select objects.

Implements Selector< pat::Muon >.

Definition at line 102 of file PFMuonSelector.h.

References TOPPAG12_LJETS, TopPag12LjetsCuts(), and version_.

103  {
104  if (version_ == TOPPAG12_LJETS ) return TopPag12LjetsCuts(muon, ret);
105  else {
106  return false;
107  }
108  }
Version_t version_
bool TopPag12LjetsCuts(const pat::Muon &muon, pat::strbitset &ret)
bool PFMuonSelector::TopPag12LjetsCuts ( const pat::Muon muon,
pat::strbitset ret 
)
inline

Definition at line 112 of file PFMuonSelector.h.

References Selector< pat::Muon >::cut(), pat::Muon::dB(), pat::Muon::globalTrack(), Selector< pat::Muon >::ignoreCut(), indexChi2_, indexMaxIp_, indexmaxPfRelIso_, indexMinTrackerLayers_, indexminValidMuHits_, indexPixHits_, indexStations_, pat::Muon::innerTrack(), edm::Ref< C, T, F >::isAvailable(), reco::Muon::isGlobalMuon(), edm::Ref< C, T, F >::isNonnull(), reco::Muon::isTrackerMuon(), pat::Muon::normChi2(), reco::Muon::numberOfMatches(), Selector< pat::Muon >::passCut(), pat::PfChargedHadronIso, pat::PfGammaIso, pat::PfNeutralHadronIso, RecoTauCleanerPlugins::pt, reco::LeafCandidate::pt(), run_regression::ret, pat::strbitset::set(), Selector< pat::Muon >::setIgnored(), pat::Muon::track(), and pat::Lepton< LeptonType >::userIsolation().

Referenced by operator()().

112  {
113 
114  ret.set(false);
115 
116  bool isGlobal = muon.isGlobalMuon();
117  bool isTracker = muon.isTrackerMuon();
118 
119  double norm_chi2 = 9999999.0;
120  int minTrackerLayers = 0;
121  int minValidMuonHits = 0;
122  int _ip = 0.0;
123  int minPixelHits = 0;
124  if ( muon.globalTrack().isNonnull() && muon.globalTrack().isAvailable() ){
125  norm_chi2 = muon.normChi2();
126  minTrackerLayers = static_cast<int> (muon.track()->hitPattern().trackerLayersWithMeasurement());
127  minValidMuonHits = static_cast<int> (muon.globalTrack()->hitPattern().numberOfValidMuonHits());
128  _ip = muon.dB();
129  minPixelHits = muon.innerTrack()->hitPattern().numberOfValidPixelHits();
130  }
131 
132  int minMatchedStations = muon.numberOfMatches();
133 
134  double chIso = muon.userIsolation(pat::PfChargedHadronIso);
135  double nhIso = muon.userIsolation(pat::PfNeutralHadronIso);
136  double gIso = muon.userIsolation(pat::PfGammaIso);
137  double pt = muon.pt() ;
138 
139  double pfIso = (chIso + nhIso + gIso) / pt;
140 
141  if ( isGlobal || ignoreCut("GlobalMuon") ) passCut(ret, "GlobalMuon" );
142  if ( isTracker || ignoreCut("TrackerMuon") ) passCut(ret, "TrackerMuon" );
143  if ( norm_chi2 < cut(indexChi2_, double()) || ignoreCut(indexChi2_) ) passCut(ret, indexChi2_ );
144  if ( minTrackerLayers >= cut(indexMinTrackerLayers_,int()) || ignoreCut(indexMinTrackerLayers_)) passCut(ret, indexMinTrackerLayers_ );
145  if ( minValidMuonHits >= cut(indexminValidMuHits_,int()) || ignoreCut(indexminValidMuHits_)) passCut(ret, indexminValidMuHits_ );
146  if ( _ip < cut(indexMaxIp_,double()) || ignoreCut(indexMaxIp_)) passCut(ret, indexMaxIp_ );
147  if ( minPixelHits >= cut(indexPixHits_,int()) || ignoreCut(indexPixHits_)) passCut(ret, indexPixHits_);
148  if ( minMatchedStations >= cut(indexStations_,int()) || ignoreCut(indexStations_)) passCut(ret, indexStations_);
149  if ( pfIso < cut(indexmaxPfRelIso_, double()) || ignoreCut(indexmaxPfRelIso_) ) passCut(ret, indexmaxPfRelIso_ );
150 
151  setIgnored(ret);
152 
153  return (bool)ret;
154  }
double normChi2() const
Norm chi2 gives the normalized chi2 of the global track.
Definition: Muon.cc:317
reco::TrackRef innerTrack() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.h:72
bool isTrackerMuon() const
Definition: Muon.h:219
bool isGlobalMuon() const
Definition: Muon.h:218
index_type indexPixHits_
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:224
bool isAvailable() const
Definition: Ref.h:276
index_type indexStations_
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
index_type indexminValidMuHits_
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:176
bool ignoreCut(std::string const &s) const
ignore the cut at index &quot;s&quot;
Definition: Selector.h:159
index_type indexMinTrackerLayers_
double dB(IpType type=None) const
Definition: Muon.cc:343
reco::TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
Definition: Muon.h:80
index_type indexMaxIp_
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
Definition: Muon.cc:60
float userIsolation(IsolationKeys key) const
Definition: Lepton.h:49
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144
index_type indexmaxPfRelIso_
index_type indexChi2_
virtual float pt() const GCC11_FINAL
transverse momentum
reco::TrackRef track() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.cc:141
int cut(index_type const &i, int val) const
Access the int cut values at index &quot;s&quot;.
Definition: Selector.h:194

Member Data Documentation

index_type PFMuonSelector::indexChi2_
private

Definition at line 162 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexMaxIp_
private

Definition at line 165 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexmaxPfRelIso_
private

Definition at line 168 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexMinTrackerLayers_
private

Definition at line 163 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexminValidMuHits_
private

Definition at line 164 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexPixHits_
private

Definition at line 166 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexStations_
private

Definition at line 167 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

bool PFMuonSelector::verbose_

Definition at line 17 of file PFMuonSelector.h.

Referenced by PFMuonSelector().

Version_t PFMuonSelector::version_
private

Definition at line 160 of file PFMuonSelector.h.

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