The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
PythiaID.py
Go to the documentation of this file.
14def properties(pid, sgn=1):
15 return {
16 "name": pid.name(sgn),
17 "threeCharge": pid.chargeType(sgn),
18 "hasAnti": pid.hasAnti(),
19 "isLepton": pid.isLepton(),
20 "isQuark": pid.isQuark(),
21 "isDiQuark": pid.isDiquark(),
22 "isHadron": pid.isHadron(),
23 "isMeson": pid.isMeson(),
24 "isBaryon": pid.isBaryon(),
25 "jSpin": pid.spinType(),
26 }
27
28
29# Generate the PID dictionary and optionally archive.
30def generate(dat=None):
31 import pythia8
32
33 pythia = pythia8.Pythia("", False)
34
35 # Loop over the particles.
36 pid, pids = 1, {}
37 while pid != 0:
38 pids[pid] = properties(pythia.particleData.particleDataEntryPtr(pid))
39 if pids[pid]["hasAnti"]:
40 pids[-pid] = properties(pythia.particleData.particleDataEntryPtr(pid), -1)
41 pid = pythia.particleData.nextId(abs(pid))
42
43 # Archive if requested.
44 if dat:
45 with open(dat, "w") as dat:
46 dat.write(repr(pids))
47 return pids
48
49
50# Load the Pythia dictionary.
51try:
52 pids = eval(open("PythiaID.dat").read())
53except FileNotFoundError:
54 pids = generate("PythiaID.dat")
properties(pid, sgn=1)
(c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations # # This software i...
Definition PythiaID.py:14
generate(dat=None)
Definition PythiaID.py:30