00001
00002
00003 from GaudiPython import AppMgr
00004 from GaudiKernel import SystemOfUnits as units
00005
00006 import os,sys
00007
00008 print "\tBuilding detector\n"
00009 import xmldetdesc
00010 xmldetdesc.config()
00011
00012 from GaudiPython import AppMgr
00013 app = AppMgr()
00014 app.TopAlg = []
00015 app.EvtSel = "NONE"
00016
00017 eds=app.service("EventDataSvc")
00018 eds.ForceLeaves=True
00019
00020 volume = "/dd/Structure/AD/far-oil2"
00021
00022
00023 tim = app.property("ToolSvc.GtTimeratorTool")
00024 tim.LifeTime = int(1*units.second)
00025
00026
00027 poser = app.property("ToolSvc.GtPositionerTool")
00028
00029 poser.Strategy = "FullVolume"
00030 poser.Volume = volume
00031 poser.Mode = "Fixed"
00032
00033
00034 poser.Position = [0,0,5.0/16.0*units.meter]
00035
00036
00037 gun = app.property("ToolSvc.GtGunGenTool")
00038
00039 gun.ParticlesPerEvent = 1
00040 gun.ParticleName = "opticalphoton"
00041
00042 gun.Momentum = 2.5*units.eV
00043 gun.MomentumMode = "Fixed"
00044
00045 gun.MomentumSpread = 1*units.eV
00046 gun.DirectionMode = "Uniform"
00047 gun.DirectionSpread = 2
00048
00049
00050
00051
00052
00053 gun.Direction = [ 1, 0, 0 ]
00054 print 'gun.Direction=',gun.Direction
00055
00056 trans = app.property("ToolSvc.GtTransformTool")
00057 trans.Volume = volume
00058
00059
00060 app.TopAlg += [ "GaudiSequencer/GenSeq" ]
00061 genseq = app.algorithm("GenSeq")
00062 genseq.Members = [ "GtGenerator/GenAlg", "GtHepMCDumper/GenDump" ]
00063
00064
00065 gen = app.algorithm("GenAlg")
00066
00067 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ]
00068 gen.GenName = "Bang Bang"
00069
00070
00071
00072 gendump = app.algorithm("GenDump")
00073
00074
00075 app.ExtSvc += ["GiGa"]
00076
00077 modularPL = app.property("GiGa.GiGaPhysListModular")
00078
00079 modularPL.CutForElectron = 100*units.micrometer
00080 modularPL.CutForPositron = 100*units.micrometer
00081 modularPL.CutForGamma = 1*units.millimeter
00082 modularPL.PhysicsConstructors = [
00083 "DsPhysConsGeneral",
00084 "DsPhysConsOptical",
00085 "DsPhysConsEM",
00086
00087
00088
00089 ]
00090
00091
00092 optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00093
00094
00095
00096
00097 giga = app.service("GiGa")
00098 giga.OutputLevel = 1
00099 giga.PhysicsList = "GiGaPhysListModular"
00100
00101 gggeo = app.service("GiGaGeo")
00102 gggeo.OutputLevel = 1
00103 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00104 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00105 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00106
00107 giga.SteppingAction = "GiGaStepActionSequence"
00108 stepseq = app.property("GiGa.GiGaStepActionSequence")
00109 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00110
00111
00112 TH2DE="TH2DE"
00113
00114 historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction")
00115 historian.TouchableToDetelem = TH2DE
00116
00117 params = {
00118 'start' :"(start > 0)",
00119 'track1':"(id==1 and ProcessType==1)",
00120 'track2':"(id==2 and ProcessType==1)",
00121 'GD': "MaterialName == '/dd/Materials/GdDopedLS'",
00122 'LS': "MaterialName == '/dd/Materials/LiquidScintillator'",
00123 'oil': "MaterialName == '/dd/Materials/MineralOil'",
00124 'iAV': "MaterialName == '/dd/Materials/Acrylic'",
00125 'oAV': "MaterialName == '/dd/Materials/Acrylic'"
00126 }
00127
00128 Historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction");
00129 Historian.TrackSelection = "(start!=12)"
00130
00131
00132
00133 unobs = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction")
00134 unobs.TouchableToDetelem = TH2DE
00135 unobs.Stats=[
00136
00137 ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00138 ["t_Trk1", "t" , "%(track1)s and %(start)s"%params],
00139 ["x_Trk1", "x", "%(track1)s and %(start)s"%params],
00140 ["y_Trk1", "y", "%(track1)s and %(start)s"%params],
00141 ["z_Trk1", "z", "%(track1)s and %(start)s"%params],
00142 ["e_Trk1", "E", "%(track1)s and %(start)s"%params],
00143 ["p_Trk1", "p", "%(track1)s and %(start)s"%params],
00144 ["ke_Trk1", "KE", "%(track1)s and %(start)s"%params],
00145 ["vx_Trk1", "lvx","%(track1)s and %(start)s"%params],
00146 ["vy_Trk1", "lvy","%(track1)s and %(start)s"%params],
00147 ["vz_Trk1", "lvz","%(track1)s and %(start)s"%params],
00148 ["TrkLength_GD_Trk1", "dx","%(track1)s and %(GD)s"%params],
00149 ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(iAV)s"%params],
00150 ["TrkLength_LS_Trk1", "dx","%(track1)s and %(LS)s"%params],
00151 ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(oAV)s"%params],
00152 ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(oil)s"%params],
00153
00154 ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00155 ["t_Trk2", "t" , "%(track2)s and %(start)s"%params],
00156 ["x_Trk2", "x", "%(track2)s and %(start)s"%params],
00157 ["y_Trk2", "y", "%(track2)s and %(start)s"%params],
00158 ["z_Trk2", "z", "%(track2)s and %(start)s"%params],
00159 ["e_Trk2", "E", "%(track2)s and %(start)s"%params],
00160 ["p_Trk2", "p", "%(track2)s and %(start)s"%params],
00161 ["ke_Trk2", "KE", "%(track2)s and %(start)s"%params],
00162 ["vx_Trk2", "lvx","%(track2)s and %(start)s"%params],
00163 ["vy_Trk2", "lvy","%(track2)s and %(start)s"%params],
00164 ["vz_Trk2", "lvz","%(track2)s and %(start)s"%params],
00165 ["TrkLength_GD_Trk2", "dx","%(track2)s and %(GD)s"%params],
00166 ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(iAV)s"%params],
00167 ["TrkLength_LS_Trk2", "dx","%(track2)s and %(LS)s"%params],
00168 ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(oAV)s"%params],
00169 ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(oil)s"%params]
00170 ]
00171
00172
00173 eds=app.service("EventDataSvc")
00174 eds.ForceLeaves=True
00175
00176
00177
00178
00179 ggrm = app.property("GiGa.GiGaMgr")
00180 ggrm.Verbosity = 0
00181 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00182 verbosity_cmds = [
00183 "/control/verbose 0",
00184 "/run/verbose 0",
00185 "/event/verbose 2",
00186 "/tracking/verbose 2",
00187 "/geometry/navigator/verbose 0"
00188 ]
00189 silent_cmds = [
00190 "/control/verbose 0",
00191 "/run/verbose 0",
00192 "/event/verbose 0",
00193 "/tracking/verbose 0",
00194 "/geometry/navigator/verbose 0"
00195 ]
00196
00197 event_ac_cmds.BeginOfEventCommands = silent_cmds
00198 giga.EventAction = "GiGaEventActionCommand"
00199
00200
00201 app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00202 simseq = app.algorithm("SimSeq")
00203 simseq.Members = [ "GiGaInputStream/GGInStream" ]
00204
00205 ggin = app.algorithm("GGInStream")
00206
00207 ggin.ExecuteOnce = True
00208 ggin.ConversionSvcName = "GiGaGeo"
00209 ggin.DataProviderSvcName = "DetectorDataSvc"
00210
00211 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00212 "/dd/Geometry/AdDetails/AdSurfacesAll",
00213 "/dd/Geometry/AdDetails/AdSurfacesFar",
00214 "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00215 "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00216 ]
00217
00218 simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00219 pull = app.algorithm("PullEvent")
00220 pull.OutputLevel = 1
00221 push = app.algorithm("PushKine")
00222 push.Converter = "HepMCtoG4"
00223
00224
00225
00226 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00227 pmtsd.OutputLevel = 4
00228
00229
00230 app.TopAlg += ["DetSimVali"]
00231 vali= app.algorithm("DetSimVali")
00232 vali.OutPutLevel=1
00233
00234 histsvc = app.service("THistSvc")
00235 histsvc.Output =["file1 DATAFILE='../mc_ntuple/photon2.5.root' OPT='RECREATE' TYP='ROOT' "]
00236
00237
00238 app.run(100000)