CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GsfEleDeltaBetaIsoCut Class Reference
Inheritance diagram for GsfEleDeltaBetaIsoCut:
CutApplicatorWithEventContentBase CutApplicatorBase candidate_functions::CandidateCut

Public Member Functions

CandidateType candidateType () const final
 
void getEventContent (const edm::EventBase &) final
 
 GsfEleDeltaBetaIsoCut (const edm::ParameterSet &c)
 
result_type operator() (const reco::GsfElectronPtr &) const final
 
void setConsumes (edm::ConsumesCollector &) final
 
double value (const reco::CandidatePtr &cand) const final
 
- Public Member Functions inherited from CutApplicatorWithEventContentBase
 CutApplicatorWithEventContentBase ()
 
 CutApplicatorWithEventContentBase (const edm::ParameterSet &c)
 
 CutApplicatorWithEventContentBase (const CutApplicatorWithEventContentBase &)=delete
 
CutApplicatorWithEventContentBaseoperator= (const CutApplicatorWithEventContentBase &)=delete
 
 ~CutApplicatorWithEventContentBase () override
 Destructor. More...
 
- Public Member Functions inherited from CutApplicatorBase
virtual result_type asCandidate (const argument_type &) const
 
 CutApplicatorBase ()
 
 CutApplicatorBase (const edm::ParameterSet &c)
 
 CutApplicatorBase (const CutApplicatorBase &)=delete
 
const std::string & name () const override
 
result_type operator() (const argument_type &) const override final
 
virtual result_type operator() (const pat::ElectronPtr &) const
 
virtual result_type operator() (const reco::PhotonPtr &) const
 
virtual result_type operator() (const pat::PhotonPtr &) const
 
virtual result_type operator() (const reco::MuonPtr &) const
 
virtual result_type operator() (const pat::MuonPtr &) const
 
virtual result_type operator() (const reco::PFTauPtr &) const
 
virtual result_type operator() (const pat::TauPtr &) const
 
CutApplicatorBaseoperator= (const CutApplicatorBase &)=delete
 
 ~CutApplicatorBase () override
 Destructor. More...
 
- Public Member Functions inherited from candidate_functions::CandidateCut
 CandidateCut ()
 
virtual ~CandidateCut ()
 

Private Attributes

const float _barrelCutOff
 
edm::Handle< edm::ValueMap< float > > _chad_iso
 
const float _deltaBetaConstant
 
const float _isoCutEBHighPt
 
const float _isoCutEBLowPt
 
const float _isoCutEEHighPt
 
const float _isoCutEELowPt
 
edm::Handle< edm::ValueMap< float > > _nhad_iso
 
edm::Handle< edm::ValueMap< float > > _ph_iso
 
const float _ptCutOff
 
edm::Handle< edm::ValueMap< float > > _PUchad_iso
 
bool _relativeIso
 

Additional Inherited Members

- Public Types inherited from CutApplicatorBase
enum  CandidateType {
  NONE, ELECTRON, MUON, PHOTON,
  TAU, PATELECTRON, PATMUON, PATPHOTON,
  PATTAU
}
 
- Public Types inherited from candidate_functions::CandidateCut
using argument_type = reco::CandidatePtr
 
using result_type = bool
 
- Protected Attributes inherited from CutApplicatorWithEventContentBase
std::unordered_map< std::string, edm::InputTagcontentTags_
 
std::unordered_map< std::string, edm::EDGetTokencontentTokens_
 

Detailed Description

Definition at line 8 of file GsfEleDeltaBetaIsoCut.cc.

Constructor & Destructor Documentation

GsfEleDeltaBetaIsoCut::GsfEleDeltaBetaIsoCut ( const edm::ParameterSet c)

Definition at line 34 of file GsfEleDeltaBetaIsoCut.cc.

References CutApplicatorWithEventContentBase::contentTags_, and edm::ParameterSet::getParameter().

34  :
36  _isoCutEBLowPt(c.getParameter<double>("isoCutEBLowPt")),
37  _isoCutEBHighPt(c.getParameter<double>("isoCutEBHighPt")),
38  _isoCutEELowPt(c.getParameter<double>("isoCutEELowPt")),
39  _isoCutEEHighPt(c.getParameter<double>("isoCutEEHighPt")),
40  _deltaBetaConstant(c.getParameter<double>("deltaBetaConstant")),
41  _ptCutOff(c.getParameter<double>("ptCutOff")),
42  _barrelCutOff(c.getParameter<double>("barrelCutOff")),
43  _relativeIso(c.getParameter<bool>("isRelativeIso")) {
44  edm::InputTag chadtag = c.getParameter<edm::InputTag>("chargedHadronIsoDR03Src");
45  edm::InputTag nhadtag = c.getParameter<edm::InputTag>("neutralHadronIsoDR03Src");
46  edm::InputTag phtag = c.getParameter<edm::InputTag>("photonIsoDR03Src");
47  edm::InputTag PUchadtag = c.getParameter<edm::InputTag>("puChargedHadronIsoDR03Src");
48  contentTags_.emplace("chad",chadtag);
49  contentTags_.emplace("nhad",nhadtag);
50  contentTags_.emplace("pho",phtag);
51  contentTags_.emplace("puchad",PUchadtag);
52 }
T getParameter(std::string const &) const
std::unordered_map< std::string, edm::InputTag > contentTags_

