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
GsfEleConversionVetoCut Class Reference
Inheritance diagram for GsfEleConversionVetoCut:
CutApplicatorWithEventContentBase CutApplicatorBase candidate_functions::CandidateCut

Public Member Functions

CandidateType candidateType () const final
 
void getEventContent (const edm::EventBase &) final
 
 GsfEleConversionVetoCut (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

edm::Handle
< reco::ConversionCollection
_convs
 
edm::Handle< reco::BeamSpot_thebs
 

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 8 of file GsfEleConversionVetoCut.cc.

Constructor & Destructor Documentation

GsfEleConversionVetoCut::GsfEleConversionVetoCut ( const edm::ParameterSet c)

Definition at line 28 of file GsfEleConversionVetoCut.cc.

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

29  edm::InputTag conversiontag = c.getParameter<edm::InputTag>("conversionSrc");
30  contentTags_.emplace("conversions", conversiontag);
31 
32  edm::InputTag conversiontagMiniAOD = c.getParameter<edm::InputTag>("conversionSrcMiniAOD");
33  contentTags_.emplace("conversionsMiniAOD", conversiontagMiniAOD);
34 
35  edm::InputTag beamspottag = c.getParameter<edm::InputTag>("beamspotSrc");
36  contentTags_.emplace("beamspot", beamspottag);
37 }
std::unordered_map< std::string, edm::InputTag > contentTags_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

Member Function Documentation

CandidateType GsfEleConversionVetoCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 19 of file GsfEleConversionVetoCut.cc.

References CutApplicatorBase::ELECTRON.

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

Implements CutApplicatorWithEventContentBase.

Definition at line 48 of file GsfEleConversionVetoCut.cc.

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

48  {
49  // First try AOD, then go to miniAOD. Use the same Handle since collection class is the same.
50  ev.getByLabel(contentTags_["conversions"], _convs);
51  if (!_convs.isValid())
52  ev.getByLabel(contentTags_["conversionsMiniAOD"], _convs);
53 
54  ev.getByLabel(contentTags_["beamspot"], _thebs);
55 }
std::unordered_map< std::string, edm::InputTag > contentTags_
edm::Handle< reco::BeamSpot > _thebs
edm::Handle< reco::ConversionCollection > _convs
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
CutApplicatorBase::result_type GsfEleConversionVetoCut::operator() ( const reco::GsfElectronPtr cand) const
finalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 57 of file GsfEleConversionVetoCut.cc.

References _convs, _thebs, ConversionTools::hasMatchedConversion(), and edm::HandleBase::isValid().

57  {
58  if (_thebs.isValid() && _convs.isValid()) {
59  return !ConversionTools::hasMatchedConversion(*cand, *_convs, _thebs->position());
60  } else {
61  edm::LogWarning("GsfEleConversionVetoCut") << "Couldn't find a necessary collection, returning true!";
62  }
63  return true;
64 }
edm::Handle< reco::BeamSpot > _thebs
edm::Handle< reco::ConversionCollection > _convs
static bool hasMatchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
bool isValid() const
Definition: HandleBase.h:70
Log< level::Warning, false > LogWarning
void GsfEleConversionVetoCut::setConsumes ( edm::ConsumesCollector cc)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 39 of file GsfEleConversionVetoCut.cc.

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

39  {
40  auto convs = cc.mayConsume<reco::ConversionCollection>(contentTags_["conversions"]);
41  auto convsMiniAOD = cc.mayConsume<reco::ConversionCollection>(contentTags_["conversionsMiniAOD"]);
42  auto thebs = cc.consumes<reco::BeamSpot>(contentTags_["beamspot"]);
43  contentTokens_.emplace("conversions", convs);
44  contentTokens_.emplace("conversionsMiniAOD", convsMiniAOD);
45  contentTokens_.emplace("beamspot", thebs);
46 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::unordered_map< std::string, edm::InputTag > contentTags_
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
double GsfEleConversionVetoCut::value ( const reco::CandidatePtr cand) const
finalvirtual

Implements candidate_functions::CandidateCut.

Definition at line 66 of file GsfEleConversionVetoCut.cc.

References _convs, _thebs, ConversionTools::hasMatchedConversion(), and edm::HandleBase::isValid().

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().

66  {
67  reco::GsfElectronPtr ele(cand);
68  if (_thebs.isValid() && _convs.isValid()) {
69  return !ConversionTools::hasMatchedConversion(*ele, *_convs, _thebs->position());
70  } else {
71  edm::LogWarning("GsfEleConversionVetoCut") << "Couldn't find a necessary collection, returning true!";
72  return true;
73  }
74 }
edm::Handle< reco::BeamSpot > _thebs
edm::Handle< reco::ConversionCollection > _convs
static bool hasMatchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
bool isValid() const
Definition: HandleBase.h:70
Log< level::Warning, false > LogWarning

Member Data Documentation

edm::Handle<reco::ConversionCollection> GsfEleConversionVetoCut::_convs
private

Definition at line 22 of file GsfEleConversionVetoCut.cc.

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

edm::Handle<reco::BeamSpot> GsfEleConversionVetoCut::_thebs
private

Definition at line 23 of file GsfEleConversionVetoCut.cc.

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