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::binary_function< pat::Muon, pat::strbitset, bool > base_type
 
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)
 
 PFMuonSelector ()
 
 PFMuonSelector (edm::ParameterSet const &parameters, edm::ConsumesCollector &&iC)
 
 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::Muon const &t, pat::strbitset &ret)=0
 This provides the interface for base classes to select objects. 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, pat::strbitset &ret)
 This provides an alternative signature that includes extra information. More...
 
virtual bool operator() (pat::Muon const &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 16 of file PFMuonSelector.h.

Member Enumeration Documentation

Enumerator
TOPPAG12_LJETS 
N_VERSIONS 

Definition at line 22 of file PFMuonSelector.h.

Constructor & Destructor Documentation

PFMuonSelector::PFMuonSelector ( )
inline

Definition at line 24 of file PFMuonSelector.h.

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

Definition at line 27 of file PFMuonSelector.h.

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

Definition at line 32 of file PFMuonSelector.h.

References 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, and jetIDSelector_cfi::version.

32  {
33 
34  verbose_ = false;
35 
36  std::string versionStr = parameters.getParameter<std::string>("version");
37 
39 
40  if ( versionStr == "TOPPAG12_LJETS" ) {
41  version = TOPPAG12_LJETS;
42  }
43  else {
44  throw cms::Exception("InvalidInput") << "Expect version to be one of SPRING11" << std::endl;
45  }
46 
47  initialize( version,
48  parameters.getParameter<double>("Chi2"),
49  parameters.getParameter<int> ("minTrackerLayers"),
50  parameters.getParameter<int> ("minValidMuHits"),
51  parameters.getParameter<double>("maxIp"),
52  parameters.getParameter<int> ("minPixelHits"),
53  parameters.getParameter<int> ("minMatchedStations"),
54  parameters.getParameter<double>("maxPfRelIso")
55  );
56  if ( parameters.exists("cutsToIgnore") )
57  setIgnoredCuts( parameters.getParameter<std::vector<std::string> >("cutsToIgnore") );
58 
60 
61  }
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 63 of file PFMuonSelector.h.

References Selector< pat::Muon >::bits_, HiEvtPlane_cfi::chi2, indexChi2_, indexMaxIp_, indexmaxPfRelIso_, indexMinTrackerLayers_, indexminValidMuHits_, indexPixHits_, indexStations_, pfMuonSelector_cfi::maxIp, lostTracks_cfi::minPixelHits, pfMuonSelector_cfi::minTrackerLayers, Selector< pat::Muon >::push_back(), TOPPAG12_LJETS, jetIDSelector_cfi::version, and version_.

Referenced by PFMuonSelector().

72  {
73  version_ = version;
74 
75  push_back("GlobalMuon", true);
76  push_back("TrackerMuon", true);
77  push_back("Chi2", chi2 );
78  push_back("minTrackerLayers", minTrackerLayers);
79  push_back("minValidMuHits", minValidMuonHits );
80  push_back("maxIp", maxIp );
81  push_back("minPixelHits", minPixelHits);
82  push_back("minMatchedStations", minNMatches);
83  push_back("maxPfRelIso", pfiso );
84 
85  set("GlobalMuon");
86  set("TrackerMuon");
87  set("Chi2");
88  set("minTrackerLayers");
89  set("minValidMuHits");
90  set("maxIp");
91  set("minPixelHits");
92  set("minMatchedStations");
93  set("maxPfRelIso");
94 
95  indexChi2_ = index_type(&bits_, "Chi2" );
96  indexMinTrackerLayers_ = index_type(&bits_, "minTrackerLayers" );
97  indexminValidMuHits_ = index_type(&bits_, "minValidMuHits" );
98  indexMaxIp_ = index_type(&bits_, "maxIp" );
99  indexPixHits_ = index_type(&bits_, "minPixelHits" );
100  indexStations_ = index_type(&bits_, "minMatchedStations");
101  indexmaxPfRelIso_ = index_type(&bits_, "maxPfRelIso" );
102 
103 
104  if (version_ == TOPPAG12_LJETS ){
105  set("TrackerMuon", false);
106  }
107 
108  }
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 muon,
pat::strbitset ret 
)
inline

Definition at line 111 of file PFMuonSelector.h.

References cppFunctionSkipper::operator, TOPPAG12_LJETS, TopPag12LjetsCuts(), and version_.

112  {
113  if (version_ == TOPPAG12_LJETS ) return TopPag12LjetsCuts(muon, ret);
114  else {
115  return false;
116  }
117  }
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 121 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(), GeomDetEnumerators::isTracker(), reco::Muon::isTrackerMuon(), pfMuonSelector_cfi::minMatchedStations, lostTracks_cfi::minPixelHits, pfMuonSelector_cfi::minTrackerLayers, pat::Muon::normChi2(), reco::Muon::numberOfMatches(), Selector< pat::Muon >::passCut(), pat::PfChargedHadronIso, pat::PfGammaIso, pat::PfNeutralHadronIso, EnergyCorrector::pt, reco::LeafCandidate::pt(), pat::strbitset::set(), Selector< pat::Muon >::setIgnored(), pat::Muon::track(), and pat::Lepton< LeptonType >::userIsolation().

