13from particle 
import Particle, ParticleNotFound
 
   14from particle.particle.particle 
import InvalidParticle
 
   16from math 
import isclose
 
   19pdg.load(basf2.find_file(
"data/framework/particledb/evt.pdl"))
 
   26        pdg = Particle.from_pdgid(p.PdgCode())
 
   27        names = [
"mass", 
"width", 
"lifetime", 
"charge"]
 
   28        current = [p.Mass(), p.Width(), p.Lifetime(), p.Charge()/3]
 
   29        nominal = [pdg.mass/1e3 
if pdg.mass 
is not None else 0,
 
   30                   pdg.width/1e3 
if pdg.width 
is not None else 0,
 
   31                   pdg.lifetime/1e9 
if pdg.lifetime 
is not None and pdg.width > 0 
else 0,
 
   33        for n, a, b 
in zip(names, current, nominal):
 
   34            if not isclose(a, b, rel_tol=0.05, abs_tol=1e-12):
 
   35                print(f
"{p.GetName()} difference in {n}: {a} != {b}")
 
   36    except (ParticleNotFound, InvalidParticle):
 
   39    all_pdgcodes.add(p.PdgCode())
 
   41print(
"Not found in PDG table:", 
", ".join(p.GetName() 
for p 
in not_found))
 
   42print(
"Found in PDG table but not evt.pdl:", 
", ".join(p.name 
for p 
in Particle.findall(
lambda p: p.pdgid 
not in all_pdgcodes)))
 
search(name=None, min_mass=None, max_mass=None, name_regex=False, include_width=False)