Member Function Documentation

CandidateType GsfEleDeltaBetaIsoCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 19 of file GsfEleDeltaBetaIsoCut.cc.

References CutApplicatorBase::ELECTRON.

19  {
20  return ELECTRON;
21  }
void GsfEleDeltaBetaIsoCut::getEventContent ( const edm::EventBase ev)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 69 of file GsfEleDeltaBetaIsoCut.cc.

References _chad_iso, _nhad_iso, _ph_iso, _PUchad_iso, CutApplicatorWithEventContentBase::contentTags_, edm::EventBase::getByLabel(), and operator()().

69  {
70  ev.getByLabel(contentTags_["chad"],_chad_iso);
71  ev.getByLabel(contentTags_["nhad"],_nhad_iso);
72  ev.getByLabel(contentTags_["pho"],_ph_iso);
73  ev.getByLabel(contentTags_["puchad"],_PUchad_iso);
74 }
edm::Handle< edm::ValueMap< float > > _nhad_iso
edm::Handle< edm::ValueMap< float > > _chad_iso
edm::Handle< edm::ValueMap< float > > _ph_iso
std::unordered_map< std::string, edm::InputTag > contentTags_
edm::Handle< edm::ValueMap< float > > _PUchad_iso
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
CutApplicatorBase::result_type GsfEleDeltaBetaIsoCut::operator() ( const reco::GsfElectronPtr cand) const
finalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 78 of file GsfEleDeltaBetaIsoCut.cc.

References _barrelCutOff, _chad_iso, _deltaBetaConstant, _isoCutEBHighPt, _isoCutEBLowPt, _isoCutEEHighPt, _isoCutEELowPt, _nhad_iso, _ph_iso, _ptCutOff, _PUchad_iso, _relativeIso, funct::abs(), edm::ValueMap< T >::begin(), edm::ValueMap< T >::contains(), f, edm::Ptr< T >::id(), edm::ValueMap< T >::idSize(), edm::HandleBase::isValid(), edm::Ptr< T >::key(), SiStripPI::max, reco::GsfElectron::p4(), reco::GsfElectron::pfIsolationVariables(), reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, reco::GsfElectron::PflowIsolationVariables::sumPUPt, and reco::GsfElectron::superCluster().

Referenced by getEventContent().

