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
00021 poser.Position = [0,0,0]
00022 poser.OutputLevel = 5
00023
00024
00025 gun = app.property("ToolSvc.GtGunGenTool")
00026 gun.OutputLevel = 5
00027 gun.Volume = volume
00028 gun.ParticlesPerEvent = 1
00029 gun.MomentumMode = "Fixed"
00030 gun.DirectionMode = "Fixed"
00031 from math import sin, cos, pi
00032 pmt_column_number = 9
00033 angle = (2*pmt_column_number - 1)*pi/24.0;
00034 gun.Direction = [ cos(angle),sin(angle),0 ]
00035
00036
00037
00038
00039
00040
00041 gun.ParticleName = "e+"
00042 gun.Momentum = 1.0*units.MeV
00043
00044 hepevt = app.property("ToolSvc.GtHepEvtGenTool")
00045 hepevt.HepEvtDataSource = "seeds.dat"
00046
00047
00048 app.TopAlg += [ "GaudiSequencer/GenSeq" ]
00049 genseq = app.algorithm("GenSeq")
00050 genseq.Members = [ "GtGenerator/GenAlg", "GtHepMCDumper/GenDump" ]
00051
00052
00053 gen = app.algorithm("GenAlg")
00054 gen.OutputLevel = 5
00055 gen.GenName = "Stick 'em up, bub, I got a gun."
00056 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool" ]
00057
00058
00059 gen.Location = "/Event/Gen/HepMCEvents"
00060
00061
00062 gendump = app.algorithm("GenDump")
00063 gendump.Location = "/Event/Gen/HepMCEvents"
00064
00065 app.ExtSvc += ["GiGa"]
00066
00067 modularPL = app.property("GiGa.GiGaPhysListModular")
00068 modularPL.OutputLevel = 3
00069 modularPL.CutForElectron = 100*units.micrometer
00070 modularPL.CutForPositron = 100*units.micrometer
00071 modularPL.CutForGamma = 1*units.millimeter
00072 modularPL.PhysicsConstructors = [
00073 "DsPhysConsGeneral",
00074 "DsPhysConsOptical",
00075 "DsPhysConsEM"
00076 ]
00077
00078 giga = app.service("GiGa")
00079 giga.OutputLevel = 3
00080 giga.PhysicsList = "GiGaPhysListModular"
00081
00082 gggeo = app.service("GiGaGeo")
00083 gggeo.OutputLevel = 4
00084 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00085 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00086 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00087
00088
00089 ggrm = app.property("GiGa.GiGaMgr")
00090 ggrm.Verbosity = 2
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00108 simseq = app.algorithm("SimSeq")
00109 simseq.Members = [ "GiGaInputStream/GGInStream",
00110 "DsPushKine/PushKine",
00111 "DsPullEvent/PullEvent",
00112 "DrawHistoryAlg/DrawHistory",
00113 "DumpUnobservableStatisticsAlg/DumpUnobserved"
00114 ]
00115
00116 ggin = app.algorithm("GGInStream")
00117 ggin.OutputLevel = 5
00118 ggin.ExecuteOnce = True
00119 ggin.ConversionSvcName = "GiGaGeo"
00120 ggin.DataProviderSvcName = "DetectorDataSvc"
00121 ggin.StreamItems = [
00122 "/dd/Structure/Sites/la-rock",
00123
00124 ]
00125
00126
00127 push = app.algorithm("PushKine")
00128 push.Converter = "HepMCtoG4"
00129
00130
00131 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00132 pmtsd.OutputLevel = 5
00133 pmtsd.TouchableToDetelem = "TouchableToDetectorElementFast"
00134
00135
00136
00137 giga.SteppingAction = "GiGaStepActionSequence"
00138 stepseq = app.property("GiGa.GiGaStepActionSequence")
00139 stepseq.Members = [ "HistorianStepAction", "UnObserverStepAction" ]
00140
00141 Historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction");
00142 Historian.TrackSelection = "pdg != 20022"
00143 Historian.VertexSelection = "all"
00144
00145 UnObserver = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction")
00146
00147
00148 UnObserver.DetectorElementSearchPath = [
00149 "/dd/Structure/DayaBay"
00150 ,"/dd/Structure/Sites"
00151
00152 ,"/dd/Structure/AD"
00153
00154 ]
00155 Historian.DetectorElementSearchPath = [
00156 "/dd/Structure/DayaBay"
00157 ,"/dd/Structure/Sites"
00158
00159 ,"/dd/Structure/AD"
00160
00161 ]
00162
00163
00164 UnObserver.Stats = [
00165 [ "MuonTrkLengthInIws", "dx", " (pdg==13 or pdg==-13) and ((Volume == '/dd/Structure/Pool/far-iws' or (Volume == '/dd/Structure/Pool/db-iws' or Volume == '/dd/Structure/Pool/la-iws')) and MaterialName == '/dd/Materials/Water')"]
00166 ]
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201 app.algorithm("DrawHistory").do_hits = 0
00202
00203 return
00204
00205
00206 if '__main__' == __name__:
00207 import os
00208 print "\tConfiguring geometry\n"
00209 import xmldetdesc
00210 xmldetdesc.config()
00211
00212 from GaudiPython import AppMgr
00213 app = AppMgr()
00214 app.EvtSel = "NONE"
00215
00216
00217 gtc = MyGenToolsConfig(volume="/dd/Structure/AD/la-gds2")
00218
00219 app.run(10)
00220