test
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
PFElectronSelector Class Reference

#include <PFElectronSelector.h>

Inheritance diagram for PFElectronSelector:
Selector< pat::Electron >

Public Types

enum  Version_t { SPRING11, N_VERSIONS }
 
- Public Types inherited from Selector< pat::Electron >
typedef std::binary_function
< pat::Electron,
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::Electron 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 mva=0.4, double d0=0.02, int nMissingHits=1, std::string eidUsed="eidTightMC", bool convRej=true, double pfiso=0.15)
 
bool operator() (const pat::Electron &electron, pat::strbitset &ret)
 This provides the interface for base classes to select objects. More...
 
 PFElectronSelector ()
 
 PFElectronSelector (edm::ParameterSet const &parameters, edm::ConsumesCollector &&iC)
 
 PFElectronSelector (edm::ParameterSet const &parameters)
 
bool spring11Cuts (const pat::Electron &electron, pat::strbitset &ret)
 
- Public Member Functions inherited from Selector< pat::Electron >
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::Electronconst &t)
 This provides an alternative signature without the second ret. More...
 
virtual bool operator() (pat::Electronconst &t, edm::EventBase const &e, pat::strbitset &ret)
 This provides an alternative signature that includes extra information. More...
 
virtual bool operator() (pat::Electronconst &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

std::string electronIDvalue_
 
index_type indexConvRej_
 
index_type indexD0_
 
index_type indexElectronId_
 
index_type indexID
 
index_type indexMaxMissingHits_
 
index_type indexMVA_
 
index_type indexPFIso_
 
Version_t version_
 

Additional Inherited Members

- Protected Attributes inherited from Selector< pat::Electron >
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 PFElectronSelector.h.

Member Enumeration Documentation

Enumerator
SPRING11 
N_VERSIONS 

Definition at line 22 of file PFElectronSelector.h.

Constructor & Destructor Documentation

PFElectronSelector::PFElectronSelector ( )
inline

Definition at line 24 of file PFElectronSelector.h.

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

Definition at line 27 of file PFElectronSelector.h.

27  :
29  {}
dictionary parameters
Definition: Parameters.py:2
PFElectronSelector::PFElectronSelector ( edm::ParameterSet const &  parameters)
inline

Definition at line 32 of file PFElectronSelector.h.

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

32  {
33 
34  verbose_ = false;
35 
36  std::string versionStr = parameters.getParameter<std::string>("version");
37 
39 
40  if ( versionStr == "SPRING11" ) {
41  version = SPRING11;
42  }
43  else {
44  throw cms::Exception("InvalidInput") << "Expect version to be one of SPRING11" << std::endl;
45  }
46 
47 
48  initialize( version,
49  parameters.getParameter<double>("MVA"),
50  parameters.getParameter<double>("D0") ,
51  parameters.getParameter<int> ("MaxMissingHits"),
52  parameters.getParameter<std::string> ("electronIDused"),
53  parameters.getParameter<bool> ("ConversionRejection"),
54  parameters.getParameter<double>("PFIso")
55  );
56  if ( parameters.exists("cutsToIgnore") )
57  setIgnoredCuts( parameters.getParameter<std::vector<std::string> >("cutsToIgnore") );
58 
60 
61  }
dictionary parameters
Definition: Parameters.py:2
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:287
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
void initialize(Version_t version, double mva=0.4, double d0=0.02, int nMissingHits=1, std::string eidUsed="eidTightMC", bool convRej=true, double pfiso=0.15)

Member Function Documentation

void PFElectronSelector::initialize ( Version_t  version,
double  mva = 0.4,
double  d0 = 0.02,
int  nMissingHits = 1,
std::string  eidUsed = "eidTightMC",
bool  convRej = true,
double  pfiso = 0.15 
)
inline

Definition at line 63 of file PFElectronSelector.h.

References Selector< pat::Electron >::bits_, electronIDvalue_, indexConvRej_, indexD0_, indexElectronId_, indexMaxMissingHits_, indexMVA_, indexPFIso_, Selector< pat::Electron >::push_back(), Selector< pat::Electron >::set(), BeamSplash_cfg::version, and version_.

Referenced by PFElectronSelector().

70  {
71  version_ = version;
72 
73  // size_t found;
74  // found = eidUsed.find("NONE");
75  // if ( found != string::npos)
76  electronIDvalue_ = eidUsed;
77 
78  push_back("D0", d0 );
79  push_back("MaxMissingHits", nMissingHits );
80  push_back("electronID");
81  push_back("ConversionRejection" );
82  push_back("PFIso", pfiso );
83  push_back("MVA", mva );
84 
85  set("D0");
86  set("MaxMissingHits");
87  set("electronID");
88  set("ConversionRejection", convRej);
89  set("PFIso");
90  set("MVA");
91 
92  indexD0_ = index_type(&bits_, "D0" );
93  indexMaxMissingHits_ = index_type(&bits_, "MaxMissingHits" );
94  indexElectronId_ = index_type(&bits_, "electronID" );
95  indexConvRej_ = index_type(&bits_, "ConversionRejection" );
96  indexPFIso_ = index_type(&bits_, "PFIso" );
97  indexMVA_ = index_type(&bits_, "MVA" );
98  }
index_type indexMaxMissingHits_
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
Definition: Selector.h:105
std::string electronIDvalue_
pat::strbitset::index_type index_type
Definition: Selector.h:29
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
bool PFElectronSelector::operator() ( const pat::Electron t,
pat::strbitset ret 
)
inlinevirtual

This provides the interface for base classes to select objects.

Implements Selector< pat::Electron >.

Definition at line 101 of file PFElectronSelector.h.

References SPRING11, spring11Cuts(), and version_.

102  {
103  if (version_ == SPRING11 ) return spring11Cuts(electron, ret);
104  else {
105  return false;
106  }
107  }
bool spring11Cuts(const pat::Electron &electron, pat::strbitset &ret)
bool PFElectronSelector::spring11Cuts ( const pat::Electron electron,
pat::strbitset ret 
)
inline

Definition at line 112 of file PFElectronSelector.h.

References reco::GsfElectron::convDcot(), reco::GsfElectron::convDist(), Selector< pat::Electron >::cut(), pat::Electron::dB(), pat::Electron::electronID(), electronIDvalue_, reco::LeafCandidate::et(), pat::Electron::gsfTrack(), Selector< pat::Electron >::ignoreCut(), indexConvRej_, indexD0_, indexElectronId_, indexMaxMissingHits_, indexMVA_, indexPFIso_, reco::GsfElectron::mva(), Selector< pat::Electron >::passCut(), pat::PfChargedHadronIso, pat::PfGammaIso, pat::PfNeutralHadronIso, run_regression::ret, pat::strbitset::set(), Selector< pat::Electron >::setIgnored(), and pat::Lepton< LeptonType >::userIsolation().

Referenced by operator()().

113  {
114 
115  ret.set(false);
116 
117  double mva = electron.mva();
118  double missingHits = electron.gsfTrack()->trackerExpectedHitsInner().numberOfHits() ;
119  double corr_d0 = electron.dB();
120 
121  // in >= 39x conversion rejection variables are accessible from Gsf electron
122  Double_t dist = electron.convDist(); // default value is -9999 if conversion partner not found
123  Double_t dcot = electron.convDcot(); // default value is -9999 if conversion partner not found
124  bool isNotConv = !(fabs(dist) < 0.02 && fabs(dcot) < 0.02);
125 
126  int bitWiseResults = (int) electron.electronID( electronIDvalue_ );
127  bool electronIDboolean = ((bitWiseResults & 1) == 1 );
128 
129  double chIso = electron.userIsolation(pat::PfChargedHadronIso);
130  double nhIso = electron.userIsolation(pat::PfNeutralHadronIso);
131  double gIso = electron.userIsolation(pat::PfGammaIso);
132  double et = electron.et() ;
133 
134  double pfIso = (chIso + nhIso + gIso) / et;
135 
136  if ( missingHits <= cut(indexMaxMissingHits_, double()) || ignoreCut(indexMaxMissingHits_) ) passCut(ret, indexMaxMissingHits_ );
137  if ( fabs(corr_d0) < cut(indexD0_, double()) || ignoreCut(indexD0_) ) passCut(ret, indexD0_ );
138  if ( isNotConv || ignoreCut(indexConvRej_) ) passCut(ret, indexConvRej_ );
139  if ( pfIso < cut(indexPFIso_, double()) || ignoreCut(indexPFIso_) ) passCut(ret, indexPFIso_ );
140  if ( mva > cut(indexMVA_, double()) || ignoreCut(indexMVA_) ) passCut(ret, indexMVA_ );
141  if ( electronIDboolean || ignoreCut(indexElectronId_) ) passCut(ret, indexElectronId_);
142  setIgnored(ret);
143  return (bool)ret;
144  }
index_type indexMaxMissingHits_
virtual double et() const
transverse energy
std::string electronIDvalue_
reco::GsfTrackRef gsfTrack() const
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
Definition: Electron.cc:133
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:224
float convDist() const
Definition: GsfElectron.h:536
float convDcot() const
Definition: GsfElectron.h:537
float mva() const
Definition: GsfElectron.h:612
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
float electronID(const std::string &name) const
Returns a specific electron ID associated to the pat::Electron given its name.
Definition: Electron.cc:344
float userIsolation(IsolationKeys key) const
Definition: Lepton.h:49
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144
double dB(IpType type=None) const
Impact parameter wrt primary vertex or beamspot.
Definition: Electron.cc:414
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

std::string PFElectronSelector::electronIDvalue_
private

Definition at line 158 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

index_type PFElectronSelector::indexConvRej_
private

Definition at line 153 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

index_type PFElectronSelector::indexD0_
private

Definition at line 152 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

index_type PFElectronSelector::indexElectronId_
private

Definition at line 156 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

index_type PFElectronSelector::indexID
private

Definition at line 150 of file PFElectronSelector.h.

index_type PFElectronSelector::indexMaxMissingHits_
private

Definition at line 151 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

index_type PFElectronSelector::indexMVA_
private

Definition at line 155 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

index_type PFElectronSelector::indexPFIso_
private

Definition at line 154 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

bool PFElectronSelector::verbose_

Definition at line 20 of file PFElectronSelector.h.

Referenced by PFElectronSelector().

Version_t PFElectronSelector::version_
private

Definition at line 148 of file PFElectronSelector.h.

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