00001
00002
00003 print "\tBuilding detector\n"
00004 import xmldetdesc
00005 xmldetdesc.config()
00006
00007 import os,sys
00008 from math import sin, cos, pi
00009 from GaudiPython import AppMgr
00010 from GaudiKernel import SystemOfUnits as units
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/Pool/far-ows"
00021
00022
00023
00024 tim = app.property("ToolSvc.GtTimeratorTool")
00025 tim.LifeTime = int(1*units.second)
00026
00027 usebeam=True
00028
00029 if usebeam:
00030 gen = app.algorithm("GenAlg")
00031
00032 gen.GenTools = [ "GtBeamerTool", "GtTimeratorTool" ]
00033 gen.GenName = "Test Bang"
00034 gen.Location = "/Event/Gen/GenHeader"
00035
00036
00037
00038 ang=45*units.degree
00039 beam = app.property("ToolSvc.GtBeamerTool")
00040
00041 beam.Radius=0.11*units.meter
00042 beam.ParticlesPerEvent = 50000
00043 beam.ParticleName = "opticalphoton"
00044 beam.Momentum = 2.5*units.eV
00045 beam.TargetElement = "/dd/Structure/Pool/far-iws/far-InnFin-wall9-id29"
00046 beam.TargetOffset = [0, 0, 0.056*units.meter]
00047 beam.SourceDirection = [sin(ang),0,-cos(ang)]
00048 beam.SourceDistance = 0.3*units.meter
00049
00050 else:
00051 gen = app.algorithm("GenAlg")
00052 gen.GenTools = [ "GtHepEvtGenTool", "GtTimeratorTool", "GtTransformTool" ]
00053 gen.GenName = "Test Bang"
00054 gen.Location = "/Event/Gen/GenHeader"
00055
00056
00057 hep = app.property("ToolSvc.GtHepEvtGenTool")
00058
00059 hep.HepEvtDataSource="/mnt/scratch/02/dayabay/kevin/NuWa-trunk/dybgaudi/Generators/Muon/Linux-i686/Muon.exe -n 1000 -s DYB -music_dir /mnt/scratch/02/dayabay/kevin/NuWa-trunk/dybgaudi/Generators/Muon/data|"
00060
00061
00062 trans = app.property("ToolSvc.GtTransformTool")
00063 trans.Volume = volume
00064
00065
00066 app.TopAlg += [ "GaudiSequencer/GenSeq" ]
00067 genseq = app.algorithm("GenSeq")
00068 genseq.Members = [ "GtGenerator/GenAlg", "GtHepMCDumper/GenDump" ]
00069
00070
00071 print " GtDumper"
00072 gendump = app.algorithm("GenDump")
00073 gendump.Location = "/Event/Gen/GenHeader"
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
00086
00087
00088
00089 ]
00090
00091
00092
00093
00094
00095 giga = app.service("GiGa")
00096
00097 giga.PhysicsList = "GiGaPhysListModular"
00098
00099 gggeo = app.service("GiGaGeo")
00100
00101 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00102 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00103 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00104
00105 giga.SteppingAction = "GiGaStepActionSequence"
00106 stepseq = app.property("GiGa.GiGaStepActionSequence")
00107 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00108
00109 TH2DE="TH2DE"
00110 historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction")
00111 historian.TouchableToDetelem = TH2DE
00112 historian.TrackSelection="pdg==13 or pdg==-13"
00113
00114
00115 app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction").Stats=[
00116 ["MuonTrkLengthInOws","dx","(pdg==13 or pdg==-13) and MaterialName == '/dd/Materials/OwsWater'"],
00117 ["MuonTrkLengthInIws", "dx", " (pdg==13 or pdg==-13) and MaterialName == '/dd/Materials/IwsWater'"],
00118 ["MuonTrkLengthInLS", "dx", "(pdg==13 or pdg==-13) and MaterialName == '/dd/Materials/LiquidScintillator'"],
00119 ["MuonTrkLengthInGdLS","dx", "(pdg==13 or pdg==-13) and MaterialName == '/dd/Materials/GdDopedLS'"],
00120 ["dEInn","dE", "(pdg!=20022) and MaterialName == '/dd/Materials/IwsWater'"],
00121 ["dEOut","dE", "(pdg!=20022) and MaterialName == '/dd/Materials/OwsWater'"],
00122 ["MuonStop", "dx", "(pdg==13 or pdg==-13) and (IsStopping>0)"],
00123 ]
00124
00125
00126 ggrm = app.property("GiGa.GiGaMgr")
00127 ggrm.Verbosity = 0
00128 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00129 verbosity_cmds = [
00130 "/control/verbose 2",
00131 "/run/verbose 1",
00132 "/event/verbose 2",
00133 "/tracking/verbose 2",
00134 "/geometry/navigator/verbose 2"
00135 ]
00136 quiet_cmds = [
00137 "/control/verbose 0",
00138 "/run/verbose 0",
00139 "/event/verbose 0",
00140 "/tracking/verbose 0",
00141 "/geometry/navigator/verbose 0"
00142 ]
00143 event_ac_cmds.BeginOfEventCommands = quiet_cmds
00144 giga.EventAction = "GiGaEventActionCommand"
00145
00146
00147 app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00148 simseq = app.algorithm("SimSeq")
00149 simseq.Members = [ "GiGaInputStream/GGInStream" ]
00150
00151 ggin = app.algorithm("GGInStream")
00152
00153 ggin.ExecuteOnce = True
00154 ggin.ConversionSvcName = "GiGaGeo"
00155 ggin.DataProviderSvcName = "DetectorDataSvc"
00156 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00157
00158
00159
00160
00161 ]
00162
00163
00164 simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00165 push = app.algorithm("PushKine")
00166 push.Converter = "HepMCtoG4"
00167
00168
00169 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00170
00171
00172
00173 histsvc = app.service("THistSvc")
00174 histsvc.Output =["file1 DATAFILE='beam.root' OPT='RECREATE' TYP='ROOT' "]
00175
00176
00177
00178 app.TopAlg += ["DetSimVali/vHalg"]
00179 vali = app.algorithm("vHalg")
00180 vali.Volume=volume
00181
00182
00183 app.run(1)
00184