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 
16 
17 private:
18  const float _cutValueEB;
19  const float _cutValueEE;
20  const float _barrelCutOff;
22 
23  constexpr static char full5x5SigmaIEtaIEta_[] = "full5x5SigmaIEtaIEta";
24 };
25 
27 
28 DEFINE_EDM_PLUGIN(CutApplicatorFactory, PhoFull5x5SigmaIEtaIEtaValueMapCut, "PhoFull5x5SigmaIEtaIEtaValueMapCut");
29 
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 }
38 
40  auto full5x5SigmaIEtaIEta = cc.consumes<edm::ValueMap<float> >(contentTags_[full5x5SigmaIEtaIEta_]);
41  contentTokens_.emplace(full5x5SigmaIEtaIEta_, full5x5SigmaIEtaIEta);
42 }
43 
46 }
47 
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 }
69 
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 }
std::unordered_map< std::string, edm::InputTag > contentTags_
result_type operator()(const reco::PhotonPtr &) const final
size_t idSize() const
Definition: ValueMap.h:157
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
void setConsumes(edm::ConsumesCollector &) final
PhoFull5x5SigmaIEtaIEtaValueMapCut(const edm::ParameterSet &c)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void getEventContent(const edm::EventBase &) final
double value(const reco::CandidatePtr &cand) const final
const_iterator begin() const
Definition: ValueMap.h:229
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
edm::Handle< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMap
bool isValid() const
Definition: HandleBase.h:70
#define DEFINE_EDM_PLUGIN(factory, type, name)
bool contains(ProductID id) const
Definition: ValueMap.h:155