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 = 2
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 = 2
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 = 5
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 = 3
00073 giga.PhysicsList = "GiGaPhysListModular"
00074
00075 giga.TrackingAction = "MyTrackAction"
00076 app.property("GiGa.MyTrackAction").MyProp="Frog blast the vent core!"
00077 giga.SteppingAction = "MyStepAction"
00078 app.property("GiGa.MyStepAction").MyProp="I'm out of ammo!"
00079
00080 gggeo = app.service("GiGaGeo")
00081 gggeo.OutputLevel = 3
00082
00083
00084 ggrm = app.property("GiGa.GiGaMgr")
00085 ggrm.Verbosity = 9
00086 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00087 event_ac_cmds.BeginOfEventCommands = [
00088 "/control/verbose 1",
00089 "/run/verbose 1",
00090 "/event/verbose 1",
00091 "/tracking/verbose 0",
00092 "/geometry/navigator/verbose 0"
00093 "/particle/property/verbose 0"
00094 ]
00095 giga.EventAction = "GiGaEventActionCommand"
00096
00097
00098 app.TopAlg += [ "GaudiSequencer/Simulation" ]
00099 seq = app.algorithm("Simulation")
00100 seq.Members = []
00101
00102
00103 ggin = app.algorithm("GGInStream")
00104 ggin.OutputLevel = 2
00105 ggin.ExecuteOnce = True
00106 ggin.ConversionSvcName = "GiGaGeo"
00107 ggin.DataProviderSvcName = "DetectorDataSvc"
00108 ggin.StreamItems = [
00109 "/dd/Structure/world",
00110 "/dd/Geometry/PmtBox/PmtBoxSurfaces",
00111 ]
00112
00113 seq.Members = [ "GiGaInputStream/GGInStream", "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00114 push = app.algorithm("PushKine")
00115 push.Converter = "HepMCtoG4"
00116
00117
00118 return
00119
00120 if '__main__' == __name__:
00121 import os
00122 loc = os.getenv('XMLDETDESCROOT')
00123 if not loc:
00124 raise RuntimeError,"Location of DetDesc XML file not specified"
00125 loc += "/DDDB/pmtbox.xml"
00126
00127 import xmldetdesc
00128 xddc = xmldetdesc.XmlDetDescConfig(loc=loc)
00129 gtc = MyGenToolsConfig(volume="/dd/Structure/steel-2/water-2")
00130
00131 import gaudimodule as gm
00132 app = gm.AppMgr()
00133 app.EvtSel = "NONE"
00134 det = app.detSvc()
00135
00136
00137 app.run(2)
00138