| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Beamer.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
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 # Set up timerator
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 #    gen.OutputLevel = 4
00032     gen.GenTools = [ "GtBeamerTool", "GtTimeratorTool" ]
00033     gen.GenName = "Test Bang"
00034     gen.Location = "/Event/Gen/GenHeader" # this is default anyways
00035 
00036 
00037     # Set up beam
00038     ang=45*units.degree
00039     beam = app.property("ToolSvc.GtBeamerTool")
00040     #beam.OutputLevel = 1
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" # this is default anyways
00055 
00056 
00057     hep = app.property("ToolSvc.GtHepEvtGenTool")
00058     #hep.OutputLevel=3
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"  # this is default anyways.
00074 
00075 app.ExtSvc += ["GiGa"]
00076 
00077 modularPL = app.property("GiGa.GiGaPhysListModular")
00078 #modularPL.OutputLevel = 1
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 #    "DsPhysConsElectroNu",
00087 #    "DsPhysConsHadron",
00088 #    "DsPhysConsIon"
00089     ]
00090 #optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00091 #optical.CerenPhotonScaleWeight=3.0
00092 #optical.ScintPhotonScaleWeight=3.0
00093 #optical.UseScintillation = False
00094 
00095 giga = app.service("GiGa")
00096 #giga.OutputLevel = 1
00097 giga.PhysicsList = "GiGaPhysListModular"
00098 
00099 gggeo = app.service("GiGaGeo")
00100 #gggeo.OutputLevel = 1
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"       # TH2DE is the fastest
00110 historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction")
00111 historian.TouchableToDetelem = TH2DE
00112 historian.TrackSelection="pdg==13 or pdg==-13"
00113 #historian.VertexSelection="any"
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 # Make Geant4 sing!
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 #ggin.OutputLevel = 1
00153 ggin.ExecuteOnce = True
00154 ggin.ConversionSvcName = "GiGaGeo"
00155 ggin.DataProviderSvcName = "DetectorDataSvc"
00156 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00157      #                "/dd/Geometry/AdDetails/AdSurfacesAll",
00158      #                "/dd/Geometry/AdDetails/AdSurfacesFar",
00159      #                "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00160      #                "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00161                      ]
00162 
00163 
00164 simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00165 push = app.algorithm("PushKine")
00166 push.Converter = "HepMCtoG4"
00167 
00168 # Class name to use is set in DetDesc xml's "sensdet" attribute.
00169 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00170 #pmtsd.OutputLevel = 1
00171 
00172 
00173 histsvc = app.service("THistSvc")
00174 histsvc.Output =["file1 DATAFILE='beam.root' OPT='RECREATE' TYP='ROOT' "]
00175 
00176 # Add the GenHist algorithm
00177 #app.TopAlg += ["ValiNTuple/vHalg"]
00178 app.TopAlg += ["DetSimVali/vHalg"]
00179 vali = app.algorithm("vHalg")
00180 vali.Volume=volume
00181 #vali.OutPutLevel=1
00182 
00183 app.run(1)
00184     
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:56:26 2011 for DetSimValidation by doxygen 1.4.7