00001
00002
00003 import sys
00004 try:
00005 io = sys.argv[1]
00006 except IndexError:
00007 io = "output"
00008 input = False
00009 if "input" == io: input = True
00010
00011 output = not input
00012 use_aes = True
00013
00014 import GaudiPython as gp
00015
00016 if use_aes:
00017
00018 iapp = gp.iService("ApplicationMgr")
00019 iapp.SvcMapping = [
00020 'EvtDataSvc/EventDataArchiveSvc',
00021 'DybDataSvc/EventDataSvc',
00022
00023 "DetDataSvc/DetectorDataSvc",
00024 "HistogramSvc/HistogramDataSvc",
00025 "HbookCnv::PersSvc/HbookHistSvc",
00026 "RootHistCnv::PersSvc/RootHistSvc",
00027 "EvtPersistencySvc/EventPersistencySvc",
00028 "DetPersistencySvc/DetectorPersistencySvc",
00029 "HistogramPersistencySvc/HistogramPersistencySvc",
00030 ]
00031
00032
00033 if not input:
00034 import xmldetdesc
00035 xmldetdesc.config()
00036
00037 app = gp.AppMgr(outputlevel=3)
00038
00039 msg = app.service("MessageSvc")
00040 msg.Format = "\--%-F%40W%S%7W%R%T %23W%t\n \-> %0W%M"
00041
00042 msg.useColors = True
00043 msg.fatalColorCode=['red','white']
00044 msg.errorColorCode=['red']
00045 msg.warningColorCode=['yellow']
00046 msg.debugColorCode=['blue']
00047 msg.verboseColorCode=['cyan']
00048
00049
00050 app.EvtMax = 1
00051 if input:
00052 app.EvtSel =""
00053 else:
00054 app.EvtSel = "NONE"
00055
00056 if input:
00057
00058 app.ExtSvc += [ "DybEvtSelector/EventSelector" ]
00059 if output:
00060 app.ExtSvc += [ "DybStorageSvc" ]
00061 dss = app.service("DybStorageSvc")
00062 dss.OutputLevel = 1
00063
00064 app.ExtSvc += [ "RootIOCnvSvc" ]
00065
00066 per = app.service("EventPersistencySvc")
00067 per.CnvServices = [ "RootIOCnvSvc" ];
00068
00069 eds = app.service("EventDataService")
00070 eds.OutputLevel = 1
00071
00072 rio = app.property("RootIOCnvSvc")
00073 rio.OutputLevel = 1
00074
00075 iomap = { "default": "trigiotest.root" };
00076
00077 if input:
00078 rio.InputStreams = iomap
00079 if output:
00080 rio.OutputStreams = iomap
00081
00082 app.TopAlg = [ ]
00083
00084
00085 if not input:
00086 import xmldetdesc
00087 xmldetdesc.config()
00088
00089 volume = "/dd/Structure/AD/far-oil2"
00090
00091
00092 import GaudiKernel.SystemOfUnits as units
00093 tim = app.property("ToolSvc.GtTimeratorTool")
00094 tim.LifeTime = int(1*units.second)
00095
00096
00097 poser = app.property("ToolSvc.GtPositionerTool")
00098 poser.Volume = volume
00099 poser.Mode = "Fixed"
00100 poser.Position = [0,0,0]
00101
00102
00103 gun = app.property("ToolSvc.GtGunGenTool")
00104 gun.ParticlesPerEvent = 1
00105 gun.ParticleName = "e+"
00106 gun.Momentum = 3*units.MeV
00107 gun.MomentumMode = "Fixed"
00108 gun.DirectionMode = "Fixed"
00109 gun.Direction = [ 1,0,0 ]
00110
00111
00112 trans = app.property("ToolSvc.GtTransformTool")
00113 trans.Volume = volume
00114
00115 app.TopAlg += [ 'GtGenerator/gen' ]
00116 gen = app.algorithm("gen")
00117 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ]
00118 gen.GenName = "Bang Bang"
00119 pass
00120
00121
00122 if not input:
00123 modularPL = app.property("GiGa.GiGaPhysListModular")
00124
00125 modularPL.CutForElectron = 100*units.micrometer
00126 modularPL.CutForPositron = 100*units.micrometer
00127 modularPL.CutForGamma = 1*units.millimeter
00128 modularPL.PhysicsConstructors = [
00129 "DsPhysConsGeneral",
00130 "DsPhysConsOptical",
00131 "DsPhysConsEM",
00132
00133
00134
00135 ]
00136 optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00137
00138
00139
00140 giga = app.service("GiGa")
00141
00142 giga.PhysicsList = "GiGaPhysListModular"
00143 giga.SteppingAction = "GiGaStepActionSequence"
00144 stepseq = app.property("GiGa.GiGaStepActionSequence")
00145 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00146
00147 params = {
00148 'start' :"(start > 0)",
00149 'track1':"(id==1 and ProcessType==1)",
00150 'track2':"(id==2 and ProcessType==1)",
00151 'GD': "MaterialName == '/dd/Materials/GdDopedLS'",
00152 'LS': "MaterialName == '/dd/Materials/LiquidScintillator'",
00153 'oil': "MaterialName == '/dd/Materials/MineralOil'",
00154 'iAV': "MaterialName == '/dd/Materials/Acrylic'",
00155 'oAV': "MaterialName == '/dd/Materials/Acrylic'"
00156 }
00157 unobs = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction")
00158 unobs.Stats=[
00159 ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00160 ["t_Trk1", "t" , "%(track1)s and %(start)s"%params],
00161 ["x_Trk1", "lx", "%(track1)s and %(start)s"%params],
00162 ["y_Trk1", "ly", "%(track1)s and %(start)s"%params],
00163 ["z_Trk1", "lz", "%(track1)s and %(start)s"%params],
00164 ["e_Trk1", "E", "%(track1)s and %(start)s"%params],
00165 ["p_Trk1", "p", "%(track1)s and %(start)s"%params],
00166 ["ke_Trk1", "KE", "%(track1)s and %(start)s"%params],
00167 ["vx_Trk1", "lvx","%(track1)s and %(start)s"%params],
00168 ["vy_Trk1", "lvy","%(track1)s and %(start)s"%params],
00169 ["vz_Trk1", "lvz","%(track1)s and %(start)s"%params],
00170 ["TrkLength_GD_Trk1", "dx","%(track1)s and %(GD)s"%params],
00171 ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(iAV)s"%params],
00172 ["TrkLength_LS_Trk1", "dx","%(track1)s and %(LS)s"%params],
00173 ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(oAV)s"%params],
00174 ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(oil)s"%params],
00175
00176 ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00177 ["t_Trk2", "t" , "%(track2)s and %(start)s"%params],
00178 ["x_Trk2", "lx", "%(track2)s and %(start)s"%params],
00179 ["y_Trk2", "ly", "%(track2)s and %(start)s"%params],
00180 ["z_Trk2", "lz", "%(track2)s and %(start)s"%params],
00181 ["e_Trk2", "E", "%(track2)s and %(start)s"%params],
00182 ["p_Trk2", "p", "%(track2)s and %(start)s"%params],
00183 ["ke_Trk2", "KE", "%(track2)s and %(start)s"%params],
00184 ["vx_Trk2", "lvx","%(track2)s and %(start)s"%params],
00185 ["vy_Trk2", "lvy","%(track2)s and %(start)s"%params],
00186 ["vz_Trk2", "lvz","%(track2)s and %(start)s"%params],
00187 ["TrkLength_GD_Trk2", "dx","%(track2)s and %(GD)s"%params],
00188 ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(iAV)s"%params],
00189 ["TrkLength_LS_Trk2", "dx","%(track2)s and %(LS)s"%params],
00190 ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(oAV)s"%params],
00191 ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(oil)s"%params]
00192 ]
00193
00194 gggeo = app.service("GiGaGeo")
00195
00196 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00197 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00198 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00199 app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00200 simseq = app.algorithm("SimSeq")
00201 simseq.Members = [ "GiGaInputStream/GGInStream" ]
00202
00203 ggin = app.algorithm("GGInStream")
00204
00205 ggin.ExecuteOnce = True
00206 ggin.ConversionSvcName = "GiGaGeo"
00207 ggin.DataProviderSvcName = "DetectorDataSvc"
00208 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00209 "/dd/Geometry/AdDetails/AdSurfacesAll",
00210 "/dd/Geometry/AdDetails/AdSurfacesFar",
00211 "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00212 "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00213 ]
00214
00215 simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00216 push = app.algorithm("PushKine")
00217 push.Converter = "HepMCtoG4"
00218
00219 pull = app.algorithm("PullEvent")
00220
00221
00222
00223 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00224
00225 pass
00226
00227
00228 if not input:
00229 app.TopAlg += [ "GaudiSequencer/ElecSeq" ]
00230 simseq = app.algorithm("ElecSeq")
00231 simseq.Members = [ "EsFrontEndAlg/FeeAlg" ]
00232 feeAlg = app.algorithm("FeeAlg")
00233 feeAlg.OutputLevel=3
00234 pass
00235
00236
00237 if not input:
00238 mtool=app.property("ToolSvc.TsMultTriggerTool")
00239 mtool.OutputLevel=3
00240
00241 app.TopAlg += [ "TsTriggerAlg/trig" ]
00242 trig=app.algorithm("trig")
00243 trig.OutputLevel=3
00244 trig.TrigTools=["TsMultTriggerTool"]
00245 pass
00246
00247 if input:
00248 rioes = app.service("RootIOEvtSelector")
00249 rioes.OutputLevel = 1
00250
00251 app.TopAlg += [ 'RegSeqDumpAlg/rsd' ]
00252 rsd = app.algorithm("rsd")
00253 rsd.OutputLevel = 1
00254
00255 if output:
00256 app.TopAlg += [ 'DybStoreAlg/dsa' ]
00257 dsa = app.algorithm("dsa")
00258 dsa.OutputLevel = 1
00259
00260
00261 app.initialize()
00262 app.run(app.EvtMax)