Definition at line 109 of file PDGHelpers.py.
◆ __init__()
def PDGHelpers.PDGParser.__init__ |
( |
|
self, |
|
|
|
table, |
|
|
|
ranges |
|
) |
| |
Definition at line 111 of file PDGHelpers.py.
112 self.log = logging.getLogger(__name__)
115 self.extraParticles = {}
◆ accept()
def PDGHelpers.PDGParser.accept |
( |
|
self, |
|
|
|
pdg |
|
) |
| |
Function to determine which extra particles are added
Function checks the ranges member variable
and evaluates whether the particle should be accepted.
TODO Consider adding a Sim.ExtraParticlesRanges ConfigFlag
For example, '111-556,1112-9090226' matches everything from
111 to 555 and 1112 to 9090225.
Definition at line 118 of file PDGHelpers.py.
119 """Function to determine which extra particles are added
121 Function checks the ranges member variable
122 and evaluates whether the particle should be accepted.
124 TODO Consider adding a Sim.ExtraParticlesRanges ConfigFlag
126 For example, '111-556,1112-9090226' matches everything from
127 111 to 555 and 1112 to 9090225.
129 ranges = [r.split(
"-")
for r
in self.ranges.
split(
",")]
131 if int(r[0]) <= pdg <
int(r[1]):
◆ createList()
def PDGHelpers.PDGParser.createList |
( |
|
self | ) |
|
Definition at line 222 of file PDGHelpers.py.
222 def createList(self):
223 pdgcodes = [ self.extraParticles[name].pdg
for name
in self.extraParticles ]
228 for name
in self.extraParticles:
229 outDict.update({name: [
230 self.extraParticles[name].mass,
231 self.extraParticles[name].width,
232 self.extraParticles[name].charge,
233 self.extraParticles[name].pdg,
234 self.extraParticles[name].lifetime
◆ formatCharge()
def PDGHelpers.PDGParser.formatCharge |
( |
|
self, |
|
|
|
charge |
|
) |
| |
Definition at line 206 of file PDGHelpers.py.
206 def formatCharge(self, charge):
209 if not (charge == len(charge) * charge[0]):
210 raise ValueError(
'Unexpected charge %s' % charge)
220 raise ValueError(
'Unexpected charge %s' % charge)
◆ formatName()
def PDGHelpers.PDGParser.formatName |
( |
|
self, |
|
|
|
name, |
|
|
|
charge |
|
) |
| |
Definition at line 200 of file PDGHelpers.py.
200 def formatName(self, name, charge):
202 nameOut = nameOut.replace(
"*",
"_star").
replace(
"'",
"_prime")
◆ parsePDGTABLE()
def PDGHelpers.PDGParser.parsePDGTABLE |
( |
|
self | ) |
|
Definition at line 134 of file PDGHelpers.py.
134 def parsePDGTABLE(self):
137 with open(self.table,
'r')
as f:
139 if line.startswith(
'*'):
142 splitLine = line.split()
145 baseName = splitLine[-2]
148 charges = splitLine[-1].
split(
',')
152 symbol = splitLine[0]
159 'Unidentified symbol %s for particle %s' % (
162 pdgs = splitLine[1:1+len(charges)]
163 value =
float(splitLine[1+len(charges)])
165 for pdg, charge
in zip(pdgs, charges):
166 if not self.accept(
int(pdg)):
168 name = self.formatName(baseName, charge)
170 kwargs.setdefault(
'name', name)
171 kwargs.setdefault(prop, value * MeV)
172 kwargs.setdefault(
'pdg',
int(pdg))
173 kwargs.setdefault(
'charge', self.formatCharge(charge))
174 if name
not in self.extraParticles.
keys():
175 self.extraParticles[name] = ExtraParticle(**kwargs)
177 if getattr(self.extraParticles[name], prop) != -1:
179 "Property %s is already"
180 "set for particle %s."
181 "Current value is %s and"
182 "incoming value is %s.",
184 getattr(self.extraParticles[name], prop),
187 setattr(self.extraParticles[name], prop, value)
189 for name
in self.extraParticles:
191 width = self.extraParticles[name].width
193 self.extraParticles[name].lifetime = hbar_Planck/width
196 for name
in [x
for x
in self.extraParticles.
keys()]:
197 antiParticle = -self.extraParticles[name]
198 self.extraParticles.
update({antiParticle.name: antiParticle})
◆ extraParticles
PDGHelpers.PDGParser.extraParticles |
◆ log
◆ ranges
PDGHelpers.PDGParser.ranges |
◆ table
PDGHelpers.PDGParser.table |
The documentation for this class was generated from the following file: