CMS 3D CMS Logo

EtaMultiRangeCut.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 min = range.getParameter<double>("minEta");
12  const double max = range.getParameter<double>("maxEta");
13  _ranges.emplace_back(min,max);
14  }
15  }
16 
17  double value(const reco::CandidatePtr& cand) const final {
18  return ( _absEta ? std::abs(cand->eta()) : cand->eta() );
19  }
20 
21  result_type asCandidate(const argument_type&) const final;
22 
23 private:
24  const bool _absEta;
25  std::vector<std::pair<double,double> > _ranges;
26 };
27 
29 
33  const double the_eta = ( _absEta ? std::abs(cand->eta()) : cand->eta() );
34  bool result = false;
35  for(const auto& range : _ranges ) {
36  if( the_eta >= range.first && the_eta < range.second ) {
37  result = true; break;
38  }
39  }
40  return result;
41 }
VParameterSet const & getParameterSetVector(std::string const &name) const
result_type asCandidate(const argument_type &) const final
std::vector< std::pair< double, double > > _ranges
double value(const reco::CandidatePtr &cand) const final
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
string ranges
Definition: diffTwoXMLs.py:79
EtaMultiRangeCut(const edm::ParameterSet &c)
#define DEFINE_EDM_PLUGIN(factory, type, name)