test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 override final;
19 
20  double value(const reco::CandidatePtr& cand) const override final;
21 
22  CandidateType candidateType() const override 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 
35 CutApplicatorBase::result_type
37 operator()(const reco::PhotonPtr& cand) const{
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)
tuple result
Definition: mps_fire.py:84
CandidateType candidateType() const overridefinal
result_type operator()(const reco::PhotonPtr &) const overridefinal
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
std::vector< std::pair< double, double > > _ranges
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
string const
Definition: compareJSON.py:14
double value(const reco::CandidatePtr &cand) const overridefinal
#define DEFINE_EDM_PLUGIN(factory, type, name)