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)
 
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 43 of file EventHypothesisTools.h.

Constructor & Destructor Documentation

◆ ByPdgId()

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

Definition at line 31 of file EventHypothesisTools.cc.

32  : pdgCode_(alsoAntiparticle ? std::abs(pdgCode) : pdgCode), antiparticle_(alsoAntiparticle) {}

◆ ~ByPdgId()

pat::eventhypothesis::ByPdgId::~ByPdgId ( )
inlineoverride

Definition at line 46 of file EventHypothesisTools.h.

46 {}

Member Function Documentation

◆ operator()()

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

Implements pat::eventhypothesis::ParticleFilter.

Definition at line 34 of file EventHypothesisTools.cc.

34  {
35  return antiparticle_ ? (std::abs(cand->pdgId()) == pdgCode_) : (cand->pdgId() == pdgCode_);
36 }

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

Member Data Documentation

◆ antiparticle_

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

Definition at line 51 of file EventHypothesisTools.h.

Referenced by operator()().

◆ pdgCode_

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

Definition at line 50 of file EventHypothesisTools.h.

Referenced by operator()().

pat::eventhypothesis::ByPdgId::pdgCode_
int32_t pdgCode_
Definition: EventHypothesisTools.h:50
cand
Definition: decayParser.h:34
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:118
pat::eventhypothesis::ByPdgId::antiparticle_
bool antiparticle_
Definition: EventHypothesisTools.h:51
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22