CMS 3D CMS Logo

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)
 
virtual bool operator() (const CandRefType &cand, const std::string &role) const
 
virtual ~ByPdgId ()
 
- 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 34 of file EventHypothesisTools.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file EventHypothesisTools.cc.

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

Member Function Documentation

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

Implements pat::eventhypothesis::ParticleFilter.

Definition at line 37 of file EventHypothesisTools.cc.

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

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

Member Data Documentation

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

Definition at line 41 of file EventHypothesisTools.h.

Referenced by operator()().

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

Definition at line 40 of file EventHypothesisTools.h.

Referenced by operator()().