CMS 3D CMS Logo

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

Public Member Functions

CandidateType candidateType () const final
 
void getEventContent (const edm::EventBase &) final
 
 GsfEleDxyCut (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 CutApplicatorWithEventContentBase &)=delete
 
 CutApplicatorWithEventContentBase (const edm::ParameterSet &c)
 
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 CutApplicatorBase &)=delete
 
 CutApplicatorBase (const edm::ParameterSet &c)
 
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 pat::MuonPtr &) const
 
virtual result_type operator() (const pat::PhotonPtr &) const
 
virtual result_type operator() (const pat::TauPtr &) const
 
virtual result_type operator() (const reco::MuonPtr &) const
 
virtual result_type operator() (const reco::PFTauPtr &) const
 
virtual result_type operator() (const reco::PhotonPtr &) 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 _dxyCutValueEB
 
const double _dxyCutValueEE
 
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::InputTagcontentTags_
 
std::unordered_map< std::string, edm::EDGetTokencontentTokens_
 

Detailed Description

Definition at line 7 of file GsfEleDxyCut.cc.

Constructor & Destructor Documentation

◆ GsfEleDxyCut()

GsfEleDxyCut::GsfEleDxyCut ( const edm::ParameterSet c)

Definition at line 27 of file GsfEleDxyCut.cc.

29  _dxyCutValueEB(c.getParameter<double>("dxyCutValueEB")),
30  _dxyCutValueEE(c.getParameter<double>("dxyCutValueEE")),
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 }

References HltBtagPostValidation_cff::c, and CutApplicatorWithEventContentBase::contentTags_.

Member Function Documentation

◆ candidateType()

CandidateType GsfEleDxyCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 18 of file GsfEleDxyCut.cc.

18 { return ELECTRON; }

References CutApplicatorBase::ELECTRON.

◆ getEventContent()

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

Implements CutApplicatorWithEventContentBase.

Definition at line 45 of file GsfEleDxyCut.cc.

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 }

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

◆ operator()()

CutApplicatorBase::result_type GsfEleDxyCut::operator() ( const reco::GsfElectronPtr cand) const
finalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 52 of file GsfEleDxyCut.cc.

52  {
53  const float dxyCutValue =
54  (std::abs(cand->superCluster()->position().eta()) < _barrelCutOff ? _dxyCutValueEB : _dxyCutValueEE);
55 
56  const reco::VertexCollection& vtxs = *_vtxs;
57  const double dxy = (!vtxs.empty() ? cand->gsfTrack()->dxy(vtxs[0].position()) : cand->gsfTrack()->dxy());
58  return std::abs(dxy) < dxyCutValue;
59 }

References _barrelCutOff, _dxyCutValueEB, _dxyCutValueEE, _vtxs, funct::abs(), PVValHelper::dxy, and position.

◆ setConsumes()

void GsfEleDxyCut::setConsumes ( edm::ConsumesCollector cc)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 38 of file GsfEleDxyCut.cc.

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 }

References CutApplicatorWithEventContentBase::contentTags_, and CutApplicatorWithEventContentBase::contentTokens_.

◆ value()

double GsfEleDxyCut::value ( const reco::CandidatePtr cand) const
finalvirtual

Implements candidate_functions::CandidateCut.

Definition at line 61 of file GsfEleDxyCut.cc.

61  {
63  const reco::VertexCollection& vtxs = *_vtxs;
64  const double dxy = (!vtxs.empty() ? ele->gsfTrack()->dxy(vtxs[0].position()) : ele->gsfTrack()->dxy());
65  return std::abs(dxy);
66 }

References _vtxs, funct::abs(), PVValHelper::dxy, reco::GsfElectron::gsfTrack(), and position.

Member Data Documentation

◆ _barrelCutOff

const double GsfEleDxyCut::_barrelCutOff
private

Definition at line 21 of file GsfEleDxyCut.cc.

Referenced by operator()().

◆ _dxyCutValueEB

const double GsfEleDxyCut::_dxyCutValueEB
private

Definition at line 21 of file GsfEleDxyCut.cc.

Referenced by operator()().

◆ _dxyCutValueEE

const double GsfEleDxyCut::_dxyCutValueEE
private

Definition at line 21 of file GsfEleDxyCut.cc.

Referenced by operator()().

◆ _vtxs

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

Definition at line 22 of file GsfEleDxyCut.cc.

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

GsfEleDxyCut::_vtxs
edm::Handle< reco::VertexCollection > _vtxs
Definition: GsfEleDxyCut.cc:22
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition: CutApplicatorWithEventContentBase.h:35
GsfEleDxyCut::_dxyCutValueEB
const double _dxyCutValueEB
Definition: GsfEleDxyCut.cc:21
GsfEleDxyCut::_dxyCutValueEE
const double _dxyCutValueEE
Definition: GsfEleDxyCut.cc:21
CutApplicatorWithEventContentBase::CutApplicatorWithEventContentBase
CutApplicatorWithEventContentBase()
Definition: CutApplicatorWithEventContentBase.h:21
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
cand
Definition: decayParser.h:34
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
cc
edm::Ptr< reco::GsfElectron >
PVValHelper::dxy
Definition: PVValidationHelpers.h:47
GsfEleDxyCut::_barrelCutOff
const double _barrelCutOff
Definition: GsfEleDxyCut.cc:21
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
CutApplicatorWithEventContentBase::contentTokens_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition: CutApplicatorWithEventContentBase.h:40
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
CutApplicatorBase::ELECTRON
Definition: CutApplicatorBase.h:47
edm::InputTag
Definition: InputTag.h:15