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

In This Package:

poolgun.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 TH2DE="TH2DE"
00004 #TH2DE="TouchableToDetectorElementFast"
00005 spray_photons = True
00006 
00007 
00008 class MyGenToolsConfig:
00009     def __init__(self,volume):
00010         from  GaudiPython import AppMgr
00011         from GaudiKernel import SystemOfUnits as units
00012 
00013         app = AppMgr()
00014         app.TopAlg = []
00015 
00016         # Set up timerator
00017         import GaudiKernel.SystemOfUnits as units
00018         tim = app.property("ToolSvc.GtTimeratorTool")
00019         tim.LifeTime = int(1*units.second)
00020 
00021         # Set up positioner
00022         poser = app.property("ToolSvc.GtPositionerTool")
00023         poser.Volume = volume
00024         poser.Mode = "Fixed"
00025         poser.Position = [0*units.meter,0*units.meter,4.35*units.meter]
00026 #        poser.Position = [0.5*units.meter,1.158*units.meter,-3.5*units.meter]
00027         #poser.OutputLevel = 1
00028 
00029         # Set up gun
00030         gun = app.property("ToolSvc.GtGunGenTool")
00031         #gun.OutputLevel = 1
00032         if spray_photons:
00033             gun.ParticlesPerEvent = 100
00034             gun.ParticleName = "opticalphoton"
00035             gun.Momentum = 2.068*units.eV
00036             gun.PolarizeMode = "Random"
00037         else:
00038             gun.ParticlesPerEvent = 1
00039             gun.ParticleName = "mu+"
00040             gun.Momentum = 10*units.GeV
00041             pass
00042         gun.PolarizeMode="Random"
00043         gun.MomentumMode = "Fixed"
00044         gun.DirectionMode = "Fixed"
00045         gun.Direction = [1,1,0 ]
00046         print 'gun.Direction=',gun.Direction
00047 
00048         trans = app.property("ToolSvc.GtTransformTool")
00049         trans.Volume = volume
00050 
00051         app.TopAlg += [ "GaudiSequencer/GenSeq" ]
00052         genseq = app.algorithm("GenSeq")
00053         genseq.Members = [ "GtGenerator/GenAlg", "GtHepMCDumper/GenDump" ]
00054 
00055 
00056         gen = app.algorithm("GenAlg")
00057         #gen.OutputLevel = 1
00058         gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ]
00059         gen.GenName = "Bang Bang"
00060         gen.Location = "/Event/Gen/GenHeader" # this is default anyways
00061 
00062         #print " GtDumper"
00063         gendump = app.algorithm("GenDump")
00064         gendump.Location = "/Event/Gen/GenHeader"  # this is default anyways.
00065 
00066         app.ExtSvc += ["GiGa"]
00067 
00068         modularPL = app.property("GiGa.GiGaPhysListModular")
00069         #modularPL.OutputLevel = 1
00070         modularPL.CutForElectron = 100*units.micrometer
00071         modularPL.CutForPositron = 100*units.micrometer
00072         modularPL.CutForGamma = 1*units.millimeter
00073         modularPL.PhysicsConstructors = [ 
00074             "DsPhysConsGeneral", 
00075             "DsPhysConsOptical",
00076             "DsPhysConsEM",
00077             #"DsPhysConsElectroNu",
00078             #"DsPhysConsHadron",
00079             #"DsPhysConsIon"
00080             ]
00081 #        optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00082 #        optical.UseScintillation = True
00083 
00084 
00085         giga = app.service("GiGa")
00086         #giga.OutputLevel = 1
00087         giga.PhysicsList = "GiGaPhysListModular"
00088 
00089         gggeo = app.service("GiGaGeo")
00090         #gggeo.OutputLevel = 1
00091         gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00092         gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00093         gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00094 
00095         giga.SteppingAction = "GiGaStepActionSequence"
00096         stepseq = app.property("GiGa.GiGaStepActionSequence")
00097         stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00098 
00099         historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction")
00100         historian.TouchableToDetelem = TH2DE
00101 
00102         params = {
00103             'muonid':"(pdg==13 or pdg==-13)",
00104             'ows':"(MaterialName == '/dd/Materials/Water' and "+\
00105                 "Volume == '/dd/Structure/Pool/far-ows')",
00106             'iws':"(MaterialName == '/dd/Materials/Water' and "+\
00107                 "Volume == '/dd/Structure/Pool/far-iws')",
00108             'lso':"MaterialName == '/dd/Materials/LiquidScintillator'",
00109             'gds':"MaterialName == '/dd/Materials/GdDopedLS'"
00110             }
00111         unobs = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction")
00112         unobs.TouchableToDetelem = TH2DE
00113         unobs.Stats=[
00114             ["MuonTrkLengthInOws","dx","%(muonid)s and %(ows)s"%params],
00115             ["MuonTrkLengthInIws", "dx", "%(muonid)s and %(iws)s"%params],
00116             ["MuonTrkLengthInLS", "dx", "%(muonid)s and %(lso)s"%params],
00117             ["MuonTrkLengthInGdLS","dx", "%(muonid)s and %(gds)s"%params]
00118             ]
00119 
00120 
00121         # Make Geant4 sing!
00122         ggrm = app.property("GiGa.GiGaMgr")
00123         ggrm.Verbosity = 0
00124         event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00125         event_ac_cmds.BeginOfEventCommands = [
00126             "/control/verbose 2",
00127             "/run/verbose 2",
00128             "/event/verbose 2",
00129             "/tracking/verbose 2",
00130             "/geometry/navigator/verbose 2"
00131             ]
00132         giga.EventAction = "GiGaEventActionCommand"
00133 
00134 
00135         app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00136         simseq = app.algorithm("SimSeq")
00137         simseq.Members = [ "GiGaInputStream/GGInStream" ]
00138 
00139         ggin = app.algorithm("GGInStream")
00140         #ggin.OutputLevel = 1
00141         ggin.ExecuteOnce = True
00142         ggin.ConversionSvcName = "GiGaGeo"
00143         ggin.DataProviderSvcName = "DetectorDataSvc"
00144         ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00145                              "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00146                              "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00147                              ]
00148 
00149 
00150         simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00151         push = app.algorithm("PushKine")
00152         push.Converter = "HepMCtoG4"
00153         push.Location = "/Event/Gen/GenHeader"
00154 
00155         pull = app.algorithm("PullEvent")
00156         pull.Location = "/Event/Sim/SimHeader"
00157 
00158         # Class name to use is set in DetDesc xml's "sensdet" attribute.
00159         pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00160         #pmtsd.SensorStructures = [ "/dd/Structure/AdPmtStructure",
00161         #                           "/dd/Structure/PoolPmtStructure" ]
00162         #pmtsd.SensorStructures = [ "/dd/Structure/AdPmtStructure" ]
00163         pmtsd.SensorStructures = [ ]
00164         #pmtsd.OutputLevel = 1
00165         pmtsd.TouchableToDetelem = "TH2DE"
00166         #pmtsd.TouchableToDetelem = "TouchableToDetectorElementFast"
00167 
00168         return
00169 
00170 if '__main__' == __name__:
00171     import os
00172 
00173     print "\tConfiguring geometry\n"
00174     import xmldetdesc
00175     xmldetdesc.config()
00176 
00177     from GaudiPython import AppMgr
00178     app = AppMgr()
00179     app.EvtSel = "NONE"
00180 
00181     eds=app.service("EventDataSvc")
00182     eds.ForceLeaves=True
00183     
00184     #xmldetdesc.dump()
00185 
00186     gtc = MyGenToolsConfig(volume="/dd/Structure/Pool/far-iws")
00187     
00188     app.run(1)
00189     
| 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