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

In This Package:

K40.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 class K40:
00004     '''
00005        configure K40 generator
00006     '''
00007 
00008     def __init__(self,
00009                  stage='null',
00010                  name='K40',
00011                  volume='/dd/Structure/AD/far-oil1',
00012                  start_time=0,
00013                  seed=1234567):
00014 
00015         # set up Gnrtr itself
00016         from Gnrtr.GnrtrConf import Gnrtr
00017         gnrtr = Gnrtr(name);
00018 
00019         gnrtr.GenTools = [ "GtHepEvtGenTool/"+name+"Gen",
00020                            "GtPositionerTool/"+name+"Pos",
00021                            "GtTimeratorTool/"+name+"Tim",
00022                            "GtTransformTool/"+name+"Tra"]
00023 
00024         gnrtr.ThisStageName = "Kinematic"
00025         gnrtr.TimeStamp = start_time
00026 
00027         if stage != 'null':
00028             stage.KinematicSequence.Members.append(gnrtr)
00029 
00030         # set up each tools
00031         from GaudiKernel import SystemOfUnits as units
00032         from GenTools.GenToolsConf import GtPositionerTool, GtTransformTool, GtTimeratorTool, GtHepEvtGenTool
00033         # Set up Gen
00034 
00035         nevents=5000
00036         hepevt_source="K40.exe -seed %(seed)s -n %(nevents)s|"
00037         # Deal with executable
00038         if hepevt_source[-1] == "|":
00039             exe = hepevt_source.split(' ')[0]
00040             if exe[0] != '/':   # Try to find full path
00041                 import os, os.path
00042                 path = os.getenv('PATH')
00043                 for p in path:
00044                     if (os.path.isfile(path+"/"+exe)):
00045                         exe = path+"/"+exe
00046                         break
00047                     continue
00048                 pass
00049             source = exe + ' ' + ' '.join(hepevt_source.split(' ')[1:])
00050             if "%" in source:   # Fill in any placemarks
00051                 source = source%{'nevents':str(nevents),
00052                                  'seed':str(seed)}
00053                 pass
00054             pass
00055         
00056         
00057         #generator
00058         gen=GtHepEvtGenTool(name+'Gen',HepEvtDataSource = source)
00059         #gen.OutputLevel = 2
00060         gen.HepEvtDataSource = source
00061         
00062         # Set up positioner
00063         pos=GtPositionerTool(name+'Pos',Volume=volume)
00064         pos.Strategy = "FullVolume" # also "AvoidDaughters" and "Surface"
00065         pos.Mode = "Uniform"
00066         #pos.Mode = "Fixed"
00067         pos.Spread = 25*units.m
00068         pos.Position = [0,0,2.5*units.m]
00069         
00070         # Set up timerator
00071         tim=GtTimeratorTool(name+'Tim')
00072         tim.LifeTime = int(30000*units.ns)
00073         
00074         # transform
00075         tra=GtTransformTool(name+'Tra',Volume=volume)
00076         
00077         pass
00078 
00079 if __name__ == "__main__":
00080     obj=K40()
| 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