3 from particle
import Particle, ParticleNotFound
4 from particle.particle.particle
import InvalidParticle
6 from math
import isclose
9 pdg.load(basf2.find_file(
"data/framework/particledb/evt.pdl"))
16 pdg = Particle.from_pdgid(p.PdgCode())
17 names = [
"mass",
"width",
"lifetime",
"charge"]
18 current = [p.Mass(), p.Width(), p.Lifetime(), p.Charge()/3]
19 nominal = [pdg.mass/1e3
if pdg.mass
is not None else 0,
20 pdg.width/1e3
if pdg.width
is not None else 0,
21 pdg.lifetime/1e9
if pdg.lifetime
is not None and pdg.width > 0
else 0,
23 for n, a, b
in zip(names, current, nominal):
24 if not isclose(a, b, rel_tol=0.05, abs_tol=1e-12):
25 print(f
"{p.GetName()} difference in {n}: {a} != {b}")
26 except (ParticleNotFound, InvalidParticle):
29 all_pdgcodes.add(p.PdgCode())
31 print(
"Not found in PDG table:",
", ".join(p.GetName()
for p
in not_found))
32 print(
"Found in PDG table but not evt.pdl:",
", ".join(p.name
for p
in Particle.findall(
lambda p: p.pdgid
not in all_pdgcodes)))