# PDG utilities (skhep.pdg)

Module for PDG-related tools.

## Subpackage to handle Particle Data Tables

Standard use case:

      >>> from skhep.pdg import ParticleDataTable
      >>> tbl = ParticleDataTable('data/mass_width_2017.mcd')
      >>> tbl[9000221].name
      f(0)(500)0
      >>> tbl('f(0)(500)0').id
      9000221
      >>> tbl('f(0)(500)0').name
      'f(0)(500)0'

class `skhep.pdg.pdt.``ParticleData`(id, name, mass, threecharge, width=None, lifetime=None)

  Container for a few particle data properties. Its main job is to resolve which of lifetime vs. width to use for a given particle.

  A string representation is defined for convenience.

  The available properties are id, name, mass, threecharge, charge, width, lifetime, and ctau. The mean displacement in vacuum for a supplied energy is accessed via the mean_disp(energy) method.

  `ctau`

    Get the particle c*tau0 distance in mm.

  `get_lifetime`()

    Get the particle lifetime in picoseconds.

  `get_width`()

    Get the particle width in GeV.

  `lifetime`

    Get the particle lifetime in picoseconds.

  `mean_disp`(energy)

    Get the particle mean displacement in mm, for the given particle energy in GeV (includes Lorentz boost factor).

  `set_lifetime`(tau)

    Set the particle lifetime (and, implicitly, the width). tau is lifetime in picoseconds.

  `set_width`(gamma)

    Set the particle width (and, implicitly, the lifetime). gamma is width in GeV.

  `width`

    Get the particle width in GeV.

class `skhep.pdg.pdt.``ParticleDataTable`(dbpath=None)

  Wrapper object for a whole database of ParticleData objects, indexed by their PDG ID codes.

  By default, the input database file will be the mass_width_2016.mcd file from the most recent PDG Review of Particle Properties, which is installed along with this package. If you want a different db file, or don’t have AFS mounted, specify an explicit file path, or set the PYPDT_DB environment variable.

  `clear`()

    Forget all currently known particles.

  `get`(id, default=None)

    Get the particle data for the supplied particle ID. Alternatively usable as particle(id, default) or tbl[id].

  `has_key`(id)

    Check if the PDT contains particle data for the supplied particle ID. Alternatively usable as has_particle(id).

  `has_particle`(id)

    Check if the PDT contains particle data for the supplied particle ID. Alternatively usable as has_particle(id).

  `ids`()

    Get the list of known particle IDs (using the PDG Monte Carlo numbering scheme). These are the available keys for db lookup.

  `particle`(id, default=None)

    Get the particle data for the supplied particle ID. Alternatively usable as particle(id, default) or tbl[id].

  `read_db`(dbpath)

    Read a particle data database file, updating the currently registered particles. Call clear() first if you only want to know about the particle data in this db file. The db files currently in use can be access via the PDT.dbfiles attribute.

  `read_pdgcsv`(dbpath)

    Read a PDG .csv particle data database file, updating the currently registered particles. Call clear() first if you only want to know about the particle data in this db file. The db files currently in use can be access via the PDT.dbfiles attribute.

  `read_pdgmcd`(dbpath)

    Read a PDG .mcd particle data database file, updating the currently registered particles. Call clear() first if you only want to know about the particle data in this db file. The db files currently in use can be access via the PDT.dbfiles attribute.

  `read_pdttbl`(dbpath)

    Read a HepPDT .tbl particle data database file, updating the currently registered particles. Call clear() first if you only want to know about the particle data in this db file. The db files currently in use can be access via the PDT.dbfiles attribute.

`skhep.pdg.pdt.``PDT`

  alias of `ParticleDataTable`