CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 override final {
20  return cand->pt();
21  }
22 
23  result_type asCandidate(const argument_type&) const override 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 
34 CutApplicatorBase::result_type
35 MinPtCutInEtaRanges::
36 asCandidate(const argument_type& cand) const{
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 }
int i
Definition: DBlmapReader.cc:9
VParameterSet const & getParameterSetVector(std::string const &name) const
result_type asCandidate(const argument_type &) const overridefinal
MinPtCutInEtaRanges(const edm::ParameterSet &c)
double value(const reco::CandidatePtr &cand) const overridefinal
double maxEta
std::vector< double > _minPt
tuple result
Definition: mps_fire.py:83
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
string ranges
Definition: diffTwoXMLs.py:78
string const
Definition: compareJSON.py:14
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< std::pair< double, double > > _ranges