Referenced by operator()().

121  {
122 
123  ret.set(false);
124 
125  bool isGlobal = muon.isGlobalMuon();
126  bool isTracker = muon.isTrackerMuon();
127 
128  double norm_chi2 = 9999999.0;
129  int minTrackerLayers = 0;
130  int minValidMuonHits = 0;
131  int _ip = 0.0;
132  int minPixelHits = 0;
133  if ( muon.globalTrack().isNonnull() && muon.globalTrack().isAvailable() ){
134  norm_chi2 = muon.normChi2();
135  minTrackerLayers = static_cast<int> (muon.track()->hitPattern().trackerLayersWithMeasurement());
136  minValidMuonHits = static_cast<int> (muon.globalTrack()->hitPattern().numberOfValidMuonHits());
137  _ip = muon.dB();
138  minPixelHits = muon.innerTrack()->hitPattern().numberOfValidPixelHits();
139  }
140 
141  int minMatchedStations = muon.numberOfMatches();
142 
143  double chIso = muon.userIsolation(pat::PfChargedHadronIso);
144  double nhIso = muon.userIsolation(pat::PfNeutralHadronIso);
145  double gIso = muon.userIsolation(pat::PfGammaIso);
146  double pt = muon.pt() ;
147 
148  double pfIso = (chIso + nhIso + gIso) / pt;
149 
150  if ( isGlobal || ignoreCut("GlobalMuon") ) passCut(ret, "GlobalMuon" );
151  if ( isTracker || ignoreCut("TrackerMuon") ) passCut(ret, "TrackerMuon" );
152  if ( norm_chi2 < cut(indexChi2_, double()) || ignoreCut(indexChi2_) ) passCut(ret, indexChi2_ );
153  if ( minTrackerLayers >= cut(indexMinTrackerLayers_,int()) || ignoreCut(indexMinTrackerLayers_)) passCut(ret, indexMinTrackerLayers_ );
154  if ( minValidMuonHits >= cut(indexminValidMuHits_,int()) || ignoreCut(indexminValidMuHits_)) passCut(ret, indexminValidMuHits_ );
155  if ( _ip < cut(indexMaxIp_,double()) || ignoreCut(indexMaxIp_)) passCut(ret, indexMaxIp_ );
156  if ( minPixelHits >= cut(indexPixHits_,int()) || ignoreCut(indexPixHits_)) passCut(ret, indexPixHits_);
157  if ( minMatchedStations >= cut(indexStations_,int()) || ignoreCut(indexStations_)) passCut(ret, indexStations_);
158  if ( pfIso < cut(indexmaxPfRelIso_, double()) || ignoreCut(indexmaxPfRelIso_) ) passCut(ret, indexmaxPfRelIso_ );
159 
160  setIgnored(ret);
161 
162  return (bool)ret;
163  }
bool isAvailable() const
Definition: Ref.h:576
virtual double pt() const final
transverse momentum
bool isTracker(const GeomDetEnumerators::SubDetector m)
reco::TrackRef innerTrack() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.h:72
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
reco::TrackRef track() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
bool isTrackerMuon() const
Definition: Muon.h:226
bool isGlobalMuon() const
Definition: Muon.h:225
double dB(IPTYPE type) const
index_type indexPixHits_
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:224
index_type indexStations_
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 "s"
Definition: Selector.h:159
index_type indexMinTrackerLayers_
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_
float userIsolation(IsolationKeys key) const
Definition: Lepton.h:49
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
index_type indexmaxPfRelIso_
index_type indexChi2_
double normChi2() const
Norm chi2 gives the normalized chi2 of the global track.
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
Definition: Selector.h:194

Member Data Documentation

index_type PFMuonSelector::indexChi2_
private

Definition at line 171 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexMaxIp_
private

Definition at line 174 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexmaxPfRelIso_
private

Definition at line 177 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexMinTrackerLayers_
private

Definition at line 172 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexminValidMuHits_
private

Definition at line 173 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexPixHits_
private

Definition at line 175 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

index_type PFMuonSelector::indexStations_
private

Definition at line 176 of file PFMuonSelector.h.

Referenced by initialize(), and TopPag12LjetsCuts().

bool PFMuonSelector::verbose_

Definition at line 20 of file PFMuonSelector.h.

Version_t PFMuonSelector::version_
private

Definition at line 169 of file PFMuonSelector.h.

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