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

Constructor & Destructor Documentation

◆ ByPdgId()

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) {}

◆ ~ByPdgId()

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

Definition at line 48 of file EventHypothesisTools.h.

48 {}

Member Function Documentation

◆ operator()()

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

Implements pat::eventhypothesis::ParticleFilter.

Definition at line 35 of file EventHypothesisTools.cc.

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

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

Member Data Documentation

◆ antiparticle_

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

Definition at line 53 of file EventHypothesisTools.h.

Referenced by operator()().

◆ pdgCode_

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

Definition at line 52 of file EventHypothesisTools.h.

Referenced by operator()().

pat::eventhypothesis::ByPdgId::pdgCode_
int32_t pdgCode_
Definition: EventHypothesisTools.h:52
cand
Definition: decayParser.h:32
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:117
pat::eventhypothesis::ByPdgId::antiparticle_
bool antiparticle_
Definition: EventHypothesisTools.h:53
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22