CMS 3D CMS Logo

EventHypothesisTools.cc
Go to the documentation of this file.
1 
3 
4 using namespace pat::eventhypothesis;
5 
7  filters_.emplace_back(f1);
8  filters_.emplace_back(f2);
9 }
10 
11 bool AndFilter::operator()(const CandRefType &cand, const std::string &role) const {
12  for (const auto &it : filters_) {
13  if (!(*it)(cand, role))
14  return false;
15  }
16  return true;
17 }
18 
20  filters_.emplace_back(f1);
21  filters_.emplace_back(f2);
22 }
23 
24 bool OrFilter::operator()(const CandRefType &cand, const std::string &role) const {
25  for (const auto &it : filters_) {
26  if ((*it)(cand, role))
27  return true;
28  }
29  return false;
30 }
31 
32 ByPdgId::ByPdgId(int32_t pdgCode, bool alsoAntiparticle)
33  : pdgCode_(alsoAntiparticle ? std::abs(pdgCode) : pdgCode), antiparticle_(alsoAntiparticle) {}
34 
35 bool ByPdgId::operator()(const CandRefType &cand, const std::string &role) const {
36  return antiparticle_ ? (std::abs(cand->pdgId()) == pdgCode_) : (cand->pdgId() == pdgCode_);
37 }
38 
40 
41 bool ByString::operator()(const CandRefType &cand, const std::string &role) const { return sel_(*cand); }
ByPdgId(int32_t pdgCode, bool alsoAntiparticle=true)
std::vector< std::unique_ptr< ParticleFilter > > filters_
ByString(const std::string &cut)
bool operator()(const CandRefType &cand, const std::string &role) const override
bool operator()(const CandRefType &cand, const std::string &role) const override
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
std::vector< std::unique_ptr< ParticleFilter > > filters_
bool operator()(const CandRefType &cand, const std::string &role) const override