CMS 3D CMS Logo

EventHypothesisTools.cc
Go to the documentation of this file.
2 
3 using namespace pat::eventhypothesis;
4 
6  filters_.push_back(f1);
7  filters_.push_back(f2);
8 }
9 
10 bool AndFilter::operator()(const CandRefType &cand, const std::string &role) const {
11  for (boost::ptr_vector<ParticleFilter>::const_iterator it = filters_.begin(); it != filters_.end(); ++it) {
12  if (!(*it)(cand, role))
13  return false;
14  }
15  return true;
16 }
17 
19  filters_.push_back(f1);
20  filters_.push_back(f2);
21 }
22 
23 bool OrFilter::operator()(const CandRefType &cand, const std::string &role) const {
24  for (boost::ptr_vector<ParticleFilter>::const_iterator it = filters_.begin(); it != filters_.end(); ++it) {
25  if ((*it)(cand, role))
26  return true;
27  }
28  return false;
29 }
30 
31 ByPdgId::ByPdgId(int32_t pdgCode, bool alsoAntiparticle)
32  : pdgCode_(alsoAntiparticle ? std::abs(pdgCode) : pdgCode), antiparticle_(alsoAntiparticle) {}
33 
34 bool ByPdgId::operator()(const CandRefType &cand, const std::string &role) const {
35  return antiparticle_ ? (std::abs(cand->pdgId()) == pdgCode_) : (cand->pdgId() == pdgCode_);
36 }
37 
38 ByString::ByString(const std::string &cut) : sel_(cut) {}
39 
40 bool ByString::operator()(const CandRefType &cand, const std::string &role) const { return sel_(*cand); }
ByPdgId(int32_t pdgCode, bool alsoAntiparticle=true)
ByString(const std::string &cut)
bool operator()(const CandRefType &cand, const std::string &role) const override
boost::ptr_vector< ParticleFilter > filters_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
StringCutObjectSelector< reco::Candidate > sel_
bool operator()(const CandRefType &cand, const std::string &role) const override
boost::ptr_vector< ParticleFilter > filters_
bool operator()(const CandRefType &cand, const std::string &role) const override
bool operator()(const CandRefType &cand, const std::string &role) const override