Skip to content

Commit

Permalink
Merge branch 'develop' of git+ssh://github.com/SModelS/smodels into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
WolfgangWaltenberger committed Jan 17, 2024
2 parents 7bdb714 + 7082e4c commit 3a0335e
Show file tree
Hide file tree
Showing 19 changed files with 560 additions and 427 deletions.
4 changes: 2 additions & 2 deletions smodels/base/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,12 @@ def setDecays(self, decaysDict, promptWidth, stableWidth, ignorePromptQNumbers):

particle.totalwidth = abs(particleData.totalwidth)*GeV
if particle.totalwidth < stableWidth:
particle.totalwidth = 0.*GeV # Treat particle as stable
particle._isStable = True # Treat particle as stable
logger.debug("Particle %s has width below the threshold and will be assumed as stable" % particle.pdg)
continue

if particle.totalwidth > promptWidth:
particle.totalwidth = float('inf')*GeV # Treat particle as prompt
particle._isPrompt = True # Treat particle as prompt
logger.debug("Particle %s has width above the threshold and will be assumed as prompt." % particle.pdg)
else:
particle.decays.append(None) # Include possibility for particle being long-lived (non-prompt)
Expand Down
13 changes: 10 additions & 3 deletions smodels/base/particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __new__(cls, attributesDict={}, **kwargs):
newParticle._id = Particle.getID()
newParticle._comp = {newParticle._id: 0}
newParticle._isStable = None
newParticle._isPrompt = None
Particle._instances.add(weakref.ref(newParticle))
return newParticle

Expand Down Expand Up @@ -325,16 +326,22 @@ def isMET(self):

def isPrompt(self):
"""
Checks if the particle decays promptly (e.g. totalwidth = inf).
Checks if the particle decays promptly.
If _isPrompt has been set, return its value,
otherwise set to True if self.totalwidth == inf.
:return: True/False
"""
if self._isPrompt is None:
self._isPrompt = (self.totalwidth.asNumber() == float('inf'))

return self.totalwidth.asNumber() == float('inf')
return self._isPrompt

def isStable(self):
"""
Checks if the particle is stable (e.g. totalwidth = 0).
Checks if the particle is stable.
If _isStable has been set, return its value,
otherwise set to True if self.totalwidth == 0.
:return: True/False
"""
Expand Down
Loading

0 comments on commit 3a0335e

Please sign in to comment.