CMS 3D CMS Logo

MinPtCutInEtaRanges.cc
Go to the documentation of this file.
2 
4 public:
7  _absEta(c.getParameter<bool>("useAbsEta")) {
8  const std::vector<edm::ParameterSet>& ranges =
9  c.getParameterSetVector("allowedEtaRanges");
10  for( const auto& range : ranges ) {
11  const double minEta = range.getParameter<double>("minEta");
12  const double maxEta = range.getParameter<double>("maxEta");
13  const double minPt = range.getParameter<double>("minPt");
14  _ranges.emplace_back(minEta,maxEta);
15  _minPt.push_back(minPt);
16  }
17  }
18 
19  double value(const reco::CandidatePtr& cand) const final {
20  return cand->pt();
21  }
22 
23  result_type asCandidate(const argument_type&) const final;
24 
25 private:
26  const bool _absEta;
27  std::vector<std::pair<double,double> > _ranges;
28  std::vector<double> _minPt; // indexed as above
29 };
30 
32  "MinPtCutInEtaRanges");
33 
37  const double the_eta = ( _absEta ? std::abs(cand->eta()) : cand->eta() );
38  bool result = false;
39  for( unsigned i = 0; i < _ranges.size(); ++i ) {
40  const auto& range = _ranges[i];
41  if( the_eta >= range.first && the_eta < range.second &&
42  cand->pt() > _minPt[i] ) {
43  result = true; break;
44  }
45  }
46  return result;
47 }
VParameterSet const & getParameterSetVector(std::string const &name) const
MinPtCutInEtaRanges(const edm::ParameterSet &c)
double maxEta
std::vector< double > _minPt
double value(const reco::CandidatePtr &cand) const final
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
string ranges
Definition: diffTwoXMLs.py:79
result_type asCandidate(const argument_type &) const final
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< std::pair< double, double > > _ranges