CMS 3D CMS Logo

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

Public Member Functions

CandidateType candidateType () const override final
 
void getEventContent (const edm::EventBase &) override final
 
 GsfEleDzCut (const edm::ParameterSet &c)
 
result_type operator() (const reco::GsfElectronPtr &) const override final
 
void setConsumes (edm::ConsumesCollector &) override final
 
double value (const reco::CandidatePtr &cand) const override final
 
- Public Member Functions inherited from CutApplicatorWithEventContentBase
 CutApplicatorWithEventContentBase ()
 
 CutApplicatorWithEventContentBase (const edm::ParameterSet &c)
 
 CutApplicatorWithEventContentBase (const CutApplicatorWithEventContentBase &)=delete
 
CutApplicatorWithEventContentBaseoperator= (const CutApplicatorWithEventContentBase &)=delete
 
virtual ~CutApplicatorWithEventContentBase ()
 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
 
virtual const std::string & name () const
 
virtual result_type operator() (const argument_type &) const 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
 
virtual ~CutApplicatorBase ()
 Destructor. More...
 
- Public Member Functions inherited from candidate_functions::CandidateCut
 CandidateCut ()
 
virtual ~CandidateCut ()
 

Private Attributes

const double _barrelCutOff
 
const double _dzCutValueEB
 
const double _dzCutValueEE
 
edm::Handle< reco::VertexCollection_vtxs
 

Additional Inherited Members

- Public Types inherited from CutApplicatorBase
enum  CandidateType {
  NONE, ELECTRON, MUON, PHOTON,
  TAU, PATELECTRON, PATMUON, PATPHOTON,
  PATTAU
}
 
- Protected Attributes inherited from CutApplicatorWithEventContentBase
std::unordered_map< std::string, edm::InputTagcontentTags_
 
std::unordered_map< std::string, edm::EDGetTokencontentTokens_
 

Detailed Description

Definition at line 7 of file GsfEleDzCut.cc.

Constructor & Destructor Documentation

GsfEleDzCut::GsfEleDzCut ( const edm::ParameterSet c)

Definition at line 31 of file GsfEleDzCut.cc.

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

31  :
33  _dzCutValueEB(c.getParameter<double>("dzCutValueEB")),
34  _dzCutValueEE(c.getParameter<double>("dzCutValueEE")),
35  _barrelCutOff(c.getParameter<double>("barrelCutOff")) {
36  edm::InputTag vertextag = c.getParameter<edm::InputTag>("vertexSrc");
37  edm::InputTag vertextagMiniAOD = c.getParameter<edm::InputTag>("vertexSrcMiniAOD");
38  contentTags_.emplace("vertices",vertextag);
39  contentTags_.emplace("verticesMiniAOD",vertextagMiniAOD);
40 }
T getParameter(std::string const &) const
std::unordered_map< std::string, edm::InputTag > contentTags_
const double _barrelCutOff
Definition: GsfEleDzCut.cc:23
const double _dzCutValueEB
Definition: GsfEleDzCut.cc:23
const double _dzCutValueEE
Definition: GsfEleDzCut.cc:23

Member Function Documentation

CandidateType GsfEleDzCut::candidateType ( ) const
inlinefinaloverridevirtual

Reimplemented from CutApplicatorBase.

Definition at line 18 of file GsfEleDzCut.cc.

References CutApplicatorBase::ELECTRON.

18  {
19  return ELECTRON;
20  }
void GsfEleDzCut::getEventContent ( const edm::EventBase ev)
finaloverridevirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 49 of file GsfEleDzCut.cc.

References _vtxs, CutApplicatorWithEventContentBase::contentTags_, edm::EventBase::getByLabel(), edm::HandleBase::isValid(), and operator()().

49  {
50  // First try AOD, then go to miniAOD. Use the same Handle since collection class is the same.
51  ev.getByLabel(contentTags_["vertices"],_vtxs);
52  if (!_vtxs.isValid())
53  ev.getByLabel(contentTags_["verticesMiniAOD"],_vtxs);
54 }
std::unordered_map< std::string, edm::InputTag > contentTags_
bool isValid() const
Definition: HandleBase.h:75
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:89
edm::Handle< reco::VertexCollection > _vtxs
Definition: GsfEleDzCut.cc:24
CutApplicatorBase::result_type GsfEleDzCut::operator() ( const reco::GsfElectronPtr cand) const
finaloverridevirtual

Reimplemented from CutApplicatorBase.

Definition at line 58 of file GsfEleDzCut.cc.

References _barrelCutOff, _dzCutValueEB, _dzCutValueEE, _vtxs, funct::abs(), allConversions_cfi::dz, reco::GsfElectron::gsfTrack(), position, and reco::GsfElectron::superCluster().

Referenced by getEventContent().

58  {
59  const float dzCutValue =
60  ( std::abs(cand->superCluster()->position().eta()) < _barrelCutOff ?
62 
63  const reco::VertexCollection& vtxs = *_vtxs;
64  const double dz = ( vtxs.size() ?
65  cand->gsfTrack()->dz(vtxs[0].position()) :
66  cand->gsfTrack()->dz() );
67  return std::abs(dz) < dzCutValue;
68 }
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
const double _barrelCutOff
Definition: GsfEleDzCut.cc:23
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:184
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const double _dzCutValueEB
Definition: GsfEleDzCut.cc:23
const double _dzCutValueEE
Definition: GsfEleDzCut.cc:23
static int position[264][3]
Definition: ReadPGInfo.cc:509
edm::Handle< reco::VertexCollection > _vtxs
Definition: GsfEleDzCut.cc:24
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:185
void GsfEleDzCut::setConsumes ( edm::ConsumesCollector cc)
finaloverridevirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 42 of file GsfEleDzCut.cc.

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

42  {
43  auto vtcs = cc.mayConsume<reco::VertexCollection>(contentTags_["vertices"]);
44  auto vtcsMiniAOD = cc.mayConsume<reco::VertexCollection>(contentTags_["verticesMiniAOD"]);
45  contentTokens_.emplace("vertices",vtcs);
46  contentTokens_.emplace("verticesMiniAOD",vtcsMiniAOD);
47 }
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::unordered_map< std::string, edm::InputTag > contentTags_
double GsfEleDzCut::value ( const reco::CandidatePtr cand) const
finaloverridevirtual

Implements candidate_functions::CandidateCut.

Definition at line 70 of file GsfEleDzCut.cc.

References _vtxs, funct::abs(), allConversions_cfi::dz, reco::GsfElectron::gsfTrack(), and position.

70  {
71  reco::GsfElectronPtr ele(cand);
72  const reco::VertexCollection& vtxs = *_vtxs;
73  const double dz = ( vtxs.size() ?
74  ele->gsfTrack()->dz(vtxs[0].position()) :
75  ele->gsfTrack()->dz() );
76  return std::abs(dz);
77 }
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static int position[264][3]
Definition: ReadPGInfo.cc:509
edm::Handle< reco::VertexCollection > _vtxs
Definition: GsfEleDzCut.cc:24

Member Data Documentation

const double GsfEleDzCut::_barrelCutOff
private

Definition at line 23 of file GsfEleDzCut.cc.

Referenced by operator()().

const double GsfEleDzCut::_dzCutValueEB
private

Definition at line 23 of file GsfEleDzCut.cc.

Referenced by operator()().

const double GsfEleDzCut::_dzCutValueEE
private

Definition at line 23 of file GsfEleDzCut.cc.

Referenced by operator()().

edm::Handle<reco::VertexCollection> GsfEleDzCut::_vtxs
private

Definition at line 24 of file GsfEleDzCut.cc.

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