# -*- python -*- from __future__ import print_function import optparse op = optparse.OptionParser() op.add_option("-f", "--dbfile", action="store", dest="FILE", metavar="FILE", help="specify the db file to read", default=None) opts, args = op.parse_args() import pypdt t = pypdt.ParticleDataTable(opts.FILE if opts.FILE else None) for pid in args: print(t[pid])
import random import math import json import textwrap from operator import itemgetter import time, threading import numpy as np #ParticleDataTool gives us the decay channels from ParticleDataTool import ParticleDataTool as pdt pythia = pdt.PYTHIAParticleData(file_path='ParticleData.ppl', use_cache=True) #PYPDT gives us info about mass, charge, lifetime import pypdt tbl = pypdt.ParticleDataTable() part_dict = {} for p in tbl: part_dict[p.name] = p.id quarks = {'d': 1, 'u': 2, 's': 3, 'c': 4, 'b': 5, 't': 6} aquarks = {'d': -1, 'u': -2, 's': -3, 'c': -4, 'b': -5, 't': -6} class Particle(object): __metaclass__ = abc.ABCMeta @abc.abstractproperty def parent(self): pass
import random import math import json import textwrap from operator import itemgetter import time, threading import numpy as np #ParticleDataTool gives us the decay channels from ParticleDataTool import ParticleDataTool as pdt pythia = pdt.PYTHIAParticleData(file_path='ParticleData.ppl', use_cache=True) #PYPDT gives us info about mass, charge, lifetime import pypdt tbl = pypdt.ParticleDataTable("/home/cristobal/mass_width_2016.mcd") part_dict = {} for p in tbl: part_dict[p.name] = p.id #particle_extra_info gives us information about composition, interactions, type,... def str_hook( obj ): # this is to convert unicodes to strings in json load. copied from somewhere. doe snot work very well return { k.encode('utf-8') if isinstance(k, unicode) else k: v.encode('utf-8') if isinstance(v, unicode) else v for k, v in obj }