/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 #!/usr/bin/env python 00002 00003 import GaudiKernel.SystemOfUnits as units 00004 from GenTools.GenToolsConf import GtPositionerTool 00005 from GenTools.GenToolsConf import GtTransformTool 00006 from GenDecay.GenDecayConf import GtDecayerator 00007 00008 class Decay: 00009 00010 ''' 00011 A GenTools "helper" module to configure for a radioactive decay 00012 chain. 00013 ''' 00014 00015 00016 def __init__(self, 00017 name = 'decay', 00018 volume = '/dd/Structure/AD/far-oil1', 00019 decay = None, 00020 positioner = None, 00021 transformer = None 00022 ): 00023 ''' 00024 Construct a Decay helper. 00025 00026 First argument is the name of this Decay and must be specified for mutiple particle event simulation. 00027 00028 Coustom configured tools can 00029 can be done after construction 00030 using the data members: 00031 00032 .decay 00033 .positioner 00034 .transformer 00035 00036 The GtGenerator alg is available from the .generatorAlg member. 00037 00038 They can be accessed for additional, direct configuration. 00039 00040 If the Volume property for the positioner and transformer is 00041 not yet set, it will be set to the value of "volume" 00042 00043 ''' 00044 00045 if decay == None: 00046 self.decay = GtDecayerator(name, 00047 ParentNuclide = "U238", 00048 ParentAbundance = 5e16, 00049 SecularEquilibrium = True, 00050 CorrelationTime = 1*units.second) 00051 #self.decay.OutputLevel = 2 00052 00053 if positioner == None: 00054 positioner = GtPositionerTool(name+"Positioner", 00055 Strategy = 'FullVolume', 00056 Mode = 'Uniform') 00057 00058 positioner.Volume = volume 00059 00060 if transformer == None: 00061 transformer = GtTransformTool(name+"Transformer") 00062 00063 transformer.Volume = volume 00064 00065 self.positioner = positioner 00066 self.transformer = transformer 00067 00068 return 00069 00070 def setVolume(self,volumename): 00071 self.positioner.Volume = volumename 00072 self.transformer.Volume = volumename 00073 return 00074 00075 def tools(self): 00076 return [self.decay,self.positioner,self.transformer] 00077 00078 pass # end Decay 00079 00080 00081 def configure(argv=[]): 00082 ''' 00083 Configure for use as a Job Option Module 00084 ''' 00085 00086 from optparse import OptionParser 00087 00088 nuclide='U-238' 00089 00090 parser = OptionParser(usage=configure.__doc__) 00091 parser.add_option('-n','--nuclide',default='U-238',type='string', 00092 help='Set name of nuclide (def: "U-238")') 00093 parser.add_option('-t','--correlation-time',default=1, 00094 type='float', 00095 help='Decay correlation time in seconds (def: 1)') 00096 parser.add_option('-a','--abundance',default=5.0e16, type='float', 00097 help='Abundance = concentration*grams*N_a/A (def=5.0e16)') 00098 parser.add_option('-e','--secular-equilibrium',default=True, 00099 help='Assume secular equilibrium for uncorrelated decays (def=True)') 00100 00101 parser.disable_interspersed_args() 00102 opts,args = parser.parse_args(args=argv) 00103 opts.correlation_time *= units.second 00104 00105 import GenTools 00106 helper = Decay() 00107 helper.decay.CorrelationTime = opts.correlation_time 00108 helper.decay.ParentNuclide = opts.nuclide 00109 helper.decay.ParentAbundance = opts.abundance 00110 helper.decay.SecularEquilibrium = opts.secular_equilibrium 00111 #helper.OutputLevel = 2 00112 gtc = GenTools.Configure(genname="GenDecay",helper=helper) 00113 00114 #GenTools.Dumper() 00115 00116 return