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 }
CutApplicatorBase::PHOTON
Definition: CutApplicatorBase.h:47
PhoFull5x5SigmaIEtaIEtaValueMapCut::_barrelCutOff
const float _barrelCutOff
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:20
PhoFull5x5SigmaIEtaIEtaValueMapCut::value
double value(const reco::CandidatePtr &cand) const final
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:70
watchdog.const
const
Definition: watchdog.py:83
edm::Handle
Definition: AssociativeIterator.h:50
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition: CutApplicatorWithEventContentBase.h:35
candidate_functions::CandidateCut::result_type
bool result_type
Definition: CandidateCut.h:11
Photon.h
PhoFull5x5SigmaIEtaIEtaValueMapCut::getEventContent
void getEventContent(const edm::EventBase &) final
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:44
PhoFull5x5SigmaIEtaIEtaValueMapCut::full5x5SigmaIEtaIEta_
constexpr static char full5x5SigmaIEtaIEta_[]
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:23
CutApplicatorWithEventContentBase.h
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
edm::ParameterSet
Definition: ParameterSet.h:47
PhoFull5x5SigmaIEtaIEtaValueMapCut
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:4
CutApplicatorBase::CandidateType
CandidateType
Definition: CutApplicatorBase.h:47
edmplugin::PluginFactory
Definition: PluginFactory.h:34
edm::ValueMap::begin
const_iterator begin() const
Definition: ValueMap.h:229
PhoFull5x5SigmaIEtaIEtaValueMapCut::_cutValueEB
const float _cutValueEB
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:18
cand
Definition: decayParser.h:32
PhoFull5x5SigmaIEtaIEtaValueMapCut::candidateType
CandidateType candidateType() const final
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:15
cc
PhoFull5x5SigmaIEtaIEtaValueMapCut::_cutValueEE
const float _cutValueEE
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:19
edm::Ptr
Definition: AssociationVector.h:31
PhoFull5x5SigmaIEtaIEtaValueMapCut::operator()
result_type operator()(const reco::PhotonPtr &) const final
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:48
edm::ValueMap::idSize
size_t idSize() const
Definition: ValueMap.h:157
edm::ValueMap< float >
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
CutApplicatorWithEventContentBase::contentTokens_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition: CutApplicatorWithEventContentBase.h:40
edm::EventBase
Definition: EventBase.h:46
PhoFull5x5SigmaIEtaIEtaValueMapCut::setConsumes
void setConsumes(edm::ConsumesCollector &) final
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:39
edm::ValueMap::contains
bool contains(ProductID id) const
Definition: ValueMap.h:155
PhoFull5x5SigmaIEtaIEtaValueMapCut::PhoFull5x5SigmaIEtaIEtaValueMapCut
PhoFull5x5SigmaIEtaIEtaValueMapCut(const edm::ParameterSet &c)
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:30
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
PhoFull5x5SigmaIEtaIEtaValueMapCut::_full5x5SigmaIEtaIEtaMap
edm::Handle< edm::ValueMap< float > > _full5x5SigmaIEtaIEtaMap
Definition: PhoFull5x5SigmaIEtaIEtaValueMapCut.cc:21
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
edm::ProductID
Definition: ProductID.h:27
CutApplicatorWithEventContentBase
Definition: CutApplicatorWithEventContentBase.h:19