CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 override final {
18  return ( _absEta ? std::abs(cand->eta()) : cand->eta() );
19  }
20 
21  result_type asCandidate(const argument_type&) const override final;
22 
23 private:
24  const bool _absEta;
25  std::vector<std::pair<double,double> > _ranges;
26 };
27 
29 
30 CutApplicatorBase::result_type
31 EtaMultiRangeCut::
32 asCandidate(const argument_type& cand) const {
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
std::vector< std::pair< double, double > > _ranges
tuple result
Definition: query.py:137
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:78
EtaMultiRangeCut(const edm::ParameterSet &c)
string const
Definition: compareJSON.py:14
result_type asCandidate(const argument_type &) const overridefinal
#define private
Definition: FWFileEntry.h:17
#define DEFINE_EDM_PLUGIN(factory, type, name)
double value(const reco::CandidatePtr &cand) const overridefinal