CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 final
 
void getEventContent (const edm::EventBase &) final
 
 GsfEleDzCut (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 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 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
}
 
- 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::InputTag
contentTags_
 
std::unordered_map
< std::string, edm::EDGetToken
contentTokens_
 

Detailed Description

Definition at line 7 of file GsfEleDzCut.cc.

Constructor & Destructor Documentation

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

Definition at line 27 of file GsfEleDzCut.cc.

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

29  _dzCutValueEB(c.getParameter<double>("dzCutValueEB")),
30  _dzCutValueEE(c.getParameter<double>("dzCutValueEE")),
31  _barrelCutOff(c.getParameter<double>("barrelCutOff")) {
32  edm::InputTag vertextag = c.getParameter<edm::InputTag>("vertexSrc");
33  edm::InputTag vertextagMiniAOD = c.getParameter<edm::InputTag>("vertexSrcMiniAOD");
34  contentTags_.emplace("vertices", vertextag);
35  contentTags_.emplace("verticesMiniAOD", vertextagMiniAOD);
36 }
std::unordered_map< std::string, edm::InputTag > contentTags_
const double _barrelCutOff
Definition: GsfEleDzCut.cc:21
const double _dzCutValueEB
Definition: GsfEleDzCut.cc:21
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const double _dzCutValueEE
Definition: GsfEleDzCut.cc:21

Member Function Documentation

CandidateType GsfEleDzCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 18 of file GsfEleDzCut.cc.

References CutApplicatorBase::ELECTRON.

void GsfEleDzCut::getEventContent ( const edm::EventBase ev)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 45 of file GsfEleDzCut.cc.

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

45  {
46  // First try AOD, then go to miniAOD. Use the same Handle since collection class is the same.
47  ev.getByLabel(contentTags_["vertices"], _vtxs);
48  if (!_vtxs.isValid())
49  ev.getByLabel(contentTags_["verticesMiniAOD"], _vtxs);
50 }
std::unordered_map< std::string, edm::InputTag > contentTags_
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
edm::Handle< reco::VertexCollection > _vtxs
Definition: GsfEleDzCut.cc:22
CutApplicatorBase::result_type GsfEleDzCut::operator() ( const reco::GsfElectronPtr cand) const
finalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 52 of file GsfEleDzCut.cc.

References _barrelCutOff, _dzCutValueEB, _dzCutValueEE, _vtxs, funct::abs(), PVValHelper::dz, and position.

52  {
53  const float dzCutValue =
54  (std::abs(cand->superCluster()->position().eta()) < _barrelCutOff ? _dzCutValueEB : _dzCutValueEE);
55 
56  const reco::VertexCollection& vtxs = *_vtxs;
57  const double dz = (!vtxs.empty() ? cand->gsfTrack()->dz(vtxs[0].position()) : cand->gsfTrack()->dz());
58  return std::abs(dz) < dzCutValue;
59 }
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
const double _barrelCutOff
Definition: GsfEleDzCut.cc:21
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const double _dzCutValueEB
Definition: GsfEleDzCut.cc:21
const double _dzCutValueEE
Definition: GsfEleDzCut.cc:21
static int position[264][3]
Definition: ReadPGInfo.cc:289
edm::Handle< reco::VertexCollection > _vtxs
Definition: GsfEleDzCut.cc:22
void GsfEleDzCut::setConsumes ( edm::ConsumesCollector cc)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 38 of file GsfEleDzCut.cc.

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

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

Implements candidate_functions::CandidateCut.

Definition at line 61 of file GsfEleDzCut.cc.

References _vtxs, funct::abs(), PVValHelper::dz, and position.

Referenced by Types.int32::__nonzero__(), Types.uint32::__nonzero__(), Types.int64::__nonzero__(), Types.uint64::__nonzero__(), Types.double::__nonzero__(), Types.bool::__nonzero__(), Types.string::__nonzero__(), Types.string::configValue(), Types.FileInPath::configValue(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Types.double::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.FileInPath::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), and Types.vstring::insertInto().

61  {
62  reco::GsfElectronPtr ele(cand);
63  const reco::VertexCollection& vtxs = *_vtxs;
64  const double dz = (!vtxs.empty() ? ele->gsfTrack()->dz(vtxs[0].position()) : ele->gsfTrack()->dz());
65  return std::abs(dz);
66 }
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:289
edm::Handle< reco::VertexCollection > _vtxs
Definition: GsfEleDzCut.cc:22

Member Data Documentation

const double GsfEleDzCut::_barrelCutOff
private

Definition at line 21 of file GsfEleDzCut.cc.

Referenced by operator()().

const double GsfEleDzCut::_dzCutValueEB
private

Definition at line 21 of file GsfEleDzCut.cc.

Referenced by operator()().

const double GsfEleDzCut::_dzCutValueEE
private

Definition at line 21 of file GsfEleDzCut.cc.

Referenced by operator()().

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

Definition at line 22 of file GsfEleDzCut.cc.

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