CMS 3D CMS Logo

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