Public Member Functions | |
def | __init__ |
Definition at line 10 of file poolgun.py.
def poolgun::MyGenToolsConfig::__init__ | ( | self, | ||
volume | ||||
) |
Definition at line 11 of file poolgun.py.
00011 : 00012 from GaudiPython import AppMgr 00013 from GaudiKernel import SystemOfUnits as units 00014 from math import sin, cos, pi 00015 00016 app = AppMgr() 00017 app.TopAlg = [] 00018 00019 # Set up timerator 00020 import GaudiKernel.SystemOfUnits as units 00021 tim = app.property("ToolSvc.GtTimeratorTool") 00022 tim.LifeTime = int(1*units.second) 00023 00024 # Set up positioner 00025 poser = app.property("ToolSvc.GtPositionerTool") 00026 poser.Volume = volume 00027 poser.Mode = "Fixed" 00028 if hit_pmt_gap: 00029 angle=pi/24.0 00030 radius=0.0*units.meter 00031 poser.Position = [ radius*cos(angle),radius*sin(angle),0 ] # aim between columns 1 and 2 00032 else: 00033 poser.Position = [0,0,5.1*units.meter] 00034 00035 poser.OutputLevel = 1 00036 00037 # Set up gun 00038 gun = app.property("ToolSvc.GtGunGenTool") 00039 gun.OutputLevel = 1 00040 if particle == "opticalphoton": 00041 gun.ParticlesPerEvent = 10000 00042 gun.ParticleName = "opticalphoton" 00043 gun.Momentum = 2.5*units.eV 00044 gun.PolarizeMode = "Random" 00045 elif particle == "muon": 00046 gun.ParticlesPerEvent = 1 00047 gun.ParticleName = "mu-" 00048 gun.Momentum = 10*units.GeV 00049 pass 00050 else: 00051 gun.ParticlesPerEvent = 1 00052 gun.ParticleName = "e+" 00053 gun.Momentum = 3*units.MeV 00054 pass 00055 gun.MomentumMode = "Fixed" 00056 gun.DirectionMode = "Fixed" 00057 pmt_column_number = 9 00058 if use_correct_pmt_angle: 00059 if hit_pmt_gap: 00060 angle = (2*pmt_column_number)*pi/24.0; 00061 else: 00062 angle = (2*pmt_column_number - 1)*pi/24.0; 00063 gun.Direction = [ cos(angle),sin(angle),0 ] # aim for PMT 00064 else: 00065 if hit_pmt_gap: 00066 angle=pi/24.0 00067 gun.Direction = [ cos(angle),sin(angle),0 ] # aim between columns 1 and 2 00068 else: 00069 gun.Direction = [ 0,0,-1 ] 00070 print 'gun.Direction=',gun.Direction 00071 00072 trans = app.property("ToolSvc.GtTransformTool") 00073 trans.Volume = volume 00074 00075 app.TopAlg += [ "GaudiSequencer/GenSeq" ] 00076 genseq = app.algorithm("GenSeq") 00077 genseq.Members = [ "GtGenerator/GenAlg" ] 00078 00079 gen = app.algorithm("GenAlg") 00080 gen.OutputLevel = 1 00081 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ] 00082 gen.GenName = "Bang Bang" 00083 00084 if particle != "opticalphoton": 00085 print " GtDumper" 00086 genseq.Members += [ "GtHepMCDumper/GenDump" ] 00087 gendump = app.algorithm("GenDump") 00088 gendump.OutputLevel = 1 00089 00090 app.ExtSvc += ["GiGa"] 00091 00092 modularPL = app.property("GiGa.GiGaPhysListModular") 00093 modularPL.OutputLevel = 1 00094 modularPL.CutForElectron = 100*units.micrometer 00095 modularPL.CutForPositron = 100*units.micrometer 00096 modularPL.CutForGamma = 1*units.millimeter 00097 modularPL.PhysicsConstructors = [ 00098 "DsPhysConsGeneral", 00099 "DsPhysConsOptical", 00100 "DsPhysConsEM", 00101 # "DsPhysConsElectroNu", 00102 # "DsPhysConsHadron", 00103 # "DsPhysConsIon" 00104 ] 00105 optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical") 00106 #optical.UseCerenkov = False 00107 #optical.UseScintillation = False 00108 00109 giga = app.service("GiGa") 00110 giga.OutputLevel = 1 00111 giga.PhysicsList = "GiGaPhysListModular" 00112 00113 gggeo = app.service("GiGaGeo") 00114 gggeo.OutputLevel = 1 00115 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer 00116 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer 00117 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer 00118 00119 00120 giga.SteppingAction = "GiGaStepActionSequence" 00121 stepseq = app.property("GiGa.GiGaStepActionSequence") 00122 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"] 00123 00124 historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction") 00125 00126 params = { 00127 'muonid':"(pdg==13 or pdg==-13)", 00128 'ows':"(MaterialName == '/dd/Materials/Water' and "+\ 00129 "Volume == '/dd/Structure/Pool/far-ows')", 00130 'iws':"(MaterialName == '/dd/Materials/Water' and "+\ 00131 "Volume == '/dd/Structure/Pool/far-iws')", 00132 'lso':"MaterialName == '/dd/Materials/LiquidScintillator'", 00133 'gds':"MaterialName == '/dd/Materials/GdDopedLS'" 00134 } 00135 unobs = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction") 00136 unobs.Stats=[ 00137 ["MuonTrkLengthInOws","dx","%(muonid)s and %(ows)s"%params], 00138 ["MuonTrkLengthInIws", "dx", "%(muonid)s and %(iws)s"%params], 00139 ["MuonTrkLengthInLS", "dx", "%(muonid)s and %(lso)s"%params], 00140 ["MuonTrkLengthInGdLS","dx", "%(muonid)s and %(gds)s"%params] 00141 ] 00142 00143 00144 00145 giga.StackingAction="DsOpStackAction" 00146 00147 eds=app.service("EventDataSvc") 00148 eds.ForceLeaves=True 00149 00150 00151 00152 # Make Geant4 sing! 00153 ggrm = app.property("GiGa.GiGaMgr") 00154 ggrm.Verbosity = 0 00155 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand") 00156 event_ac_cmds.BeginOfEventCommands = [ 00157 "/control/verbose 0", 00158 "/run/verbose 0", 00159 "/event/verbose 0", 00160 "/tracking/verbose 0", 00161 "/geometry/navigator/verbose 0" 00162 ] 00163 giga.EventAction = "GiGaEventActionCommand" 00164 00165 00166 app.TopAlg += [ "GaudiSequencer/SimSeq" ] 00167 simseq = app.algorithm("SimSeq") 00168 simseq.Members = [ "GiGaInputStream/GGInStream" ] 00169 00170 ggin = app.algorithm("GGInStream") 00171 ggin.OutputLevel = 1 00172 ggin.ExecuteOnce = True 00173 ggin.ConversionSvcName = "GiGaGeo" 00174 ggin.DataProviderSvcName = "DetectorDataSvc" 00175 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock", 00176 "/dd/Geometry/AdDetails/AdSurfacesAll", 00177 "/dd/Geometry/AdDetails/AdSurfacesFar", 00178 "/dd/Geometry/PoolDetails/FarPoolSurfaces", 00179 "/dd/Geometry/PoolDetails/PoolSurfacesAll", 00180 ] 00181 00182 simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ] 00183 push = app.algorithm("PushKine") 00184 push.Converter = "HepMCtoG4" 00185 00186 pull = app.algorithm("PullEvent") 00187 pull.OutputLevel = 1 00188 00189 # Class name to use is set in DetDesc xml's "sensdet" attribute. 00190 pmtsd = app.property("GiGaGeo.DsPmtSensDet") 00191 pmtsd.OutputLevel = 2 00192 00193 return 00194 if '__main__' == __name__: