| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Helpers.py

Go to the documentation of this file.
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                   
00052         if positioner == None:
00053             positioner = GtPositionerTool(name+"Positioner",
00054                                          Strategy = 'FullVolume',
00055                                          Mode = 'Uniform')
00056 
00057         positioner.Volume = volume
00058         
00059         if transformer == None:
00060             transformer = GtTransformTool(name+"Transformer")
00061 
00062         transformer.Volume = volume 
00063 
00064         self.positioner =positioner
00065         self.transformer = transformer
00066 
00067         return
00068 
00069     def setVolume(self,volumename):
00070         self.positioner.Volume = volumename
00071         self.transformer.Volume = volumename
00072         return
00073 
00074     def tools(self):
00075         return [self.decay,self.positioner,self.transformer]
00076 
00077     pass # end Decay
00078 
00079 
00080 def configure(argv=[]):
00081     '''
00082     Configure for use as a Job Option Module
00083     '''
00084 
00085     from optparse import OptionParser
00086 
00087     nuclide='U-238'
00088 
00089     parser = OptionParser(usage=configure.__doc__)
00090     parser.add_option('-n','--nuclide',default='U-238',type='string',
00091                       help='Set name of nuclide (def: "U-238")')
00092     parser.add_option('-t','--correlation-time',default=1,
00093                       type='float',
00094                       help='Decay correlation time in seconds (def: 1)')
00095     parser.add_option('-a','--abundance',default=5.0e16, type='float',
00096                       help='Abundance = concentration*grams*N_a/A (def=5.0e16)')
00097     parser.add_option('-e','--secular-equilibrium',default=True,
00098                       help='Assume secular equilibrium for uncorrelated decays (def=True)')
00099 
00100     parser.disable_interspersed_args()
00101     opts,args = parser.parse_args(args=argv)
00102     opts.correlation_time *= units.second
00103 
00104     import GenTools
00105     helper = Decay()
00106     helper.decay.CorrelationTime = opts.correlation_time
00107     helper.decay.ParentNuclide = opts.nuclide
00108     helper.decay.ParentAbundance = opts.abundance
00109     helper.decay.SecularEquilibrium = opts.secular_equilibrium
00110     #helper.OutputLevel = 2
00111     gtc = GenTools.Configure(genname="GenDecay",helper=helper)
00112 
00113     #GenTools.Dumper()
00114 
00115     return
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 21:01:08 2011 for GenDecay by doxygen 1.4.7