Reactions  0.1.1
Handling reaction trees and decays
Public Types | Public Member Functions | Static Public Member Functions | List of all members
reactions::pdg_database Class Referencefinal

Database of elements following the PDG convention. More...

Inheritance diagram for reactions::pdg_database:
Inheritance graph
[legend]
Collaboration diagram for reactions::pdg_database:
Collaboration graph
[legend]

Public Types

using base_type = reactions::database::database< pdg_element, pdg::name, pdg::pdg_id >
 
- Public Types inherited from reactions::database::database< pdg_element, pdg::name, pdg::pdg_id >
using element_type = pdg_element
 

Public Member Functions

pdg_element charge_conjugate (pdg_element const &el) const
 Return the charge-conjugate of an element. More...
 
template<class... Args>
void register_element (Args &&... args)
 Register a new PDG element. More...
 
pdg_element operator() (int id) const override
 Create an element accessing by ID. More...
 
pdg_element operator() (std::string const &str) const override
 Create an element accessing by name. More...
 
- Public Member Functions inherited from reactions::database::database< pdg_element, pdg::name, pdg::pdg_id >
virtual ~database ()
 
std::vector< element_typeall_elements () const
 All the elements in the database file. More...
 
void clear_cache ()
 Clear the cache, removing also user-registered elements. More...
 
void disable_cache ()
 Disable the cache. More...
 
void enable_cache ()
 
std::string const & get_database_path () const
 Get the path to the database file. More...
 
void register_element (Args &&... args)
 Register a new element. More...
 
void set_database_path (std::string const &s)
 

Static Public Member Functions

static pdg_databaseinstance ()
 Get the only instance of this class. More...
 

Additional Inherited Members

- Protected Member Functions inherited from reactions::database::database< pdg_element, pdg::name, pdg::pdg_id >
std::ifstream open_database () const
 Open the database. More...
 
std::streampos skip_commented_lines (std::ifstream &file) const
 Skip lines with comments (preceeded by *) More...
 
bool read_field (typename element_type::base_type &tuple, std::string const &line) const
 Read a field with the given index from a line. More...
 
bool read_line (typename element_type::base_type &tuple, std::string const &line, std::index_sequence< I... >) const
 Read all the fields from a line. More...
 
bool read_line (typename element_type::base_type &tuple, std::string const &line) const
 Read all the fields from a line. More...
 
element_type read_element (std::string const &line) const
 Advance to the next element in the file and read it. More...
 
element_type access (T const &v) const
 Access an element using the field accessor. More...
 
 database (std::string &&db)
 
 database (database &&)=delete
 
 database (database const &)=delete
 
void operator= (database &&)=delete
 
void operator= (database const &)=delete
 
- Protected Attributes inherited from reactions::database::database< pdg_element, pdg::name, pdg::pdg_id >
std::string m_db
 Path to the database file. More...
 
class reactions::database::database::cache m_cache
 

Detailed Description

Database of elements following the PDG convention.

Member Typedef Documentation

◆ base_type

Member Function Documentation

◆ charge_conjugate()

pdg_element reactions::pdg_database::charge_conjugate ( pdg_element const &  el) const
inline

Return the charge-conjugate of an element.

◆ instance()

static pdg_database& reactions::pdg_database::instance ( )
inlinestatic

Get the only instance of this class.

◆ operator()() [1/2]

pdg_element reactions::pdg_database::operator() ( int  id) const
inlineoverridevirtual

Create an element accessing by ID.

Implements reactions::database::database< pdg_element, pdg::name, pdg::pdg_id >.

◆ operator()() [2/2]

pdg_element reactions::pdg_database::operator() ( std::string const &  str) const
inlineoverridevirtual

Create an element accessing by name.

Implements reactions::database::database< pdg_element, pdg::name, pdg::pdg_id >.

◆ register_element()

template<class... Args>
void reactions::pdg_database::register_element ( Args &&...  args)
inline

Register a new PDG element.

The new element must have a name and a PDG ID that does not clash with any of the database used.

For the LaTeX name to be valid (an to avoid possible exceptions thrown during its computation), the element name must follow the following convention:

  • The name starts with a set of characters. A capital letter followed by lowercase letters or a set of lowercase letters are considered as a Greek letter.
  • The base name can be followed by a set of modifiers indicating the flavour, mass eigenstate or spin of the particle, between parenthesis.
  • After, it is possible to indicate that the particle has a sligh variation with respect to another existing particle or that it corresponds to an excited state, in which it should be indicated with one or various prime symbols for the first case, or an asterisk for the second.
  • The mass can be indicated between two parentheses as an integral number.
  • The last part of the name is composed by the possible anti-particle marker, specified with a tilde, and the charge, which can be 0, + or -.

There is no official naming scheme for the PDG particles, but the following guidelines can be used in order to get the most common way of naming the particles:

  • Quarks are specified with a single character, and anti-quarks extend this name by adding a tilde.
  • If the name refers to a gauge boson, it must only contain the charge if it is named with a captial letter.
  • Hadrons only contain the charge if there are other entries in the database with the same name. In the case of mesons, they also contain the charge if the particle is not self charge-conjugate.
  • Particle names referring to mass-eigenstates contain the charge if the corresponding flavour eigenstates do.
  • The anti-particles of mesons where the charge is in the name are specified using the opposite charge. For the rest, anti-particles are specified by including a tilde before the charge or at the end of the name, where adecuate.

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