CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
pat::eventhypothesis::ByPdgId Class Reference

#include <EventHypothesisTools.h>

Inheritance diagram for pat::eventhypothesis::ByPdgId:
pat::eventhypothesis::ParticleFilter

Public Member Functions

 ByPdgId (int32_t pdgCode, bool alsoAntiparticle=true)
 
bool operator() (const CandRefType &cand, const std::string &role) const override
 
 ~ByPdgId () override
 
- Public Member Functions inherited from pat::eventhypothesis::ParticleFilter
bool operator() (const std::pair< std::string, CandRefType > &p) const
 
virtual ~ParticleFilter ()
 

Private Attributes

bool antiparticle_
 
int32_t pdgCode_
 

Detailed Description

Definition at line 45 of file EventHypothesisTools.h.

Constructor & Destructor Documentation

ByPdgId::ByPdgId ( int32_t  pdgCode,
bool  alsoAntiparticle = true 
)
explicit

Definition at line 32 of file EventHypothesisTools.cc.

33  : pdgCode_(alsoAntiparticle ? std::abs(pdgCode) : pdgCode), antiparticle_(alsoAntiparticle) {}
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
pat::eventhypothesis::ByPdgId::~ByPdgId ( )
inlineoverride

Definition at line 48 of file EventHypothesisTools.h.

48 {}

Member Function Documentation

bool ByPdgId::operator() ( const CandRefType cand,
const std::string &  role 
) const
overridevirtual

Implements pat::eventhypothesis::ParticleFilter.

Definition at line 35 of file EventHypothesisTools.cc.

References funct::abs(), antiparticle_, and pdgCode_.

35  {
36  return antiparticle_ ? (std::abs(cand->pdgId()) == pdgCode_) : (cand->pdgId() == pdgCode_);
37 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

bool pat::eventhypothesis::ByPdgId::antiparticle_
private

Definition at line 53 of file EventHypothesisTools.h.

Referenced by operator()().

int32_t pat::eventhypothesis::ByPdgId::pdgCode_
private

Definition at line 52 of file EventHypothesisTools.h.

Referenced by operator()().