CMS 3D CMS Logo

PhoFull5x5SigmaIEtaIEtaValueMapCut.cc
Go to the documentation of this file.
3 
5 public:
7 
8  result_type operator()(const reco::PhotonPtr&) const final;
9 
11  void getEventContent(const edm::EventBase&) final;
12 
13  double value(const reco::CandidatePtr& cand) const final;
14 
15  CandidateType candidateType() const final {
16  return PHOTON;
17  }
18 
19 private:
20  const float _cutValueEB;
21  const float _cutValueEE;
22  const float _barrelCutOff;
24 
25  constexpr static char full5x5SigmaIEtaIEta_[] = "full5x5SigmaIEtaIEta";
26 };
27 
29 
32  "PhoFull5x5SigmaIEtaIEtaValueMapCut");
33 
36  _cutValueEB(c.getParameter<double>("cutValueEB")),
37  _cutValueEE(c.getParameter<double>("cutValueEE")),
38  _barrelCutOff(c.getParameter<double>("barrelCutOff")) {
39 
40  edm::InputTag maptag = c.getParameter<edm::InputTag>("full5x5SigmaIEtaIEtaMap");
41  contentTags_.emplace(full5x5SigmaIEtaIEta_,maptag);
42 }
43 
45  auto full5x5SigmaIEtaIEta =
47  contentTokens_.emplace(full5x5SigmaIEtaIEta_,full5x5SigmaIEtaIEta);
48 }
49 
52 }
53 
54 CutApplicatorBase::result_type
57 
58  // Figure out the cut value
59  const float cutValue =
60  ( std::abs(cand->superCluster()->eta()) < _barrelCutOff ?
62  float sihihval = -1.0;
64  sihihval = (*_full5x5SigmaIEtaIEtaMap)[cand];
66  cand.id() == edm::ProductID() ) {
67  // in case we have spoofed a ptr
68  //note this must be a 1:1 valuemap (only one product input)
69  sihihval = _full5x5SigmaIEtaIEtaMap->begin()[cand.key()];
70  } else if ( _full5x5SigmaIEtaIEtaMap.isValid() ){ // throw an exception
71  sihihval = (*_full5x5SigmaIEtaIEtaMap)[cand];
72  }
73 
74  // Retrieve the variable value for this particle
75  const float full5x5SigmaIEtaIEta = _full5x5SigmaIEtaIEtaMap.isValid() ? sihihval : cand->full5x5_sigmaIetaIeta();
76 
77  // Apply the cut and return the result
78  return full5x5SigmaIEtaIEta < cutValue;
79 }
80 
82 value(const reco::CandidatePtr& cand) const {
83  reco::PhotonPtr pho(cand);
84  float sihihval = -1.0;
86  sihihval = (*_full5x5SigmaIEtaIEtaMap)[cand];
88  cand.id() == edm::ProductID() ) {
89  // in case we have spoofed a ptr
90  //note this must be a 1:1 valuemap (only one product input)
91  sihihval = _full5x5SigmaIEtaIEtaMap->begin()[cand.key()];
92  } else if ( _full5x5SigmaIEtaIEtaMap.isValid() ){ // throw an exception
93  sihihval = (*_full5x5SigmaIEtaIEtaMap)[cand];
94  }
95 
96  return _full5x5SigmaIEtaIEtaMap.isValid() ? sihihval : pho->full5x5_sigmaIetaIeta();
97 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
key_type key() const
Definition: Ptr.h:185
result_type operator()(const reco::PhotonPtr &) const final
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
bool ev
void setConsumes(edm::ConsumesCollector &) final
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
#define constexpr
std::unordered_map< std::string, edm::InputTag > contentTags_
bool contains(ProductID id) const
Definition: ValueMap.h:155
float full5x5_sigmaIetaIeta() const
Definition: Photon.h:243
PhoFull5x5SigmaIEtaIEtaValueMapCut(const edm::ParameterSet &c)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void getEventContent(const edm::EventBase &) final
bool isValid() const
Definition: HandleBase.h:74
size_t idSize() const
Definition: ValueMap.h:159
const_iterator begin() const
Definition: ValueMap.h:208
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:180
edm::Handle< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMap
double value(const reco::CandidatePtr &cand) const final
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:94
#define DEFINE_EDM_PLUGIN(factory, type, name)