CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventHypothesisTools.cc
Go to the documentation of this file.
2 
3 using namespace pat::eventhypothesis;
4 
6  filters_(2)
7 {
8  filters_.push_back(f1); filters_.push_back(f2);
9 }
10 
11 bool AndFilter::operator()(const CandRefType &cand, const std::string &role) const {
12  for (boost::ptr_vector<ParticleFilter>::const_iterator it = filters_.begin(); it != filters_.end(); ++it) {
13  if (! (*it)(cand, role) ) return false;
14  }
15  return true;
16 }
17 
19  filters_(2)
20 {
21  filters_.push_back(f1); filters_.push_back(f2);
22 }
23 
24 bool OrFilter::operator()(const CandRefType &cand, const std::string &role) const {
25  for (boost::ptr_vector<ParticleFilter>::const_iterator it = filters_.begin(); it != filters_.end(); ++it) {
26  if ( (*it)(cand, role) ) return true;
27  }
28  return false;
29 }
30 
31 ByPdgId::ByPdgId(int32_t pdgCode, bool alsoAntiparticle) :
32  pdgCode_(alsoAntiparticle ? std::abs(pdgCode) : pdgCode),
33  antiparticle_(alsoAntiparticle)
34 {
35 }
36 
37 bool ByPdgId::operator()(const CandRefType &cand, const std::string &role) const {
38  return antiparticle_ ?
39  (std::abs(cand->pdgId()) == pdgCode_) :
40  (cand->pdgId() == pdgCode_);
41 }
42 
44  sel_(cut)
45 {
46 }
47 
48 bool ByString::operator()(const CandRefType &cand, const std::string &role) const {
49  return sel_(*cand);
50 }
virtual bool operator()(const CandRefType &cand, const std::string &role) const
ByPdgId(int32_t pdgCode, bool alsoAntiparticle=true)
virtual bool operator()(const CandRefType &cand, const std::string &role) const
#define abs(x)
Definition: mlp_lapack.h:159
ByString(const std::string &cut)
virtual bool operator()(const CandRefType &cand, const std::string &role) const
boost::ptr_vector< ParticleFilter > filters_
StringCutObjectSelector< reco::Candidate > sel_
virtual bool operator()(const CandRefType &cand, const std::string &role) const
boost::ptr_vector< ParticleFilter > filters_