Belle II Software development
Const::ParticleType Class Reference

The ParticleType class for identifying different particle types. More...

#include <Const.h>

Inheritance diagram for Const::ParticleType:
Const::ChargedStable Const::Cluster

Public Member Functions

 ParticleType (int pdgCode, const ParticleSet *set=nullptr, int index=-1)
 Constructor.
 
 ParticleType (const ParticleType &)=default
 Copy constructor

 
ParticleTypeoperator= (const ParticleType &)=default
 Assignment Operator.
 
bool operator< (const ParticleType &other) const
 Comparison operator to be usable in sets.
 
bool operator== (const ParticleType &o) const
 Test equality.
 
bool operator!= (const ParticleType &o) const
 Test inequality.
 
ParticleTypeoperator* ()
 dummy dereferencing for range-based for.
 
ParticleTypeoperator++ ()
 Prefix increment.
 
ParticleType operator++ (int)
 Postfix increment.
 
 operator ParticleSet () const
 Conversion of ParticleType to ParticleSet.
 
int getIndex () const
 This particle's index in the associated set.
 
const TParticlePDG * getParticlePDG () const
 Accessor for ROOT TParticlePDG object.
 
int getPDGCode () const
 PDG code.
 
double getMass () const
 Particle mass.
 
std::string __repr__ () const
 String for printing in python.
 

Private Attributes

int m_pdgCode
 PDG code of the particle.
 
const ParticleSetm_set
 set this particle belongs to, or NULL if stand-alone.
 
int m_index
 index in the associated set, -1 if there's no set.
 

Detailed Description

The ParticleType class for identifying different particle types.

Particle Data Group (PDG) codes are used for specifying types, for a detailed explanation and tables please refer to: https://pdg.web.cern.ch/pdg/2012/mcdata/mc_particle_id_contents.html

Definition at line 408 of file Const.h.

Constructor & Destructor Documentation

◆ ParticleType()

ParticleType ( int  pdgCode,
const ParticleSet set = nullptr,
int  index = -1 
)
inlineexplicit

Constructor.

Parameters
pdgCodethe Particle Data Group code that identifies the particle.
setPointer to set this particle belongs to (or NULL if stand-alone).
indexIndex of this particle in 'set'.

Definition at line 417 of file Const.h.

417 :
418 m_pdgCode(pdgCode), m_set(set), m_index(index) {}
int m_index
index in the associated set, -1 if there's no set.
Definition: Const.h:489
int m_pdgCode
PDG code of the particle.
Definition: Const.h:487
const ParticleSet * m_set
set this particle belongs to, or NULL if stand-alone.
Definition: Const.h:488

Member Function Documentation

◆ __repr__()

std::string __repr__ ( ) const

String for printing in python.

Definition at line 361 of file UnitConst.cc.

362{
363 std::string result = "<type: ";
364 result += getParticlePDG()->GetName();
365 result += ">";
366 return result;
367}
const TParticlePDG * getParticlePDG() const
Accessor for ROOT TParticlePDG object.
Definition: UnitConst.cc:351

◆ getIndex()

int getIndex ( ) const
inline

This particle's index in the associated set.

In case the particle has no set, -1 is returned.

Definition at line 461 of file Const.h.

461{ return m_index; }

◆ getMass()

double getMass ( ) const

Particle mass.

Returns
The mass of the particle.

Definition at line 356 of file UnitConst.cc.

357{
358 return getParticlePDG()->Mass();
359}

◆ getParticlePDG()

const TParticlePDG * getParticlePDG ( ) const

Accessor for ROOT TParticlePDG object.

Returns
The TParticlePDG object for this type of particle.

Definition at line 351 of file UnitConst.cc.

352{
353 return EvtGenDatabasePDG::Instance()->GetParticle(m_pdgCode);
354}
static EvtGenDatabasePDG * Instance()
Instance method that loads the EvtGen table.

◆ getPDGCode()

int getPDGCode ( ) const
inline

PDG code.

Returns
The PDG code of the particle.

Definition at line 473 of file Const.h.

473{return m_pdgCode;};

◆ operator ParticleSet()

operator ParticleSet ( ) const
inline

Conversion of ParticleType to ParticleSet.

Definition at line 455 of file Const.h.

455{ ParticleSet s; s.add(*this); return s; }

◆ operator!=()

bool operator!= ( const ParticleType o) const
inline

Test inequality.

Definition at line 435 of file Const.h.

435{ return !((*this) == o); }

◆ operator*()

ParticleType & operator* ( )
inline

dummy dereferencing for range-based for.

Definition at line 438 of file Const.h.

438{ return *this; }

◆ operator++() [1/2]

Const::ParticleType & operator++ ( )

Prefix increment.

Incrementing past the last element of a set will return an invalid particle.

Definition at line 333 of file UnitConst.cc.

334{
335 if (!m_set) {
336 *this = invalidParticle;
337 } else {
339 }
340
341 return *this;
342}
const ParticleType & at(unsigned int index) const
Return particle at given index, or end() if out of range.
Definition: Const.h:549
int getPDGCode() const
PDG code.
Definition: Const.h:473
static const ParticleType invalidParticle
Invalid particle, used internally.
Definition: Const.h:681

◆ operator++() [2/2]

Const::ParticleType operator++ ( int  )

Postfix increment.

Incrementing past the last element of a set will yield an invalid particle.

Definition at line 344 of file UnitConst.cc.

345{
346 Const::ParticleType p = *this;
347 ++(*this);
348 return p;
349}
The ParticleType class for identifying different particle types.
Definition: Const.h:408

◆ operator<()

bool operator< ( const ParticleType other) const

Comparison operator to be usable in sets.

Parameters
otherthe type of the other particle for the comparison.

Definition at line 328 of file UnitConst.cc.

329{
330 return m_pdgCode < other.m_pdgCode;
331}

◆ operator==()

bool operator== ( const ParticleType o) const
inline

Test equality.

Definition at line 432 of file Const.h.

432{ return m_pdgCode == o.m_pdgCode; }

Member Data Documentation

◆ m_index

int m_index
private

index in the associated set, -1 if there's no set.

Definition at line 489 of file Const.h.

◆ m_pdgCode

int m_pdgCode
private

PDG code of the particle.

Definition at line 487 of file Const.h.

◆ m_set

const ParticleSet* m_set
private

set this particle belongs to, or NULL if stand-alone.

Definition at line 488 of file Const.h.


The documentation for this class was generated from the following files: