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 Member Functions | Private Attributes
PFElectronSelector Class Reference

#include <PFElectronSelector.h>

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

Public Types

enum  Version_t { TOPPAG, 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, bool fid=true, int nMissingHits=0, double d0=0.02, bool convRej=true, double pfiso=0.10, double mva=0.4)
 
bool operator() (const pat::Electron &electron, edm::EventBase const &event, pat::strbitset &ret)
 This provides an alternative signature that includes extra information. More...
 
 PFElectronSelector ()
 
 PFElectronSelector (edm::ParameterSet const &parameters)
 
bool topPAGRefCuts (const pat::Electron &electron, edm::EventBase const &event, 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)
 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 Member Functions

bool operator() (const pat::Electron &electron, pat::strbitset &ret)
 This provides the interface for base classes to select objects. More...
 

Private Attributes

std::string electronIDvalue_
 
index_type indexConvRej_
 
index_type indexD0_
 
index_type indexFid_
 
index_type indexMaxMissingHits_
 
index_type indexMVA_
 
index_type indexPFIso_
 
edm::InputTag rhoTag_
 
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 13 of file PFElectronSelector.h.

Member Enumeration Documentation

Enumerator
TOPPAG 
N_VERSIONS 

Definition at line 19 of file PFElectronSelector.h.

Constructor & Destructor Documentation

PFElectronSelector::PFElectronSelector ( )
inline

Definition at line 21 of file PFElectronSelector.h.

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

Definition at line 23 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_, rhoTag_, Selector< pat::Electron >::setIgnoredCuts(), TOPPAG, verbose_, and BeamSplash_cfg::version.

23  {
24 
25  verbose_ = false;
26 
27  std::string versionStr = parameters.getParameter<std::string>("version");
28  rhoTag_ = parameters.getParameter< edm::InputTag> ("rhoSrc");
29 
31 
32  if ( versionStr == "TOPPAG" ) {
33  version = TOPPAG;
34  }
35  else {
36  throw cms::Exception("InvalidInput") << "Expect version to be one of : TOPPAG" << std::endl;
37  }
38 
39 
40  initialize( version,
41  parameters.getParameter<bool> ("Fiducial"),
42  parameters.getParameter<int> ("MaxMissingHits"),
43  parameters.getParameter<double>("D0"),
44  parameters.getParameter<bool> ("ConversionRejection"),
45  parameters.getParameter<double>("PFIso"),
46  parameters.getParameter<double>("MVA")
47  );
48  if ( parameters.exists("cutsToIgnore") )
49  setIgnoredCuts( parameters.getParameter<std::vector<std::string> >("cutsToIgnore") );
50 
52 
53  }
dictionary parameters
Definition: Parameters.py:2
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:288
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:213
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
Definition: Selector.h:168
void initialize(Version_t version, bool fid=true, int nMissingHits=0, double d0=0.02, bool convRej=true, double pfiso=0.10, double mva=0.4)

Member Function Documentation

void PFElectronSelector::initialize ( Version_t  version,
bool  fid = true,
int  nMissingHits = 0,
double  d0 = 0.02,
bool  convRej = true,
double  pfiso = 0.10,
double  mva = 0.4 
)
inline

Definition at line 55 of file PFElectronSelector.h.

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

Referenced by PFElectronSelector().

63  {
64  version_ = version;
65 
66  // size_t found;
67  // found = eidUsed.find("NONE");
68  // if ( found != string::npos)
69 
70  push_back("Fiducial" );
71  push_back("MaxMissingHits", nMissingHits );
72  push_back("D0", d0 );
73  push_back("ConversionRejection" );
74  push_back("PFIso", pfiso );
75  push_back("MVA", mva );
76 
77  set("Fiducial", fid);
78  set("MaxMissingHits");
79  set("D0");
80  set("ConversionRejection", convRej);
81  set("PFIso");
82  set("MVA");
83 
84  indexFid_ = index_type(&bits_, "Fiducial" );
85  indexMaxMissingHits_ = index_type(&bits_, "MaxMissingHits" );
86  indexD0_ = index_type(&bits_, "D0" );
87  indexConvRej_ = index_type(&bits_, "ConversionRejection" );
88  indexPFIso_ = index_type(&bits_, "PFIso" );
89  indexMVA_ = index_type(&bits_, "MVA" );
90  }
index_type indexMaxMissingHits_
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
Definition: Selector.h:106
pat::strbitset::index_type index_type
Definition: Selector.h:30
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:287
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Definition: Selector.h:47
list fid
Definition: NewTree.py:51
bool PFElectronSelector::operator() ( const pat::Electron t,
edm::EventBase const &  e,
pat::strbitset ret 
)
inlinevirtual

This provides an alternative signature that includes extra information.

Reimplemented from Selector< pat::Electron >.

Definition at line 93 of file PFElectronSelector.h.

References TOPPAG, topPAGRefCuts(), and version_.

94  {
95  if (version_ == TOPPAG ) return topPAGRefCuts(electron, event, ret);
96  else {
97  return false;
98  }
99  }
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool topPAGRefCuts(const pat::Electron &electron, edm::EventBase const &event, pat::strbitset &ret)
bool PFElectronSelector::operator() ( const pat::Electron t,
pat::strbitset ret 
)
inlineprivatevirtual

This provides the interface for base classes to select objects.

Implements Selector< pat::Electron >.

Definition at line 156 of file PFElectronSelector.h.

156 { return false;}
bool PFElectronSelector::topPAGRefCuts ( const pat::Electron electron,
edm::EventBase const &  event,
pat::strbitset ret 
)
inline

Definition at line 104 of file PFElectronSelector.h.

