Public Member Functions | |
def | __init__ |
def | __str__ |
def | getIsotope |
def | chain |
Public Attributes | |
corrTime | |
subChain | |
groundStates | |
head | |
Static Public Attributes | |
float | energyPrecision = 0.01 |
Static Private Attributes | |
dictionary | _isotopes = {} |
Definition at line 9 of file chain.py.
def GenDecay::chain::G4DataChain::__init__ | ( | self, | ||
z, | ||||
a, | ||||
correlation_time = None | ||||
) |
Definition at line 20 of file chain.py.
00020 : 00021 ''' Build a decay chain starting from the given (ground state) 00022 nuclide with Z and A. If a correlation time is given it will 00023 be used to separate the chain into sub-chains that start at 00024 nuclides with half lives greater than the correlation time.''' 00025 00026 self.corrTime = correlation_time 00027 00028 self.subChain = [] 00029 self.groundStates = [] self.head = self.chain(z,a)
def GenDecay::chain::G4DataChain::__str__ | ( | self | ) |
def GenDecay::chain::G4DataChain::getIsotope | ( | self, | ||
z, | ||||
a, | ||||
nucexenergy | ||||
) |
Definition at line 33 of file chain.py.
00033 : 00034 return str(self.head) 00035 00036 def getIsotope(self,z,a,nucexenergy): 00037 'Retrieve isotope, return (iso,BOOL), BOOL is True if iso is freshly constructed' 00038 00039 from data import Isotope 00040 00041 try: 00042 isos = G4DataChain._isotopes[(z,a)] 00043 except KeyError: 00044 iso = Isotope(z,a,level=nucexenergy) 00045 G4DataChain._isotopes[(z,a)] = [iso] 00046 #print 'Making first seen: %s'%iso 00047 return iso,True 00048 00049 for iso in isos: 00050 import math 00051 if math.fabs(nucexenergy - iso.level) <= G4DataChain.energyPrecision*nucexenergy: 00052 #print 'Found in cache: %s'%iso 00053 return iso,False # cache hit 00054 continue 00055 00056 # found cached isotopes but wrong energy level 00057 iso = Isotope(z,a,level=nucexenergy) 00058 G4DataChain._isotopes[(z,a)].append(iso) 00059 assert len(G4DataChain._isotopes[(z,a)]) > 1 00060 #print 'In cache, new energy: %s'%iso return iso,True
def GenDecay::chain::G4DataChain::chain | ( | self, | ||
z, | ||||
a, | ||||
nucexenergy = 0.0 | ||||
) |
Definition at line 61 of file chain.py.
00064 : 00065 'Return Isotope coresponding to given inputs' 00066 import math, decay 00067 from data import units, Transition 00068 00069 iso,new = self.getIsotope(z,a,nucexenergy) 00070 00071 if new and nucexenergy == 0.0: self.groundStates.append(iso) 00072 00073 if not new: # been there, done that 00074 #print "Already chained: %s"%iso 00075 return iso 00076 #print 'Chaining: %s'%iso 00077 00078 # If nucleous is excited, deal with it promptly 00079 if nucexenergy > G4DataChain.energyPrecision*units.keV: 00080 daughter = self.chain(z,a) 00081 tran = Transition(iso,daughter,decay.GammaDecay(nucexenergy)) 00082 return iso 00083 00084 try: 00085 rd = G4RadData() 00086 nuc = rd.nuclideData(z,a) 00087 except ValueError,err: 00088 print 'No data for z=%d, a=%d, assuming stable (%s)'%(z,a,err) 00089 return iso 00090 00091 state = nuc.excitedState(nucexenergy) 00092 if state is None: 00093 print 'No excited state for z=%d, a=%d, E = %f, assuming stable'%(z,a,nucexenergy) 00094 return iso 00095 iso.halflife = state.halflife 00096 if new and iso.halflife > self.corrTime: 00097 self.subChain.append(iso) 00098 00099 for dk in state.decays: 00100 daughter = self.chain(dk.daughterZ,dk.daughterA,dk.daughterExcitation) 00101 tran = Transition(iso,daughter,dk.radiation,fraction=dk.fraction)
dictionary GenDecay::chain::G4DataChain::_isotopes = {} [static, private] |
float GenDecay::chain::G4DataChain::energyPrecision = 0.01 [static] |