/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

gun.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 '''
00003     Note that the volume is set to /dd/Structure/DayaBay,
00004     So the position is global position which is exactly what is used in Geant4.
00005     It is good for debugging.
00006     Zhe Wang Apr 9,2009
00007 '''
00008 class gun:
00009     '''
00010        configure gun generator
00011     '''
00012 
00013     def __init__(self,
00014                  stage='null',
00015                  name='gun',
00016                  volume='/dd/Structure/DayaBay',
00017                  start_time=0):
00018 
00019         # set up Gnrtr itself
00020         from Gnrtr.GnrtrConf import Gnrtr
00021         gnrtr = Gnrtr(name);
00022 
00023         gnrtr.GenTools = [ "GtGunGenTool/"+name+"Gen",
00024                            "GtPositionerTool/"+name+"Pos",
00025                            "GtTimeratorTool/"+name+"Tim",
00026                            "GtTransformTool/"+name+"Tra"]
00027 
00028         gnrtr.ThisStageName = "Kinematic"
00029         gnrtr.TimeStamp = start_time
00030 
00031         if stage != 'null':
00032             stage.KinematicSequence.Members.append(gnrtr)
00033 
00034         # set up each tools
00035         from GaudiKernel import SystemOfUnits as units
00036         from GenTools.GenToolsConf import GtPositionerTool, GtTransformTool, GtTimeratorTool
00037 
00038         # generator
00039         from GenTools.GenToolsConf import GtGunGenTool
00040         gun = GtGunGenTool(name+"Gen")
00041         gun.ParticlesPerEvent = 1000
00042         gun.ParticleName = "opticalphoton"
00043         gun.Momentum = 2*units.eV
00044         gun.MomentumMode = "Fixed"
00045         gun.MomentumSpread = 0*units.eV
00046         gun.DirectionMode = "Fixed"
00047         gun.Direction = [ 2.52361587010091171,
00048                           -0.129228715901263058,
00049                           -3.46788066267345130 ]
00050         gun.DirectionSpread = 0
00051         
00052         # Set up positioner
00053         pos=GtPositionerTool(name+'Pos',Volume=volume)
00054         pos.Strategy = "FullVolume" # also "AvoidDaughters" and "Surface"
00055         #pos.Mode = "Uniform"
00056         #pos.Mode = "Fixed"
00057         pos.Mode = "Smeared"        
00058         pos.Spread = 5*units.mm
00059         pos.Position = [-411762.29689663457*units.mm,
00060                         817680.94560857571*units.mm,
00061                         -1890.6120407181961*units.mm]
00062         #pos.Position = [-411763.29689663457*units.mm,
00063         #                817680.94560857571*units.mm,
00064         #                -1889.6120407181961*units.mm]
00065         
00066         # Set up timerator
00067         tim=GtTimeratorTool(name+'Tim')
00068         tim.LifeTime = int(30000000*units.ns)
00069         
00070         # transform
00071         tra=GtTransformTool(name+'Tra',Volume=volume)
00072         
00073         pass
00074 
00075 if __name__ == "__main__":
00076     obj=gun()
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:07:33 for Stage by doxygen 1.7.4