78  {
79  const float isoCut =
80  ( cand->p4().pt() < _ptCutOff ?
81  ( std::abs(cand->superCluster()->position().eta()) < _barrelCutOff ?
83  ( std::abs(cand->superCluster()->position().eta()) < _barrelCutOff ?
86  cand->pfIsolationVariables();
87 
88  float chad_val = 0.0;
89  float nhad_val = 0.0;
90  float pho_val = 0.0;
91  float puchad_val = 0.0;
92 
93  if( _chad_iso.isValid() && _chad_iso->contains( cand.id() ) &&
94  _nhad_iso.isValid() && _nhad_iso->contains( cand.id() ) &&
95  _ph_iso.isValid() && _ph_iso->contains( cand.id() ) &&
96  _PUchad_iso.isValid() && _PUchad_iso->contains( cand.id() ) ) {
97  chad_val = (*_chad_iso)[cand];
98  nhad_val = (*_nhad_iso)[cand];
99  pho_val = (*_ph_iso)[cand];
100  puchad_val = (*_PUchad_iso)[cand];
101  } else if ( _chad_iso.isValid() && _chad_iso->idSize() == 1 &&
102  _nhad_iso.isValid() && _nhad_iso->idSize() == 1 &&
103  _ph_iso.isValid() && _ph_iso->idSize() == 1 &&
104  _PUchad_iso.isValid() && _PUchad_iso->idSize() == 1 &&
105  cand.id() == edm::ProductID() ) {
106  // in case we have spoofed a ptr
107  //note this must be a 1:1 valuemap (only one product input)
108  chad_val = _chad_iso->begin()[cand.key()];
109  nhad_val = _nhad_iso->begin()[cand.key()];
110  pho_val = _ph_iso->begin()[cand.key()];
111  puchad_val = _PUchad_iso->begin()[cand.key()];
112  } else if ( _chad_iso.isValid() && _nhad_iso.isValid() &&
113  _ph_iso.isValid() && _PUchad_iso.isValid() ){ // throw an exception
114  chad_val = (*_chad_iso)[cand];
115  nhad_val = (*_nhad_iso)[cand];
116  pho_val = (*_ph_iso)[cand];
117  puchad_val = (*_PUchad_iso)[cand];
118  }
119 
120  const float chad = _chad_iso.isValid() ? chad_val : pfIso.sumChargedHadronPt;
121  const float nhad = _nhad_iso.isValid() ? nhad_val : pfIso.sumNeutralHadronEt;
122  const float pho = _ph_iso.isValid() ? pho_val : pfIso.sumPhotonEt;
123  const float puchad = _PUchad_iso.isValid() ? puchad_val : pfIso.sumPUPt;
124  float iso = chad + std::max(0.0f, nhad + pho - _deltaBetaConstant*puchad);
125  if( _relativeIso ) iso /= cand->p4().pt();
126  return iso < isoCut;
127 }
edm::Handle< edm::ValueMap< float > > _nhad_iso
const PflowIsolationVariables & pfIsolationVariables() const
Definition: GsfElectron.h:687
edm::Handle< edm::ValueMap< float > > _chad_iso
edm::Handle< edm::ValueMap< float > > _ph_iso
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:225
key_type key() const
Definition: Ptr.h:185
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: GsfElectron.h:646
bool contains(ProductID id) const
Definition: ValueMap.h:155
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:641
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:640
bool isValid() const
Definition: HandleBase.h:74
size_t idSize() const
Definition: ValueMap.h:159
edm::Handle< edm::ValueMap< float > > _PUchad_iso
const_iterator begin() const
Definition: ValueMap.h:208
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:180
static int position[264][3]
Definition: ReadPGInfo.cc:509
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:639
void GsfEleDeltaBetaIsoCut::setConsumes ( edm::ConsumesCollector cc)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 54 of file GsfEleDeltaBetaIsoCut.cc.

References edm::ConsumesCollector::consumes(), CutApplicatorWithEventContentBase::contentTags_, and CutApplicatorWithEventContentBase::contentTokens_.

54  {
55  auto chad =
57  contentTokens_.emplace("chad",chad);
58  auto nhad =
60  contentTokens_.emplace("nhad",nhad);
61  auto pho =
63  contentTokens_.emplace("pho",pho);
64  auto puchad =
66  contentTokens_.emplace("puchad",puchad);
67 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
std::unordered_map< std::string, edm::InputTag > contentTags_
double GsfEleDeltaBetaIsoCut::value ( const reco::CandidatePtr cand) const
finalvirtual

Implements candidate_functions::CandidateCut.

Definition at line 129 of file GsfEleDeltaBetaIsoCut.cc.

References _chad_iso, _deltaBetaConstant, _nhad_iso, _ph_iso, _PUchad_iso, _relativeIso, edm::ValueMap< T >::begin(), edm::ValueMap< T >::contains(), f, edm::Ptr< T >::id(), edm::ValueMap< T >::idSize(), edm::HandleBase::isValid(), edm::Ptr< T >::key(), SiStripPI::max, reco::GsfElectron::pfIsolationVariables(), reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, and reco::GsfElectron::PflowIsolationVariables::sumPUPt.

129  {
130  edm::Ptr<reco::GsfElectron> ele(cand);
132  ele->pfIsolationVariables();
133  float chad_val = 0.0;
134  float nhad_val = 0.0;
135  float pho_val = 0.0;
136  float puchad_val = 0.0;
137 
138  if( _chad_iso.isValid() && _chad_iso->contains( cand.id() ) &&
139  _nhad_iso.isValid() && _nhad_iso->contains( cand.id() ) &&
140  _ph_iso.isValid() && _ph_iso->contains( cand.id() ) &&
141  _PUchad_iso.isValid() && _PUchad_iso->contains( cand.id() ) ) {
142  chad_val = (*_chad_iso)[cand];
143  nhad_val = (*_nhad_iso)[cand];
144  pho_val = (*_ph_iso)[cand];
145  puchad_val = (*_PUchad_iso)[cand];
146  } else if ( _chad_iso.isValid() && _chad_iso->idSize() == 1 &&
147  _nhad_iso.isValid() && _nhad_iso->idSize() == 1 &&
148  _ph_iso.isValid() && _ph_iso->idSize() == 1 &&
149  _PUchad_iso.isValid() && _PUchad_iso->idSize() == 1 &&
150  cand.id() == edm::ProductID() ) {
151  // in case we have spoofed a ptr
152  //note this must be a 1:1 valuemap (only one product input)
153  chad_val = _chad_iso->begin()[cand.key()];
154  nhad_val = _nhad_iso->begin()[cand.key()];
155  pho_val = _ph_iso->begin()[cand.key()];
156  puchad_val = _PUchad_iso->begin()[cand.key()];
157  } else if ( _chad_iso.isValid() && _nhad_iso.isValid() &&
158  _ph_iso.isValid() && _PUchad_iso.isValid() ){ // throw an exception
159  chad_val = (*_chad_iso)[cand];
160  nhad_val = (*_nhad_iso)[cand];
161  pho_val = (*_ph_iso)[cand];
162  puchad_val = (*_PUchad_iso)[cand];
163  }
164 
165  const float chad = _chad_iso.isValid() ? chad_val : pfIso.sumChargedHadronPt;
166  const float nhad = _nhad_iso.isValid() ? nhad_val : pfIso.sumNeutralHadronEt;
167  const float pho = _ph_iso.isValid() ? pho_val : pfIso.sumPhotonEt;
168  const float puchad = _PUchad_iso.isValid() ? puchad_val : pfIso.sumPUPt;
169  float iso = chad + std::max(0.0f, nhad + pho - _deltaBetaConstant*puchad);
170  if( _relativeIso ) iso /= cand->p4().pt();
171  return iso;
172 }
edm::Handle< edm::ValueMap< float > > _nhad_iso
edm::Handle< edm::ValueMap< float > > _chad_iso
edm::Handle< edm::ValueMap< float > > _ph_iso
key_type key() const
Definition: Ptr.h:185
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: GsfElectron.h:646
bool contains(ProductID id) const
Definition: ValueMap.h:155
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:641
double f[11][100]
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:640
bool isValid() const
Definition: HandleBase.h:74
size_t idSize() const
Definition: ValueMap.h:159
edm::Handle< edm::ValueMap< float > > _PUchad_iso
const_iterator begin() const
Definition: ValueMap.h:208
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:180
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:639

Member Data Documentation

const float GsfEleDeltaBetaIsoCut::_barrelCutOff
private

Definition at line 25 of file GsfEleDeltaBetaIsoCut.cc.

Referenced by operator()().

edm::Handle<edm::ValueMap<float> > GsfEleDeltaBetaIsoCut::_chad_iso
private

Definition at line 27 of file GsfEleDeltaBetaIsoCut.cc.

Referenced by getEventContent(), operator()(), and value().

const float GsfEleDeltaBetaIsoCut::_deltaBetaConstant
private

Definition at line 25 of file GsfEleDeltaBetaIsoCut.cc.

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

const float GsfEleDeltaBetaIsoCut::_isoCutEBHighPt
private

Definition at line 24 of file GsfEleDeltaBetaIsoCut.cc.

Referenced by operator()().

const float GsfEleDeltaBetaIsoCut::_isoCutEBLowPt
private

Definition at line 24 of file GsfEleDeltaBetaIsoCut.cc.

Referenced by operator()().

const float GsfEleDeltaBetaIsoCut::_isoCutEEHighPt
private

Definition at line 24 of file GsfEleDeltaBetaIsoCut.cc.

Referenced by operator()().

const float GsfEleDeltaBetaIsoCut::_isoCutEELowPt
private

Definition at line 24 of file GsfEleDeltaBetaIsoCut.cc.

Referenced by operator()().

edm::Handle<edm::ValueMap<float> > GsfEleDeltaBetaIsoCut::_nhad_iso
private

Definition at line 27 of file GsfEleDeltaBetaIsoCut.cc.

Referenced by getEventContent(), operator()(), and value().

edm::Handle<edm::ValueMap<float> > GsfEleDeltaBetaIsoCut::_ph_iso
private

Definition at line 27 of file GsfEleDeltaBetaIsoCut.cc.

Referenced by getEventContent(), operator()(), and value().

const float GsfEleDeltaBetaIsoCut::_ptCutOff
private

Definition at line 25 of file GsfEleDeltaBetaIsoCut.cc.

Referenced by operator()().

edm::Handle<edm::ValueMap<float> > GsfEleDeltaBetaIsoCut::_PUchad_iso
private

Definition at line 27 of file GsfEleDeltaBetaIsoCut.cc.

Referenced by getEventContent(), operator()(), and value().

bool GsfEleDeltaBetaIsoCut::_relativeIso
private

Definition at line 26 of file GsfEleDeltaBetaIsoCut.cc.

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