ATLAS Offline Software
Functions | Variables
python.PDG Namespace Reference

Functions

def pdgid_to_name (id)
 
def pdgid_to_root_name (id)
 
def _fill_dicts ()
 

Variables

dictionary pdgid_names = {}
 
dictionary root_names = {}
 
 _pdgtable = \
 

Function Documentation

◆ _fill_dicts()

def python.PDG._fill_dicts ( )
private

Definition at line 603 of file Event/PyDumper/python/PDG.py.

603 def _fill_dicts():
604  pdgid_names.clear()
605  root_names.clear()
606  global _pdgtable
607  for line in _pdgtable.split ('\n'):
608  line = line.strip()
609  if len(line) == 0 or line[0] == '#':
610  continue
611  ll = line.split('=', 1)
612  if len(ll) < 2:
613  print ('bad line', line)
614  continue
615  mname = ll[0].strip()
616  ll = ll[1].split()
617  if len(ll) < 1:
618  print ('bad line', line)
619  continue
620  id = ll[0]
621  pname = None
622  if len(ll) >= 2 and ll[1] != '!':
623  pname = ll[1]
624  rname = None
625  if len(ll) >= 3 and ll[2] != '!':
626  rname = ll[2]
627  try:
628  id = int(id)
629  except ValueError:
630  id = globals().get(id)
631  if id is None:
632  print ('bad line', line)
633  continue
634 
635  if pname is None:
636  pname = mname
637  if rname is None:
638  rname = pname
639 
640  globals()[mname] = id
641  if id not in pdgid_names:
642  pdgid_names[id] = pname
643  if id not in root_names:
644  root_names[id] = rname
645  return
646 
647 # Fill the dictionaries.
648 _fill_dicts()
649 
650 # Kill these now to save memory.

◆ pdgid_to_name()

def python.PDG.pdgid_to_name (   id)
Convert a PDG ID to a printable string.

Definition at line 26 of file Event/PyDumper/python/PDG.py.

26 def pdgid_to_name (id):
27  """Convert a PDG ID to a printable string.
28  """
29  name = pdgid_names.get(id)
30  if not name:
31  name = str(id)
32  return name
33 
34 

◆ pdgid_to_root_name()

def python.PDG.pdgid_to_root_name (   id)
Convert a PDG ID to a string with root markup.

Definition at line 35 of file Event/PyDumper/python/PDG.py.

35 def pdgid_to_root_name (id):
36  """Convert a PDG ID to a string with root markup.
37  """
38  name = root_names.get(id)
39  if not name:
40  name = str(id)
41  return name
42 
43 
44 
45 #
46 # Table of PDG IDs, associating the ID codes with up to several names.
47 # This is formatted as one big string to make it easier to maintain
48 # (don't need to quote everything individually).
49 # The format of each line is like this:
50 #
51 # mname = id pname rname
52 #
53 # An attribute mname will be added to this module with a value of id.
54 # These names are intended to match those in PdgPdt.h.
55 # pname is a printable name for the entry, and rname is a name
56 # with root-style markup. These names will be put into the pdgid_names
57 # and root_names dictionaries, respectively. They can be left as `!'
58 # if no name is available. pname and rname should not contain spaces.
59 # Blank lines or those starting with `#' will be ignored.
60 #

Variable Documentation

◆ _pdgtable

python.PDG._pdgtable = \
private

Definition at line 61 of file Event/PyDumper/python/PDG.py.

◆ pdgid_names

dictionary python.PDG.pdgid_names = {}

Definition at line 20 of file Event/PyDumper/python/PDG.py.

◆ root_names

dictionary python.PDG.root_names = {}

Definition at line 23 of file Event/PyDumper/python/PDG.py.

CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.PDG.pdgid_to_name
def pdgid_to_name(id)
Definition: Event/PyDumper/python/PDG.py:26
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
str
Definition: BTagTrackIpAccessor.cxx:11
python.PDG.pdgid_to_root_name
def pdgid_to_root_name(id)
Definition: Event/PyDumper/python/PDG.py:35
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
python.PDG._fill_dicts
def _fill_dicts()
Definition: Event/PyDumper/python/PDG.py:603