00001
00002
00003 class MyGenToolsConfig:
00004 def __init__(self,volume):
00005 import GaudiPython as gm
00006 app = gm.AppMgr()
00007 app.TopAlg = []
00008
00009
00010
00011
00012
00013
00014 import GaudiKernel.SystemOfUnits as units
00015 tim = app.property("ToolSvc.GtTimeratorTool")
00016 tim.LifeTime = int(1*units.second)
00017
00018
00019 poser = app.property("ToolSvc.GtPositionerTool")
00020 poser.Volume = volume
00021
00022 poser.Strategy = "FullVolume"
00023 poser.Mode = "Smeared"
00024 poser.Spread = 1.0*units.cm
00025 poser.Position = [0.0,0.0,0.0];
00026 poser.OutputLevel = 1
00027
00028
00029 gun = app.property("ToolSvc.GtGunGenTool")
00030 gun.ParticlesPerEvent = 100
00031 gun.ParticleName = "opticalphoton"
00032 gun.Momentum = 2.5*units.eV
00033
00034
00035 gun.MomentumMode = "Fixed"
00036 gun.DirectionMode = "Fixed"
00037 gun.Direction = [ 0.243,0.0,-0.970 ]
00038
00039
00040
00041
00042
00043 app.TopAlg += [ "GtGenerator/Generator", "GtHepMCDumper/Dumper" ]
00044
00045
00046 gen = app.algorithm("Generator")
00047 gen.OutputLevel = 1
00048 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool" ]
00049 gen.GenName = "Bang Bang"
00050 gen.Location = "/Event/Gen/HepMCEvents"
00051
00052
00053 dump = app.algorithm("Dumper")
00054 dump.Location = "/Event/Gen/HepMCEvents"
00055
00056
00057
00058 from GaudiKernel import SystemOfUnits as units
00059 app.ExtSvc += ["GiGa"]
00060
00061 modularPL = app.property("GiGa.GiGaPhysListModular")
00062 modularPL.OutputLevel = 1
00063 modularPL.CutForElectron = 100*units.micrometer
00064 modularPL.CutForPositron = 100*units.micrometer
00065 modularPL.CutForGamma = 1*units.millimeter
00066 modularPL.PhysicsConstructors = [
00067 "DsPhysConsGeneral",
00068 "DsPhysConsOptical"
00069 ]
00070
00071 giga = app.service("GiGa")
00072 giga.OutputLevel = 1
00073 giga.PhysicsList = "GiGaPhysListModular"
00074
00075 gggeo = app.service("GiGaGeo")
00076 gggeo.OutputLevel = 1
00077
00078
00079 ggrm = app.property("GiGa.GiGaMgr")
00080 ggrm.Verbosity = 9
00081 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00082 event_ac_cmds.BeginOfEventCommands = [
00083 "/control/verbose 2",
00084 "/run/verbose 1",
00085 "/event/verbose 2",
00086 "/tracking/verbose 2",
00087 "/geometry/navigator/verbose 2"
00088 ]
00089 giga.EventAction = "GiGaEventActionCommand"
00090
00091
00092 app.TopAlg += [ "GaudiSequencer/Simulation" ]
00093 seq = app.algorithm("Simulation")
00094 seq.Members = []
00095
00096
00097 ggin = app.algorithm("GGInStream")
00098 ggin.OutputLevel = 1
00099 ggin.ExecuteOnce = True
00100 ggin.ConversionSvcName = "GiGaGeo"
00101 ggin.DataProviderSvcName = "DetectorDataSvc"
00102 ggin.StreamItems = [
00103 "/dd/Structure/world",
00104 "/dd/Geometry/PmtBox/PmtBoxSurfaces",
00105 ]
00106
00107 seq.Members = [ "GiGaInputStream/GGInStream", "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00108 push = app.algorithm("PushKine")
00109 push.Converter = "HepMCtoG4"
00110
00111
00112 return
00113
00114 if '__main__' == __name__:
00115 import os
00116 loc = os.getenv('XMLDETDESCROOT')
00117 if not loc:
00118 raise RuntimeError,"Location of DetDesc XML file not specified"
00119 loc += "/DDDB/pmtbox.xml"
00120
00121 import xmldetdesc
00122 xddc = xmldetdesc.XmlDetDescConfig(loc=loc)
00123 gtc = MyGenToolsConfig(volume="/dd/Structure/steel-2/water-2")
00124
00125 import gaudimodule as gm
00126 app = gm.AppMgr()
00127 app.EvtSel = "NONE"
00128 app.run(2)
00129