References Selector< pat::Electron >::cut(), pat::Electron::dB(), pat::Electron::ecalDrivenMomentum(), pat::Electron::electronID(), NewTree::fid, ElectronEffectiveArea::GetElectronEffectiveArea(), pat::Electron::gsfTrack(), Selector< pat::Electron >::ignoreCut(), indexConvRej_, indexD0_, indexFid_, indexMaxMissingHits_, indexMVA_, indexPFIso_, ElectronEffectiveArea::kEleEAData2012, ElectronEffectiveArea::kEleGammaAndNeutralHadronIso03, max(), pat::Electron::passConversionVeto(), Selector< pat::Electron >::passCut(), pat::PfChargedHadronIso, pat::PfGammaIso, pat::PfNeutralHadronIso, edm::Handle< T >::product(), run_regression::ret, rhoTag_, pat::strbitset::set(), Selector< pat::Electron >::setIgnored(), pat::Electron::superCluster(), and pat::Lepton< LeptonType >::userIsolation().

Referenced by operator()().

105  {
106 
107 
108 
109  ret.set(false);
110 
111  edm::Handle<double> rhoHandle;
112  event.getByLabel(rhoTag_, rhoHandle);
113 
114  double rhoIso = std::max(*(rhoHandle.product()), 0.0);
115 
116  double scEta = electron.superCluster()->eta();
117  double dB = electron.dB();
119  double chIso = electron.userIsolation(pat::PfChargedHadronIso);
120  double nhIso = electron.userIsolation(pat::PfNeutralHadronIso);
121  double phIso = electron.userIsolation(pat::PfGammaIso);
122  double pfIso = ( chIso + max(0.0, nhIso + phIso - rhoIso*AEff) )/ electron.ecalDrivenMomentum().pt();
123  int mHits = electron.gsfTrack()->trackerExpectedHitsInner().numberOfHits();
124  double mva = electron.electronID("mvaTrigV0");
125  //Electron Selection for e+jets
126  //-----------------------------
127  bool fid = ! (fabs(scEta) > 1.4442 && fabs(scEta) < 1.5660 );
128 
129 
130 
131  if ( fid || ignoreCut(indexFid_) ) passCut(ret, indexFid_ );
133  if ( fabs(dB) < cut(indexD0_, double()) || ignoreCut(indexD0_) ) passCut(ret, indexD0_ );
134  if ( electron.passConversionVeto() || ignoreCut(indexConvRej_) ) passCut(ret, indexConvRej_ );
135  if ( pfIso < cut(indexPFIso_, double()) || ignoreCut(indexPFIso_) ) passCut(ret, indexPFIso_ );
136  if ( mva > cut(indexMVA_, double()) || ignoreCut(indexMVA_) ) passCut(ret, indexMVA_ );
137  setIgnored(ret);
138  return (bool)ret;
139  }
index_type indexMaxMissingHits_
const LorentzVector & ecalDrivenMomentum() const
Definition: Electron.h:187
reco::SuperClusterRef superCluster() const
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
Definition: Electron.cc:150
static Double_t GetElectronEffectiveArea(ElectronEffectiveAreaType type, Double_t SCEta, ElectronEffectiveAreaTarget EffectiveAreaTarget=kEleEAData2011)
reco::GsfTrackRef gsfTrack() const
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
Definition: Electron.cc:131
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:225
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:177
const T & max(const T &a, const T &b)
bool ignoreCut(std::string const &s) const
ignore the cut at index &quot;s&quot;
Definition: Selector.h:160
float electronID(const std::string &name) const
Returns a specific electron ID associated to the pat::Electron given its name.
Definition: Electron.cc:315
float userIsolation(IsolationKeys key) const
Definition: Lepton.h:51
strbitset & set(bool val=true)
set method of all bits
Definition: strbitset.h:144
T const * product() const
Definition: Handle.h:74
bool passConversionVeto() const
vertex fit combined with missing number of hits method
Definition: Electron.h:235
list fid
Definition: NewTree.py:51
double dB(IpType type=None) const
Impact parameter wrt primary vertex or beamspot.
Definition: Electron.cc:378
int cut(index_type const &i, int val) const
Access the int cut values at index &quot;s&quot;.
Definition: Selector.h:195

Member Data Documentation

std::string PFElectronSelector::electronIDvalue_
private

Definition at line 153 of file PFElectronSelector.h.

index_type PFElectronSelector::indexConvRej_
private

Definition at line 148 of file PFElectronSelector.h.

Referenced by initialize(), and topPAGRefCuts().

index_type PFElectronSelector::indexD0_
private

Definition at line 147 of file PFElectronSelector.h.

Referenced by initialize(), and topPAGRefCuts().

index_type PFElectronSelector::indexFid_
private

Definition at line 145 of file PFElectronSelector.h.

Referenced by initialize(), and topPAGRefCuts().

index_type PFElectronSelector::indexMaxMissingHits_
private

Definition at line 146 of file PFElectronSelector.h.

Referenced by initialize(), and topPAGRefCuts().

index_type PFElectronSelector::indexMVA_
private

Definition at line 150 of file PFElectronSelector.h.

Referenced by initialize(), and topPAGRefCuts().

index_type PFElectronSelector::indexPFIso_
private

Definition at line 149 of file PFElectronSelector.h.

Referenced by initialize(), and topPAGRefCuts().

edm::InputTag PFElectronSelector::rhoTag_
private

Definition at line 154 of file PFElectronSelector.h.

Referenced by PFElectronSelector(), and topPAGRefCuts().

bool PFElectronSelector::verbose_

Definition at line 17 of file PFElectronSelector.h.

Referenced by PFElectronSelector().

Version_t PFElectronSelector::version_
private

Definition at line 143 of file PFElectronSelector.h.

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