CMS 3D CMS Logo

PhoSCEtaMultiRangeCut.cc
Go to the documentation of this file.
3 
5 public:
6  PhoSCEtaMultiRangeCut(const edm::ParameterSet& c) : CutApplicatorBase(c), _absEta(c.getParameter<bool>("useAbsEta")) {
7  const std::vector<edm::ParameterSet>& ranges = c.getParameterSetVector("allowedEtaRanges");
8  for (const auto& range : ranges) {
9  const double min = range.getParameter<double>("minEta");
10  const double max = range.getParameter<double>("maxEta");
11  _ranges.emplace_back(min, max);
12  }
13  }
14 
15  result_type operator()(const reco::PhotonPtr&) const final;
16 
17  double value(const reco::CandidatePtr& cand) const final;
18 
20 
21 private:
22  const bool _absEta;
23  std::vector<std::pair<double, double> > _ranges;
24 };
25 
27 
29  const reco::SuperClusterRef& scref = cand->superCluster();
30  const double the_eta = (_absEta ? std::abs(scref->eta()) : scref->eta());
31  bool result = false;
32  for (const auto& range : _ranges) {
33  if (the_eta >= range.first && the_eta < range.second) {
34  result = true;
35  break;
36  }
37  }
38  return result;
39 }
40 
42  reco::PhotonPtr pho(cand);
43  const reco::SuperClusterRef& scref = pho->superCluster();
44  return (_absEta ? std::abs(scref->eta()) : scref->eta());
45 }
PhoSCEtaMultiRangeCut(const edm::ParameterSet &c)
result_type operator()(const reco::PhotonPtr &) const final
double value(const reco::CandidatePtr &cand) const final
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::pair< double, double > > _ranges
string ranges
Definition: diffTwoXMLs.py:79
#define DEFINE_EDM_PLUGIN(factory, type, name)
CandidateType candidateType() const final