CMS 3D CMS Logo

GsfEleSCEtaMultiRangeCut.cc
Go to the documentation of this file.
3 
5 public:
7  : CutApplicatorBase(c), _absEta(c.getParameter<bool>("useAbsEta")) {
8  const std::vector<edm::ParameterSet>& ranges = c.getParameterSetVector("allowedEtaRanges");
9  for (const auto& range : ranges) {
10  const double min = range.getParameter<double>("minEta");
11  const double max = range.getParameter<double>("maxEta");
12  _ranges.emplace_back(min, max);
13  }
14  }
15 
16  result_type operator()(const reco::GsfElectronPtr&) const final;
17 
18  double value(const reco::CandidatePtr& cand) const final;
19 
21 
22 private:
23  const bool _absEta;
24  std::vector<std::pair<double, double> > _ranges;
25 };
26 
28 
30  const reco::SuperClusterRef& scref = cand->superCluster();
31  const double the_eta = (_absEta ? std::abs(scref->eta()) : scref->eta());
32  bool result = false;
33  for (const auto& range : _ranges) {
34  if (the_eta >= range.first && the_eta < range.second) {
35  result = true;
36  break;
37  }
38  }
39  return result;
40 }
41 
43  reco::GsfElectronPtr ele(cand);
44  const reco::SuperClusterRef& scref = ele->superCluster();
45  return (_absEta ? std::abs(scref->eta()) : scref->eta());
46 }
VParameterSet const & getParameterSetVector(std::string const &name) const
std::vector< std::pair< double, double > > _ranges
GsfEleSCEtaMultiRangeCut(const edm::ParameterSet &c)
CandidateType candidateType() 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
double value(const reco::CandidatePtr &cand) const final
result_type operator()(const reco::GsfElectronPtr &) const final
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
#define DEFINE_EDM_PLUGIN(factory, type, name)