Public Member Functions | |
def | __init__ |
def | init |
def | init_gen_tools |
Public Attributes | |
app | |
nevents | |
seed | |
volume | |
hepevt_source |
Definition at line 3 of file my.py.
def my::GenToolsConfig::__init__ | ( | self, | ||
volume = "/dd/Geometry/AD/lvAD" , |
||||
nevents = 10 , |
||||
seed = 1234567 , |
||||
Use, | ||||
Co60, | ||||
exe, | ||||
because, | ||||
it, | ||||
is, | ||||
fast, | ||||
easy, | ||||
testing, | ||||
hepevt_source = "Co60.exe -seed %(seed)s -n %(nevents)s|" | ||||
) |
Definition at line 4 of file my.py.
00009 : 00010 import GaudiPython as gm 00011 self.app = gm.AppMgr() 00012 #msg = self.app.service("MessageSvc") 00013 #msg.OutputLevel = 1 00014 self.nevents = nevents 00015 self.seed = seed 00016 self.volume = volume 00017 self.hepevt_source=hepevt_source 00018 self.init() 00019 return 00020 def init(self):
def my::GenToolsConfig::init | ( | self | ) |
Definition at line 21 of file my.py.
00021 : 00022 self.init_gen_tools() 00023 return 00024 def init_gen_tools(self):
def my::GenToolsConfig::init_gen_tools | ( | self | ) |
Definition at line 25 of file my.py.
00025 : 00026 from GaudiKernel import SystemOfUnits as units 00027 00028 #print " init_gen_tools" 00029 00030 # Set up timerator 00031 tim = self.app.property("ToolSvc.GtTimeratorTool") 00032 #tim.OutputLevel=1 00033 tim.LifeTime = int(1*units.second) 00034 00035 00036 # Set up positioner 00037 #print " Creating poser" 00038 poser = self.app.property("ToolSvc.GtPositionerTool") 00039 poser.OutputLevel = 2 00040 poser.Volume = self.volume 00041 poser.Strategy = "FullVolume" # also "AvoidDaughters" and "Surface" 00042 poser.Mode = "Uniform" 00043 poser.Spread = 10*units.cm 00044 poser.Position = [0,0,0] 00045 00046 # Deal with executable 00047 if self.hepevt_source[-1] == "|": 00048 exe = self.hepevt_source.split(' ')[0] 00049 if exe[0] != '/': # Try to find full path 00050 import os, os.path 00051 path = os.getenv('PATH') 00052 for p in path: 00053 if (os.path.isfile(path+"/"+exe)): 00054 exe = path+"/"+exe 00055 break 00056 continue 00057 pass 00058 source = exe + ' ' + ' '.join(self.hepevt_source.split(' ')[1:]) 00059 if "%" in source: # Fill in any placemarks 00060 source = source%{'nevents':str(self.nevents), 00061 'seed':str(self.seed)} 00062 pass 00063 pass 00064 00065 00066 # HEPEvt -> HepMC generator 00067 #hepevt = self.app.property("ToolSvc.GtHepEvtGenTool") 00068 #hepevt.HepEvtDataSource = source 00069 #print " HepEvtGenTool with", source 00070 00071 # Set up gun 00072 gun = self.app.property("ToolSvc.GtGunGenTool") 00073 gun.OutputLevel = 2 00074 gun.ParticleName = "opticalphoton" 00075 gun.MomentumMode = "Fixed" 00076 gun.Momentum = 2.5*units.eV 00077 gun.DirectionMode = "Fixed" 00078 gun.Direction = [ 0.0,0.0,-1.0 ] 00079 00080 return 00081 00082 if '__main__' == __name__: