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); }
pat::eventhypothesis::AndFilter::filters_
std::vector< std::unique_ptr< ParticleFilter > > filters_
Definition: EventHypothesisTools.h:26
pat::eventhypothesis
Definition: EventHypothesis.h:15
pat::eventhypothesis::OrFilter::filters_
std::vector< std::unique_ptr< ParticleFilter > > filters_
Definition: EventHypothesisTools.h:42
pat::eventhypothesis::ByPdgId::pdgCode_
int32_t pdgCode_
Definition: EventHypothesisTools.h:52
pat::eventhypothesis::ParticleFilter
Definition: EventHypothesis.h:24
pat::eventhypothesis::AndFilter::operator()
bool operator()(const CandRefType &cand, const std::string &role) const override
Definition: EventHypothesisTools.cc:11
pat::eventhypothesis::ByString::operator()
bool operator()(const CandRefType &cand, const std::string &role) const override
Definition: EventHypothesisTools.cc:41
pat::eventhypothesis::AndFilter::AndFilter
AndFilter()
Definition: EventHypothesisTools.h:16
DeadROC_duringRun.f2
f2
Definition: DeadROC_duringRun.py:220
EventHypothesisTools.h
cand
Definition: decayParser.h:32
pat::eventhypothesis::ByPdgId::operator()
bool operator()(const CandRefType &cand, const std::string &role) const override
Definition: EventHypothesisTools.cc:35
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Ptr< Candidate >
pat::eventhypothesis::OrFilter::OrFilter
OrFilter()
Definition: EventHypothesisTools.h:32
std
Definition: JetResolutionObject.h:76
pat::eventhypothesis::OrFilter::operator()
bool operator()(const CandRefType &cand, const std::string &role) const override
Definition: EventHypothesisTools.cc:24
pat::eventhypothesis::ByPdgId::antiparticle_
bool antiparticle_
Definition: EventHypothesisTools.h:53
PA_MinBiasSkim_cff.cut
cut
Definition: PA_MinBiasSkim_cff.py:13
pat::eventhypothesis::ByString::ByString
ByString(const std::string &cut)
Definition: EventHypothesisTools.cc:39
pat::eventhypothesis::ByPdgId::ByPdgId
ByPdgId(int32_t pdgCode, bool alsoAntiparticle=true)
Definition: EventHypothesisTools.cc:32
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DeadROC_duringRun.f1
f1
Definition: DeadROC_duringRun.py:219
pat::eventhypothesis::ByString::sel_
StringCutObjectSelector< reco::Candidate > sel_
Definition: EventHypothesisTools.h:63