CMS 3D CMS Logo

PhoSCEtaMultiRangeCut.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::PhotonPtr&) const final;
19 
20  double value(const reco::CandidatePtr& cand) const final;
21 
22  CandidateType candidateType() const final {
23  return PHOTON;
24  }
25 
26 private:
27  const bool _absEta;
28  std::vector<std::pair<double,double> > _ranges;
29 };
30 
33  "PhoSCEtaMultiRangeCut");
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 value(const reco::CandidatePtr& cand) const {
51  reco::PhotonPtr pho(cand);
52  const reco::SuperClusterRef& scref = pho->superCluster();
53  return ( _absEta ? std::abs(scref->eta()) : scref->eta() );
54 }
VParameterSet const & getParameterSetVector(std::string const &name) const
PhoSCEtaMultiRangeCut(const edm::ParameterSet &c)
CandidateType candidateType() const final
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
result_type operator()(const reco::PhotonPtr &) const final
string ranges
Definition: diffTwoXMLs.py:79
std::vector< std::pair< double, double > > _ranges
#define DEFINE_EDM_PLUGIN(factory, type, name)