CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EtaMultiRangeCut.cc
Go to the documentation of this file.
2 
4 public:
5  EtaMultiRangeCut(const edm::ParameterSet& c) : CutApplicatorBase(c), _absEta(c.getParameter<bool>("useAbsEta")) {
6  const std::vector<edm::ParameterSet>& ranges = c.getParameterSetVector("allowedEtaRanges");
7  for (const auto& range : ranges) {
8  const double min = range.getParameter<double>("minEta");
9  const double max = range.getParameter<double>("maxEta");
10  _ranges.emplace_back(min, max);
11  }
12  }
13 
14  double value(const reco::CandidatePtr& cand) const final { return (_absEta ? std::abs(cand->eta()) : cand->eta()); }
15 
17 
18 private:
19  const bool _absEta;
20  std::vector<std::pair<double, double> > _ranges;
21 };
22 
24 
25 CutApplicatorBase::result_type EtaMultiRangeCut::asCandidate(const argument_type& cand) const {
26  const double the_eta = (_absEta ? std::abs(cand->eta()) : cand->eta());
27  bool result = false;
28  for (const auto& range : _ranges) {
29  if (the_eta >= range.first && the_eta < range.second) {
30  result = true;
31  break;
32  }
33  }
34  return result;
35 }
VParameterSet const & getParameterSetVector(std::string const &name) const
const edm::EventSetup & c
const uint16_t range(const Frame &aFrame)
tuple result
Definition: mps_fire.py:311
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
string ranges
Definition: diffTwoXMLs.py:79
EtaMultiRangeCut(const edm::ParameterSet &c)
std::vector< std::pair< double, double > > _ranges
reco::CandidatePtr argument_type
Definition: CandidateCut.h:10
double value(const reco::CandidatePtr &cand) const final
#define DEFINE_EDM_PLUGIN(factory, type, name)
result_type asCandidate(const argument_type &) const final