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 final;
19 
20  double value(const reco::CandidatePtr& cand) const final;
21 
22  CandidateType candidateType() const 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 
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)
CandidateType candidateType() const final
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: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:184
#define DEFINE_EDM_PLUGIN(factory, type, name)