Belle II Software development
Belle2::EvtPDLUtil Namespace Reference

Utilities for converting PDG codes into particle names. More...

Functions

bool hasAntiParticle (int pdgCode)
 Checks if the particle with given pdg code has an anti-particle or not.
 
std::string particleName (int pdgCode)
 Returns the name of a particle with given pdg code.
 
std::string antiParticleName (int pdgCode)
 Returns the name of the anti-particle of a particle with given pdg code.
 
std::string antiParticleListName (int pdgCode, const std::string &label)
 Returns the name of the anti-particle ParticleList for particles with given pdg code and with given label.
 
std::string particleListName (int pdgCode, const std::string &label)
 Returns the name of the particle ParticleList for particles with given pdg code and with given label.
 
double charge (int pdgCode)
 Returns electric charge of a particle with given pdg code.
 

Detailed Description

Utilities for converting PDG codes into particle names.

Uses the TDatabasePDG class, which is filled from evt.pdl by basf2.

Function Documentation

◆ antiParticleListName()

std::string antiParticleListName ( int  pdgCode,
const std::string &  label 
)

Returns the name of the anti-particle ParticleList for particles with given pdg code and with given label.

If the anti-particle does not exist the particle's name is returned instead

Definition at line 30 of file EvtPDLUtil.cc.

31{
32 if (label.empty())
33 return antiParticleName(pdgCode);
34 return antiParticleName(pdgCode) + ":" + label;
35}
std::string antiParticleName(int pdgCode)
Returns the name of the anti-particle of a particle with given pdg code.
Definition: EvtPDLUtil.cc:25

◆ antiParticleName()

std::string antiParticleName ( int  pdgCode)

Returns the name of the anti-particle of a particle with given pdg code.

If the anti-particle does not exist the particle's name is returned instead.

Definition at line 25 of file EvtPDLUtil.cc.

26{
27 return TDatabasePDG::Instance()->GetParticle(pdgCode)->AntiParticle()->GetName();
28}

◆ charge()

double charge ( int  pdgCode)

Returns electric charge of a particle with given pdg code.

Definition at line 44 of file EvtPDLUtil.cc.

45{
46 return TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge() / 3.0;
47}

◆ hasAntiParticle()

bool hasAntiParticle ( int  pdgCode)

Checks if the particle with given pdg code has an anti-particle or not.

Parameters
pdgCodeof the particle
Returns
true/false if anti-particle does/does not exist

Definition at line 12 of file EvtPDLUtil.cc.

13{
14 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(pdgCode);
15 TParticlePDG* antiParticle = particle->AntiParticle();
16
17 return antiParticle and (particle != antiParticle);
18}

◆ particleListName()

std::string particleListName ( int  pdgCode,
const std::string &  label 
)

Returns the name of the particle ParticleList for particles with given pdg code and with given label.

Definition at line 37 of file EvtPDLUtil.cc.

38{
39 if (label.empty())
40 return particleName(pdgCode);
41 return particleName(pdgCode) + ":" + label;
42}
std::string particleName(int pdgCode)
Returns the name of a particle with given pdg code.
Definition: EvtPDLUtil.cc:20

◆ particleName()

std::string particleName ( int  pdgCode)

Returns the name of a particle with given pdg code.

Definition at line 20 of file EvtPDLUtil.cc.

21{
22 return TDatabasePDG::Instance()->GetParticle(pdgCode)->GetName();
23}