00001
00002 from GaudiPython import AppMgr
00003 from GaudiKernel import SystemOfUnits as units
00004
00005 import os,sys
00006
00007 print "\tBuilding detector\n"
00008 import xmldetdesc
00009 xmldetdesc.config()
00010
00011 app = AppMgr()
00012 app.TopAlg = []
00013 app.EvtSel = "NONE"
00014
00015 import GaudiPython as gp
00016
00017 iapp = gp.iService("ApplicationMgr")
00018 iapp.SvcMapping = [
00019 'EvtDataSvc/EventDataArchiveSvc',
00020 'DybDataSvc/EventDataSvc',
00021
00022 "DetDataSvc/DetectorDataSvc",
00023 "HistogramSvc/HistogramDataSvc",
00024 "HbookCnv::PersSvc/HbookHistSvc",
00025 "RootHistCnv::PersSvc/RootHistSvc",
00026 "EvtPersistencySvc/EventPersistencySvc",
00027 "DetPersistencySvc/DetectorPersistencySvc",
00028 "HistogramPersistencySvc/HistogramPersistencySvc",
00029 ]
00030
00031
00032 app.TopAlg = ["GiGaInputStream/GGInStream",
00033 'Sim15',
00034 ]
00035
00036 StageKin=app.property("ToolSvc.Kinematic")
00037 StageKin.Sequencer='GnrtrSeq'
00038 GenSeq=app.property('GnrtrSeq')
00039 GenSeq.Members = ["Gnrtr/Gen1"]
00040
00041 StageDet=app.property("ToolSvc.Detector")
00042 StageDet.Sequencer='DetSimSeq'
00043 DSSeq=app.property('DetSimSeq')
00044 DSSeq.Members = ['DetSimProc']
00045
00046 StageElec=app.property("ToolSvc.Electronic")
00047 StageElec.Sequencer='ElecSimSeq'
00048 ESSeq=app.property('ElecSimSeq')
00049 ESSeq.Members = ['ElecSimProc']
00050
00051 StageTrig=app.property("ToolSvc.Trigger")
00052 StageTrig.Sequencer='TrigSimSeq'
00053 TSSeq=app.property('TrigSimSeq')
00054 TSSeq.Members = ['TrigReadProc']
00055
00056 StageSingle=app.property("ToolSvc.SingleLoader")
00057 StageSingle.Sequencer='SingleSeq'
00058 SingleSeq=app.property('SingleSeq')
00059 SingleSeq.Members = ['SingleLoader']
00060
00061
00062
00063 gen=app.algorithm('Gen1')
00064 gen.ThisStageName='Kinematic'
00065 gen.LowerStageName=''
00066
00067
00068 sim=app.algorithm('DetSimProc')
00069 sim.ThisStageName='Detector'
00070 sim.LowerStageName='Kinematic'
00071
00072
00073 elec=app.algorithm('ElecSimProc')
00074 elec.ThisStageName='Electronic'
00075 elec.LowerStageName='Detector'
00076
00077
00078 trig=app.algorithm('TrigReadProc')
00079 trig.ThisStageName='Trigger'
00080 trig.LowerStageName='Electronic'
00081
00082
00083 singll=app.algorithm('SingleLoader')
00084 singll.ThisStageName='SingleLoader'
00085 singll.LowerStageName='Trigger'
00086
00087
00088
00089 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ]
00090 gen.GenName = "ticktack"
00091
00092 gen.OutputLevel=2
00093
00094 volume = "/dd/Structure/AD/far-lso2"
00095
00096
00097 tim = app.property("ToolSvc.GtTimeratorTool")
00098 tim.LifeTime = int(20000*units.nanosecond)
00099 tim.Distribution = "Uniform"
00100
00101 tim.OutputLevel=2
00102
00103
00104 poser = app.property("ToolSvc.GtPositionerTool")
00105
00106 poser.Strategy = "FullVolume"
00107 poser.Volume = volume
00108 poser.Mode = "Fixed"
00109
00110
00111 poser.Spread = 2.6*units.meter
00112 poser.Position = [0,0,2.5*units.meter]
00113
00114
00115 gun = app.property("ToolSvc.GtGunGenTool")
00116
00117 gun.ParticlesPerEvent = 1
00118 gun.ParticleName = "e-"
00119
00120 gun.Momentum = 2*units.MeV
00121 gun.MomentumMode = "Smeared"
00122
00123
00124 gun.MomentumSpread = 1.0*units.MeV
00125
00126 gun.DirectionMode = "Uniform"
00127
00128
00129
00130
00131 gun.Direction = [ 1, 0, 0 ]
00132 gun.DirectionSpread = 3
00133 print 'gun.Direction=',gun.Direction
00134
00135 trans = app.property("ToolSvc.GtTransformTool")
00136 trans.Volume = volume
00137
00138
00139
00140 app.ExtSvc += ["GiGa"]
00141 modularPL = app.property("GiGa.GiGaPhysListModular")
00142
00143 modularPL.CutForElectron = 100*units.micrometer
00144 modularPL.CutForPositron = 100*units.micrometer
00145 modularPL.CutForGamma = 1*units.millimeter
00146 modularPL.PhysicsConstructors = [
00147 "DsPhysConsGeneral",
00148 "DsPhysConsOptical",
00149 "DsPhysConsEM",
00150
00151
00152
00153 ]
00154
00155 optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00156
00157
00158
00159 optical.CerenPhotonScaleWeight=4.0
00160 optical.ScintPhotonScaleWeight=4.0
00161
00162 giga = app.service("GiGa")
00163 giga.OutputLevel = 4
00164 giga.PhysicsList = "GiGaPhysListModular"
00165
00166 gggeo = app.service("GiGaGeo")
00167 gggeo.OutputLevel = 3
00168 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00169 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00170 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00171
00172 giga.SteppingAction = "GiGaStepActionSequence"
00173 stepseq = app.property("GiGa.GiGaStepActionSequence")
00174 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00175
00176
00177 ggrm = app.property("GiGa.GiGaMgr")
00178 ggrm.Verbosity = 0
00179 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00180 verbosity_cmds = [
00181 "/control/verbose 0",
00182 "/run/verbose 0",
00183 "/event/verbose 2",
00184 "/tracking/verbose 2",
00185 "/geometry/navigator/verbose 0"
00186 ]
00187 silent_cmds = [
00188 "/particle/property/verbose 0",
00189 "/control/verbose 0",
00190 "/run/verbose 0",
00191 "/event/verbose 0",
00192 "/tracking/verbose 0",
00193 "/geometry/navigator/verbose 0"
00194 ]
00195
00196 event_ac_cmds.BeginOfEventCommands = silent_cmds
00197 giga.EventAction = "GiGaEventActionCommand"
00198
00199
00200 ggin = app.algorithm("GGInStream")
00201
00202
00203 ggin.ExecuteOnce = True
00204 ggin.ConversionSvcName = "GiGaGeo"
00205 ggin.DataProviderSvcName = "DetectorDataSvc"
00206
00207 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00208 "/dd/Geometry/AdDetails/AdSurfacesAll",
00209 "/dd/Geometry/AdDetails/AdSurfacesFar",
00210 "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00211 "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00212 ]
00213
00214
00215 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00216 pmtsd.OutputLevel = 4
00217
00218 sim.Converter = "HepMCtoG4"
00219
00220 sim.OutputLevel=2
00221
00222
00223
00224 elec.PmtTool = 'EsIdealPulseTool'
00225 elec.RpcTool = 'EsIdealPulseTool'
00226 elec.FeeTool = 'EsIdealFeeTool'
00227 elec.FecTool = 'EsIdealFecTool'
00228 elec.OutputLevel=2
00229
00230
00231 trig.TrigTools=['TsMultTriggerTool']
00232 trig.RoTools=['ROsFeeReadoutTool',
00233
00234 ]
00235 trig.OutputLevel=2
00236 nhits=app.property("ToolSvc.TsMultTriggerTool")
00237 nhits.OutputLevel=2
00238 fee=app.property("ToolSvc.ROsFeePeakOnlyTool")
00239
00240
00241
00242
00243
00244
00245 singll.OutputLevel=2
00246
00247
00248 eds=app.service("EventDataSvc")
00249 eds.ForceLeaves=True
00250
00251
00252 app.EvtMax = 10
00253 app.EvtSel ="NONE"
00254
00255
00256 sim15=app.algorithm('Sim15')
00257
00258
00259
00260
00261 sim15.TopStage='SingleLoader'
00262 sim15.OutputLevel=2
00263
00264 histsvc = app.service("THistSvc")
00265
00266
00267 msv = app.service('MessageSvc')
00268 msv.OutputLevel = 3
00269 app.initialize()
00270 app.run( app.EvtMax )
00271 app.exit()