00001
00002
00003 TH2DE="TH2DE"
00004
00005 spray_photons = True
00006
00007
00008 class MyGenToolsConfig:
00009 def __init__(self,volume):
00010 from GaudiPython import AppMgr
00011 from GaudiKernel import SystemOfUnits as units
00012
00013 app = AppMgr()
00014 app.TopAlg = []
00015
00016
00017 import GaudiKernel.SystemOfUnits as units
00018 tim = app.property("ToolSvc.GtTimeratorTool")
00019 tim.LifeTime = int(1*units.second)
00020
00021
00022 poser = app.property("ToolSvc.GtPositionerTool")
00023 poser.Volume = volume
00024 poser.Mode = "Fixed"
00025 poser.Position = [0*units.meter,0*units.meter,4.35*units.meter]
00026
00027
00028
00029
00030 gun = app.property("ToolSvc.GtGunGenTool")
00031
00032 if spray_photons:
00033 gun.ParticlesPerEvent = 100
00034 gun.ParticleName = "opticalphoton"
00035 gun.Momentum = 2.068*units.eV
00036 gun.PolarizeMode = "Random"
00037 else:
00038 gun.ParticlesPerEvent = 1
00039 gun.ParticleName = "mu+"
00040 gun.Momentum = 10*units.GeV
00041 pass
00042 gun.PolarizeMode="Random"
00043 gun.MomentumMode = "Fixed"
00044 gun.DirectionMode = "Fixed"
00045 gun.Direction = [1,1,0 ]
00046 print 'gun.Direction=',gun.Direction
00047
00048 trans = app.property("ToolSvc.GtTransformTool")
00049 trans.Volume = volume
00050
00051 app.TopAlg += [ "GaudiSequencer/GenSeq" ]
00052 genseq = app.algorithm("GenSeq")
00053 genseq.Members = [ "GtGenerator/GenAlg", "GtHepMCDumper/GenDump" ]
00054
00055
00056 gen = app.algorithm("GenAlg")
00057
00058 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ]
00059 gen.GenName = "Bang Bang"
00060 gen.Location = "/Event/Gen/GenHeader"
00061
00062
00063 gendump = app.algorithm("GenDump")
00064 gendump.Location = "/Event/Gen/GenHeader"
00065
00066 app.ExtSvc += ["GiGa"]
00067
00068 modularPL = app.property("GiGa.GiGaPhysListModular")
00069
00070 modularPL.CutForElectron = 100*units.micrometer
00071 modularPL.CutForPositron = 100*units.micrometer
00072 modularPL.CutForGamma = 1*units.millimeter
00073 modularPL.PhysicsConstructors = [
00074 "DsPhysConsGeneral",
00075 "DsPhysConsOptical",
00076 "DsPhysConsEM",
00077
00078
00079
00080 ]
00081
00082
00083
00084
00085 giga = app.service("GiGa")
00086
00087 giga.PhysicsList = "GiGaPhysListModular"
00088
00089 gggeo = app.service("GiGaGeo")
00090
00091 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00092 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00093 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00094
00095 giga.SteppingAction = "GiGaStepActionSequence"
00096 stepseq = app.property("GiGa.GiGaStepActionSequence")
00097 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00098
00099 historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction")
00100 historian.TouchableToDetelem = TH2DE
00101
00102 params = {
00103 'muonid':"(pdg==13 or pdg==-13)",
00104 'ows':"(MaterialName == '/dd/Materials/Water' and "+\
00105 "Volume == '/dd/Structure/Pool/far-ows')",
00106 'iws':"(MaterialName == '/dd/Materials/Water' and "+\
00107 "Volume == '/dd/Structure/Pool/far-iws')",
00108 'lso':"MaterialName == '/dd/Materials/LiquidScintillator'",
00109 'gds':"MaterialName == '/dd/Materials/GdDopedLS'"
00110 }
00111 unobs = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction")
00112 unobs.TouchableToDetelem = TH2DE
00113 unobs.Stats=[
00114 ["MuonTrkLengthInOws","dx","%(muonid)s and %(ows)s"%params],
00115 ["MuonTrkLengthInIws", "dx", "%(muonid)s and %(iws)s"%params],
00116 ["MuonTrkLengthInLS", "dx", "%(muonid)s and %(lso)s"%params],
00117 ["MuonTrkLengthInGdLS","dx", "%(muonid)s and %(gds)s"%params]
00118 ]
00119
00120
00121
00122 ggrm = app.property("GiGa.GiGaMgr")
00123 ggrm.Verbosity = 0
00124 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00125 event_ac_cmds.BeginOfEventCommands = [
00126 "/control/verbose 2",
00127 "/run/verbose 2",
00128 "/event/verbose 2",
00129 "/tracking/verbose 2",
00130 "/geometry/navigator/verbose 2"
00131 ]
00132 giga.EventAction = "GiGaEventActionCommand"
00133
00134
00135 app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00136 simseq = app.algorithm("SimSeq")
00137 simseq.Members = [ "GiGaInputStream/GGInStream" ]
00138
00139 ggin = app.algorithm("GGInStream")
00140
00141 ggin.ExecuteOnce = True
00142 ggin.ConversionSvcName = "GiGaGeo"
00143 ggin.DataProviderSvcName = "DetectorDataSvc"
00144 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00145 "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00146 "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00147 ]
00148
00149
00150 simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00151 push = app.algorithm("PushKine")
00152 push.Converter = "HepMCtoG4"
00153 push.Location = "/Event/Gen/GenHeader"
00154
00155 pull = app.algorithm("PullEvent")
00156 pull.Location = "/Event/Sim/SimHeader"
00157
00158
00159 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00160
00161
00162
00163 pmtsd.SensorStructures = [ ]
00164
00165 pmtsd.TouchableToDetelem = "TH2DE"
00166
00167
00168 return
00169
00170 if '__main__' == __name__:
00171 import os
00172
00173 print "\tConfiguring geometry\n"
00174 import xmldetdesc
00175 xmldetdesc.config()
00176
00177 from GaudiPython import AppMgr
00178 app = AppMgr()
00179 app.EvtSel = "NONE"
00180
00181 eds=app.service("EventDataSvc")
00182 eds.ForceLeaves=True
00183
00184
00185
00186 gtc = MyGenToolsConfig(volume="/dd/Structure/Pool/far-iws")
00187
00188 app.run(1)
00189