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

In This Package:

adgun.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 class MyGenToolsConfig:
00004     def __init__(self,volume):
00005         from  GaudiPython import AppMgr
00006         from GaudiKernel import SystemOfUnits as units
00007 
00008         app = AppMgr()
00009         app.TopAlg = []
00010 
00011         # Set up timerator
00012         import GaudiKernel.SystemOfUnits as units
00013         tim = app.property("ToolSvc.GtTimeratorTool")
00014         tim.LifeTime = int(1*units.second)
00015 
00016         # Set up positioner
00017         poser = app.property("ToolSvc.GtPositionerTool")
00018         poser.Volume = volume
00019         poser.Mode = "Fixed"
00020         #poser.Position = [0,0,5.0/16.0*units.meter]
00021         poser.Position = [0,0,0]
00022         poser.OutputLevel = 5
00023 
00024         # Set up gun
00025         gun = app.property("ToolSvc.GtGunGenTool")
00026         gun.OutputLevel = 5
00027         gun.Volume = volume
00028         gun.ParticlesPerEvent = 1
00029         gun.MomentumMode = "Fixed"
00030         gun.DirectionMode = "Fixed"
00031         from math import sin, cos, pi
00032         pmt_column_number = 9
00033         angle = (2*pmt_column_number - 1)*pi/24.0;
00034         gun.Direction = [ cos(angle),sin(angle),0 ] # aim for PMT 
00035         #print 'gun.Direction=',gun.Direction
00036         
00037         # Single optical photon which makes a hit:
00038         #gun.ParticleName = "opticalphoton"
00039         #gun.Momentum = 2.5*units.eV
00040                 
00041         gun.ParticleName = "e+"
00042         gun.Momentum = 1.0*units.MeV
00043         
00044         hepevt = app.property("ToolSvc.GtHepEvtGenTool")
00045         hepevt.HepEvtDataSource = "seeds.dat" #"|InverseBeta.exe -n 1000"
00046         
00047 
00048         app.TopAlg += [ "GaudiSequencer/GenSeq" ]
00049         genseq = app.algorithm("GenSeq")
00050         genseq.Members = [ "GtGenerator/GenAlg", "GtHepMCDumper/GenDump" ]
00051 
00052 
00053         gen = app.algorithm("GenAlg")
00054         gen.OutputLevel = 5
00055         gen.GenName = "Stick 'em up, bub, I got a gun."
00056         gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool" ]
00057         #gen.GenTools = [ "GtHepEvtGenTool", "GtPositionerTool", "GtTimeratorTool" ]
00058         #gen.GenName = "Da Invoise Betah"
00059         gen.Location = "/Event/Gen/HepMCEvents" # this is default anyways
00060 
00061         #print " GtDumper"
00062         gendump = app.algorithm("GenDump")
00063         gendump.Location = "/Event/Gen/HepMCEvents"  # this is default anyways.
00064 
00065         app.ExtSvc += ["GiGa"]
00066 
00067         modularPL = app.property("GiGa.GiGaPhysListModular")
00068         modularPL.OutputLevel = 3
00069         modularPL.CutForElectron = 100*units.micrometer
00070         modularPL.CutForPositron = 100*units.micrometer
00071         modularPL.CutForGamma = 1*units.millimeter
00072         modularPL.PhysicsConstructors = [ 
00073             "DsPhysConsGeneral", 
00074             "DsPhysConsOptical",
00075             "DsPhysConsEM" 
00076             ]
00077 
00078         giga = app.service("GiGa")
00079         giga.OutputLevel = 3
00080         giga.PhysicsList = "GiGaPhysListModular"
00081 
00082         gggeo = app.service("GiGaGeo")
00083         gggeo.OutputLevel = 4
00084         gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00085         gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00086         gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00087 
00088         # Make Geant4 sing!
00089         ggrm = app.property("GiGa.GiGaMgr")
00090         ggrm.Verbosity = 2
00091 
00092         # event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00093         # event_ac_cmds.BeginOfEventCommands = [
00094         #     "/control/verbose 0",
00095         #     "/run/verbose 0",
00096         #     "/event/verbose 0",
00097         #     "/tracking/verbose 0",
00098         #     "/geometry/navigator/verbose 0"
00099         #     ]
00100         #giga.EventAction = "GiGaEventActionCommand"
00101 
00102 
00103         # History!
00104 
00105 
00106 
00107         app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00108         simseq = app.algorithm("SimSeq")
00109         simseq.Members = [ "GiGaInputStream/GGInStream", 
00110                            "DsPushKine/PushKine", 
00111                            "DsPullEvent/PullEvent",
00112                            "DrawHistoryAlg/DrawHistory",
00113                            "DumpUnobservableStatisticsAlg/DumpUnobserved"
00114                           ]
00115 
00116         ggin = app.algorithm("GGInStream")
00117         ggin.OutputLevel = 5
00118         ggin.ExecuteOnce = True
00119         ggin.ConversionSvcName = "GiGaGeo"
00120         ggin.DataProviderSvcName = "DetectorDataSvc"
00121         ggin.StreamItems = [
00122             "/dd/Structure/Sites/la-rock",
00123             #"/dd/Structure/AD/far-ade3",
00124             ]
00125 
00126         #simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00127         push = app.algorithm("PushKine")
00128         push.Converter = "HepMCtoG4"
00129 
00130         # Class name to use is set in DetDesc xml's "sensdet" attribute.
00131         pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00132         pmtsd.OutputLevel = 5  # change to 1 to get TouchableHistory of the hits.
00133         pmtsd.TouchableToDetelem = "TouchableToDetectorElementFast"
00134         
00135         
00136       
00137         giga.SteppingAction = "GiGaStepActionSequence"
00138         stepseq = app.property("GiGa.GiGaStepActionSequence")        
00139         stepseq.Members = [ "HistorianStepAction", "UnObserverStepAction" ]
00140         
00141         Historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction");
00142         Historian.TrackSelection = "pdg != 20022"
00143         Historian.VertexSelection = "all"
00144         
00145         UnObserver = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction")
00146         
00147         # This is the default search path, which doesn't include PMTs (for speed)
00148         UnObserver.DetectorElementSearchPath = [
00149           "/dd/Structure/DayaBay"
00150          ,"/dd/Structure/Sites"
00151         # ,"/dd/Structure/Pool"
00152          ,"/dd/Structure/AD"
00153         # ,"/dd/Structure/RPC"
00154         ]
00155         Historian.DetectorElementSearchPath = [
00156            "/dd/Structure/DayaBay"
00157           ,"/dd/Structure/Sites"
00158          # ,"/dd/Structure/Pool"
00159           ,"/dd/Structure/AD"
00160          # ,"/dd/Structure/RPC"
00161          ]
00162 
00163         # These are the default parameters.
00164         UnObserver.Stats = [
00165          [ "MuonTrkLengthInIws", "dx", " (pdg==13 or pdg==-13) and ((Volume == '/dd/Structure/Pool/far-iws' or (Volume == '/dd/Structure/Pool/db-iws' or Volume == '/dd/Structure/Pool/la-iws')) and MaterialName == '/dd/Materials/Water')"]
00166         ]
00167         # UnObserver.Stats = [
00168         #     ["photon_created_energy" , "E" , "StepNumber==1 and pdg==20022" ]
00169         #    ,["photon_backscatter_r" , "local_r" , "pdg==20022 and dAngle >= 90" ]
00170         #    ,["photon_forescatter_r" , "local_r" , "pdg==20022 and (dAngle <= 90 and dAngle > 0)" ]
00171         #    ,["photon_stop_r" ,        "local_r" , "(pdg==20022) and ((IsStopping == 1) and (LogicalVolumeName == '/dd/Geometry/PMT/lvPmtHemi'))" ]
00172         #    ,["pmt_hit" , "t" , "pdg==20022 and (IsStopping == 1 and (LogicalVolumeName=='/dd/Geometry/PMT/lvPmtHemi'))" ]
00173         #    ,["edep-water",  "dE", "pdg!=20022 and (MaterialName == '/dd/Materials/Water')"]
00174         #    ,["edep-oil",    "dE", "pdg!=20022 and (MaterialName == '/dd/Materials/Oil')"]
00175         #    ,["edep-ls",     "dE", "pdg!=20022 and (MaterialName == '/dd/Materials/LiquidScintillator')"]
00176         #    ,["edep-gdls",   "dE", "pdg!=20022 and (MaterialName == '/dd/Materials/GdDopedLS')"]
00177         #    ,["edep-acryilc","dE", "pdg!=20022 and (MaterialName == '/dd/Materials/Acrylic')"]
00178         #    ,["edep-ad1"  ,"dE"  ,"pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==1)"  ]
00179         #    ,["edep-ad2"  ,"dE"  ,"pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==2)"  ]
00180         #    ,["edep-ad3"  ,"dE"  ,"pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==3)"  ]
00181         #    ,["edep-ad4"  ,"dE"  ,"pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==4)"  ]
00182         #    ,["qedep-ad1" ,"qdE" ,"pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==1)"   ]
00183         #    ,["qedep-ad2" ,"qdE" ,"pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==2)"   ]
00184         #    ,["qedep-ad3" ,"qdE" ,"pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==3)"   ]
00185         #    ,["qedep-ad4" ,"qdE" ,"pdg!=20022 and ((MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS') and AD==4)"   ]
00186         #    ,["ad" , "AD" ,
00187         #      "expos" ,"Ex"   ,
00188         #      "eypos" ,"Ey"   ,
00189         #      "ezpos" ,"Ez"   ,
00190         #      "et"    ,"Et"   ,
00191         #      "qexpos" ,"qEx" ,
00192         #      "qeypos" ,"qEy" ,
00193         #      "qezpos" ,"qEz" ,
00194         #      "qet"    ,"qEt" , "(pdg!=20022) and (MaterialName == '/dd/Materials/LiquidScintillator' or MaterialName == '/dd/Materials/GdDopedLS')"  ]
00195         #    ,["mu-path-water", "dx", "(pdg==13 || pdg==-13) and MaterialName == '/dd/Materials/Water'"]
00196         #    ,["mu-path-oil",   "dx", "(pdg==13 || pdg==-13) and MaterialName == '/dd/Materials/Oil'"]
00197         #    ,["mu-path-ls",    "dx", "(pdg==13 || pdg==-13) and MaterialName == '/dd/Materials/LiquidScintillator'"]
00198         #    ,["mu-path-gdls",  "dx", "(pdg==13 || pdg==-13) and MaterialName == '/dd/Materials/GdDopedLS'"]
00199         # ]
00200 
00201         app.algorithm("DrawHistory").do_hits = 0
00202 
00203         return
00204         
00205 
00206 if '__main__' == __name__:
00207     import os
00208     print "\tConfiguring geometry\n"
00209     import xmldetdesc
00210     xmldetdesc.config()
00211  
00212     from GaudiPython import AppMgr
00213     app = AppMgr()
00214     app.EvtSel = "NONE"
00215 
00216     #gtc = MyGenToolsConfig(volume="/dd/Structure/AD/la-oil2")
00217     gtc = MyGenToolsConfig(volume="/dd/Structure/AD/la-gds2")
00218     
00219     app.run(10)
00220     
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:54:53 2011 for Historian by doxygen 1.4.7