CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
PhoFull5x5SigmaIEtaIEtaValueMapCut Class Reference
Inheritance diagram for PhoFull5x5SigmaIEtaIEtaValueMapCut:
CutApplicatorWithEventContentBase CutApplicatorBase candidate_functions::CandidateCut

Public Member Functions

CandidateType candidateType () const final
 
void getEventContent (const edm::EventBase &) final
 
result_type operator() (const reco::PhotonPtr &) const final
 
 PhoFull5x5SigmaIEtaIEtaValueMapCut (const edm::ParameterSet &c)
 
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 reco::GsfElectronPtr &) const
 
virtual result_type operator() (const pat::ElectronPtr &) const
 
virtual result_type operator() (const reco::MuonPtr &) const
 
virtual result_type operator() (const pat::MuonPtr &) 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
 
const float _cutValueEB
 
const float _cutValueEE
 
edm::Handle< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMap
 

Static Private Attributes

static constexpr char full5x5SigmaIEtaIEta_ [] = "full5x5SigmaIEtaIEta"
 

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 4 of file PhoFull5x5SigmaIEtaIEtaValueMapCut.cc.

Constructor & Destructor Documentation

◆ PhoFull5x5SigmaIEtaIEtaValueMapCut()

PhoFull5x5SigmaIEtaIEtaValueMapCut::PhoFull5x5SigmaIEtaIEtaValueMapCut ( const edm::ParameterSet c)

Definition at line 30 of file PhoFull5x5SigmaIEtaIEtaValueMapCut.cc.

References c, CutApplicatorWithEventContentBase::contentTags_, and full5x5SigmaIEtaIEta_.

32  _cutValueEB(c.getParameter<double>("cutValueEB")),
33  _cutValueEE(c.getParameter<double>("cutValueEE")),
34  _barrelCutOff(c.getParameter<double>("barrelCutOff")) {
35  edm::InputTag maptag = c.getParameter<edm::InputTag>("full5x5SigmaIEtaIEtaMap");
36  contentTags_.emplace(full5x5SigmaIEtaIEta_, maptag);
37 }
std::unordered_map< std::string, edm::InputTag > contentTags_

Member Function Documentation

◆ candidateType()

CandidateType PhoFull5x5SigmaIEtaIEtaValueMapCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 15 of file PhoFull5x5SigmaIEtaIEtaValueMapCut.cc.

References CutApplicatorBase::PHOTON.

◆ getEventContent()

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

◆ operator()()

CutApplicatorBase::result_type PhoFull5x5SigmaIEtaIEtaValueMapCut::operator() ( const reco::PhotonPtr cand) const
finalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 48 of file PhoFull5x5SigmaIEtaIEtaValueMapCut.cc.

References _barrelCutOff, _cutValueEB, _cutValueEE, _full5x5SigmaIEtaIEtaMap, funct::abs(), edm::ValueMap< T >::begin(), edm::ValueMap< T >::contains(), edm::ValueMap< T >::idSize(), and edm::HandleBase::isValid().

48  {
49  // Figure out the cut value
50  const float cutValue = (std::abs(cand->superCluster()->eta()) < _barrelCutOff ? _cutValueEB : _cutValueEE);
51  float sihihval = -1.0;
53  sihihval = (*_full5x5SigmaIEtaIEtaMap)[cand];
55  cand.id() == edm::ProductID()) {
56  // in case we have spoofed a ptr
57  //note this must be a 1:1 valuemap (only one product input)
58  sihihval = _full5x5SigmaIEtaIEtaMap->begin()[cand.key()];
59  } else if (_full5x5SigmaIEtaIEtaMap.isValid()) { // throw an exception
60  sihihval = (*_full5x5SigmaIEtaIEtaMap)[cand];
61  }
62 
63  // Retrieve the variable value for this particle
64  const float full5x5SigmaIEtaIEta = _full5x5SigmaIEtaIEtaMap.isValid() ? sihihval : cand->full5x5_sigmaIetaIeta();
65 
66  // Apply the cut and return the result
67  return full5x5SigmaIEtaIEta < cutValue;
68 }
size_t idSize() const
Definition: ValueMap.h:157
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const_iterator begin() const
Definition: ValueMap.h:229
edm::Handle< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMap
bool isValid() const
Definition: HandleBase.h:70
bool contains(ProductID id) const
Definition: ValueMap.h:155

◆ setConsumes()

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

Implements CutApplicatorWithEventContentBase.

Definition at line 39 of file PhoFull5x5SigmaIEtaIEtaValueMapCut.cc.

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

39  {
40  auto full5x5SigmaIEtaIEta = cc.consumes<edm::ValueMap<float> >(contentTags_[full5x5SigmaIEtaIEta_]);
41  contentTokens_.emplace(full5x5SigmaIEtaIEta_, full5x5SigmaIEtaIEta);
42 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::unordered_map< std::string, edm::InputTag > contentTags_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_

◆ value()

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

Implements candidate_functions::CandidateCut.

Definition at line 70 of file PhoFull5x5SigmaIEtaIEtaValueMapCut.cc.

References _full5x5SigmaIEtaIEtaMap, edm::ValueMap< T >::begin(), edm::ValueMap< T >::contains(), edm::ValueMap< T >::idSize(), and edm::HandleBase::isValid().

70  {
71  reco::PhotonPtr pho(cand);
72  float sihihval = -1.0;
74  sihihval = (*_full5x5SigmaIEtaIEtaMap)[cand];
76  cand.id() == edm::ProductID()) {
77  // in case we have spoofed a ptr
78  //note this must be a 1:1 valuemap (only one product input)
79  sihihval = _full5x5SigmaIEtaIEtaMap->begin()[cand.key()];
80  } else if (_full5x5SigmaIEtaIEtaMap.isValid()) { // throw an exception
81  sihihval = (*_full5x5SigmaIEtaIEtaMap)[cand];
82  }
83 
84  return _full5x5SigmaIEtaIEtaMap.isValid() ? sihihval : pho->full5x5_sigmaIetaIeta();
85 }
size_t idSize() const
Definition: ValueMap.h:157
const_iterator begin() const
Definition: ValueMap.h:229
edm::Handle< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMap
bool isValid() const
Definition: HandleBase.h:70
bool contains(ProductID id) const
Definition: ValueMap.h:155

Member Data Documentation

◆ _barrelCutOff

const float PhoFull5x5SigmaIEtaIEtaValueMapCut::_barrelCutOff
private

Definition at line 20 of file PhoFull5x5SigmaIEtaIEtaValueMapCut.cc.

Referenced by operator()().

◆ _cutValueEB

const float PhoFull5x5SigmaIEtaIEtaValueMapCut::_cutValueEB
private

Definition at line 18 of file PhoFull5x5SigmaIEtaIEtaValueMapCut.cc.

Referenced by operator()().

◆ _cutValueEE

const float PhoFull5x5SigmaIEtaIEtaValueMapCut::_cutValueEE
private

Definition at line 19 of file PhoFull5x5SigmaIEtaIEtaValueMapCut.cc.

Referenced by operator()().

◆ _full5x5SigmaIEtaIEtaMap

edm::Handle<edm::ValueMap<float> > PhoFull5x5SigmaIEtaIEtaValueMapCut::_full5x5SigmaIEtaIEtaMap
private

Definition at line 21 of file PhoFull5x5SigmaIEtaIEtaValueMapCut.cc.

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

◆ full5x5SigmaIEtaIEta_

constexpr char PhoFull5x5SigmaIEtaIEtaValueMapCut::full5x5SigmaIEtaIEta_ = "full5x5SigmaIEtaIEta"
staticprivate