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 override final;
9 
10  void setConsumes(edm::ConsumesCollector&) override final;
11  void getEventContent(const edm::EventBase&) override final;
12 
13  double value(const reco::CandidatePtr& cand) const override final;
14 
15  CandidateType candidateType() const override 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 }
double value(const reco::CandidatePtr &cand) const override final
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
void getEventContent(const edm::EventBase &) override final
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
key_type key() const
Definition: Ptr.h:186
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
bool ev
CandidateType candidateType() const override final
#define constexpr
std::unordered_map< std::string, edm::InputTag > contentTags_
result_type operator()(const reco::PhotonPtr &) const override final
bool contains(ProductID id) const
Definition: ValueMap.h:154
float full5x5_sigmaIetaIeta() const
Definition: Photon.h:237
PhoFull5x5SigmaIEtaIEtaValueMapCut(const edm::ParameterSet &c)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:74
void setConsumes(edm::ConsumesCollector &) override final
size_t idSize() const
Definition: ValueMap.h:158
const_iterator begin() const
Definition: ValueMap.h:207
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:181
edm::Handle< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMap
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:94
#define DEFINE_EDM_PLUGIN(factory, type, name)