00001
00002
00003 class MyGenToolsConfig:
00004 def __init__(self,volume):
00005 from GaudiPython import AppMgr
00006 from GaudiKernel import SystemOfUnits as units
00007
00008 app = AppMgr()
00009 app.TopAlg = []
00010
00011
00012 import GaudiKernel.SystemOfUnits as units
00013 tim = app.property("ToolSvc.GtTimeratorTool")
00014 tim.LifeTime = int(1*units.second)
00015
00016
00017 poser = app.property("ToolSvc.GtPositionerTool")
00018 poser.Volume = volume
00019 poser.Mode = "Fixed"
00020 poser.Position = [0,0,5.0/16.0*units.meter]
00021 poser.OutputLevel = 7
00022
00023
00024 gun = app.property("ToolSvc.GtGunGenTool")
00025 gun.OutputLevel = 7
00026 gun.Volume = volume
00027 gun.ParticlesPerEvent = 1
00028 gun.ParticleName = "opticalphoton"
00029 gun.Momentum = 2.5*units.eV
00030
00031
00032 gun.MomentumMode = "Fixed"
00033 gun.DirectionMode = "Fixed"
00034 from math import sin, cos, pi
00035 pmt_column_number = 9
00036 angle = (2*pmt_column_number - 1)*pi/24.0;
00037 gun.Direction = [ cos(angle),sin(angle),0 ]
00038 print 'gun.Direction=',gun.Direction
00039
00040 app.TopAlg += [ "GaudiSequencer/GenSeq" ]
00041 genseq = app.algorithm("GenSeq")
00042 genseq.Members = [ "GtGenerator/GenAlg", "GtHepMCDumper/GenDump" ]
00043
00044
00045 gen = app.algorithm("GenAlg")
00046 gen.OutputLevel = 7
00047 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool" ]
00048 gen.GenName = "Bang Bang"
00049 gen.Location = "/Event/Gen/HepMCEvents"
00050
00051
00052 gendump = app.algorithm("GenDump")
00053 gendump.Location = "/Event/Gen/HepMCEvents"
00054
00055
00056
00057 app.ExtSvc += ["GiGa"]
00058
00059 modularPL = app.property("GiGa.GiGaPhysListModular")
00060 modularPL.OutputLevel = 0
00061 modularPL.CutForElectron = 100*units.micrometer
00062 modularPL.CutForPositron = 100*units.micrometer
00063 modularPL.CutForGamma = 1*units.millimeter
00064 modularPL.PhysicsConstructors = [
00065 "DsPhysConsGeneral",
00066 "DsPhysConsOptical"
00067 ]
00068
00069 giga = app.service("GiGa")
00070 giga.OutputLevel = 0
00071 giga.PhysicsList = "GiGaPhysListModular"
00072
00073 gggeo = app.service("GiGaGeo")
00074 gggeo.OutputLevel = 0
00075 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00076 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00077 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00078
00079
00080 ggrm = app.property("GiGa.GiGaMgr")
00081 ggrm.Verbosity = 0
00082 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00083 event_ac_cmds.BeginOfEventCommands = [
00084 "/control/verbose 0",
00085 "/run/verbose 0",
00086 "/event/verbose 0",
00087 "/tracking/verbose 0",
00088 "/geometry/navigator/verbose 0"
00089 ]
00090 giga.EventAction = "GiGaEventActionCommand"
00091
00092
00093 app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00094 simseq = app.algorithm("SimSeq")
00095 simseq.Members = [ "GiGaInputStream/GGInStream" ]
00096
00097 ggin = app.algorithm("GGInStream")
00098 ggin.OutputLevel = 0
00099 ggin.ExecuteOnce = True
00100 ggin.ConversionSvcName = "GiGaGeo"
00101 ggin.DataProviderSvcName = "DetectorDataSvc"
00102 ggin.StreamItems = [
00103 "/dd/Structure/Sites/la-rock",
00104
00105 ]
00106
00107 simseq.Members += [ "DetSimProc/DetSim" ]
00108 ds = app.algorithm("DetSim")
00109 ds.OutputLevel = 1
00110 ds.Converter = "HepMCtoG4"
00111
00112
00113 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00114 pmtsd.OutputLevel = 0
00115
00116 return
00117
00118 if '__main__' == __name__:
00119 import os
00120 loc = os.getenv('XMLDETDESCROOT')
00121 if not loc:
00122 raise RuntimeError,"Location of DetDesc XML file not specified"
00123 loc += "/DDDB/dayabay.xml"
00124
00125 from GaudiPython import AppMgr
00126 app = AppMgr()
00127 app.EvtSel = "NONE"
00128
00129 print "\tBuilding detector\n"
00130 import xmldetdesc
00131 xddc = xmldetdesc.XmlDetDescConfig(loc=loc)
00132
00133
00134 gtc = MyGenToolsConfig(volume="/dd/Structure/AD/la-oil2")
00135
00136 app.run(2)
00137