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

In This Package:

photon_gun.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 from  GaudiPython import AppMgr
00004 from GaudiKernel import SystemOfUnits as units
00005 
00006 import os,sys
00007 
00008 print "\tBuilding detector\n"
00009 import xmldetdesc
00010 xmldetdesc.config()
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/AD/far-oil2"
00021 
00022 # Set up timerator
00023 tim = app.property("ToolSvc.GtTimeratorTool")
00024 tim.LifeTime = int(1*units.second)
00025 
00026 # Set up positioner
00027 poser = app.property("ToolSvc.GtPositionerTool")
00028 #poser.OutputLevel = 1
00029 poser.Strategy = "FullVolume"
00030 poser.Volume = volume
00031 poser.Mode = "Fixed"
00032 #poser.Mode = "Smeared"
00033 #poser.Spread = 1*units.meter
00034 poser.Position = [0,0,5.0/16.0*units.meter]
00035 
00036 # Set up gun
00037 gun = app.property("ToolSvc.GtGunGenTool")
00038 #gun.OutputLevel = 1
00039 gun.ParticlesPerEvent = 1
00040 gun.ParticleName = "opticalphoton"
00041 #gun.Momentum = 6*units.eV   # try to enhance rayleigh scattering
00042 gun.Momentum = 2.5*units.eV
00043 gun.MomentumMode = "Fixed"
00044 #gun.MomentumMode = "Smeared"
00045 gun.MomentumSpread = 1*units.eV
00046 gun.DirectionMode = "Uniform"
00047 gun.DirectionSpread = 2
00048 
00049 #from math import sin, cos, pi
00050 #pmt_column_number = 9
00051 #angle = (2*pmt_column_number - 1)*pi/24.0;
00052 #gun.Direction = [ cos(angle),sin(angle),0 ] # aim for PMT 
00053 gun.Direction = [ 1, 0, 0 ] # aim for a PMT
00054 print 'gun.Direction=',gun.Direction
00055 
00056 trans = app.property("ToolSvc.GtTransformTool")
00057 trans.Volume = volume
00058                 
00059 
00060 app.TopAlg += [ "GaudiSequencer/GenSeq" ]
00061 genseq = app.algorithm("GenSeq")
00062 genseq.Members = [ "GtGenerator/GenAlg", "GtHepMCDumper/GenDump" ]
00063 
00064 
00065 gen = app.algorithm("GenAlg")
00066 #gen.OutputLevel = 1
00067 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ]
00068 gen.GenName = "Bang Bang"
00069 #gen.Location = "/Event/Gen/GenHeader" # this is default anyways
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 
00091 # in DsPhysConsOptical.cc these properties are declared.
00092 optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00093 #
00094 #optical.UseScintillation = False  # false option will kill all optical photons, should be true all the time
00095 #optical.UseRayleigh = True       # enable rayleigh scattering
00096 
00097 giga = app.service("GiGa")
00098 giga.OutputLevel = 1
00099 giga.PhysicsList = "GiGaPhysListModular"
00100 
00101 gggeo = app.service("GiGaGeo")
00102 gggeo.OutputLevel = 1
00103 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00104 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00105 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00106 
00107 giga.SteppingAction = "GiGaStepActionSequence"
00108 stepseq = app.property("GiGa.GiGaStepActionSequence")
00109 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00110 
00111 
00112 TH2DE="TH2DE"       # TH2DE is the fastest
00113 #TH2DE="TouchableToDetectorElementFast"
00114 historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction")
00115 historian.TouchableToDetelem = TH2DE
00116 
00117 params = {
00118     'start' :"(start > 0)",
00119     'track1':"(id==1 and ProcessType==1)",
00120     'track2':"(id==2 and ProcessType==1)",
00121     'GD':    "MaterialName == '/dd/Materials/GdDopedLS'",
00122     'LS':    "MaterialName == '/dd/Materials/LiquidScintillator'",
00123     'oil':   "MaterialName == '/dd/Materials/MineralOil'",
00124     'iAV':   "MaterialName == '/dd/Materials/Acrylic'",
00125     'oAV':   "MaterialName == '/dd/Materials/Acrylic'"
00126         }
00127 
00128 Historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction");
00129 Historian.TrackSelection = "(start!=12)"
00130 #Historian.VertexSelection = ""
00131 
00132 
00133 unobs = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction")
00134 unobs.TouchableToDetelem = TH2DE
00135 unobs.Stats=[
00136    # for track 1
00137     ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00138     ["t_Trk1",    "t" , "%(track1)s and %(start)s"%params],
00139     ["x_Trk1",    "x", "%(track1)s and %(start)s"%params],
00140     ["y_Trk1",    "y", "%(track1)s and %(start)s"%params],
00141     ["z_Trk1",    "z", "%(track1)s and %(start)s"%params],
00142     ["e_Trk1",    "E",  "%(track1)s and %(start)s"%params],
00143     ["p_Trk1",    "p",  "%(track1)s and %(start)s"%params],
00144     ["ke_Trk1",   "KE", "%(track1)s and %(start)s"%params],
00145     ["vx_Trk1",   "lvx","%(track1)s and %(start)s"%params],
00146     ["vy_Trk1",   "lvy","%(track1)s and %(start)s"%params],
00147     ["vz_Trk1",   "lvz","%(track1)s and %(start)s"%params],
00148     ["TrkLength_GD_Trk1",  "dx","%(track1)s and %(GD)s"%params],
00149     ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(iAV)s"%params],    # not fully implemented
00150     ["TrkLength_LS_Trk1",  "dx","%(track1)s and %(LS)s"%params],
00151     ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(oAV)s"%params],    # not fully implemented
00152     ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(oil)s"%params],
00153    # for track 2 now
00154     ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00155     ["t_Trk2",    "t" , "%(track2)s and %(start)s"%params],
00156     ["x_Trk2",    "x", "%(track2)s and %(start)s"%params],
00157     ["y_Trk2",    "y", "%(track2)s and %(start)s"%params],
00158     ["z_Trk2",    "z", "%(track2)s and %(start)s"%params],
00159     ["e_Trk2",    "E",  "%(track2)s and %(start)s"%params],
00160     ["p_Trk2",    "p",  "%(track2)s and %(start)s"%params],
00161     ["ke_Trk2",   "KE", "%(track2)s and %(start)s"%params],
00162     ["vx_Trk2",   "lvx","%(track2)s and %(start)s"%params],
00163     ["vy_Trk2",   "lvy","%(track2)s and %(start)s"%params],
00164     ["vz_Trk2",   "lvz","%(track2)s and %(start)s"%params],
00165     ["TrkLength_GD_Trk2",  "dx","%(track2)s and %(GD)s"%params],
00166     ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(iAV)s"%params],    # not fully implemented
00167     ["TrkLength_LS_Trk2",  "dx","%(track2)s and %(LS)s"%params],
00168     ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(oAV)s"%params],    # not fully implemented
00169     ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(oil)s"%params]
00170     ]
00171 
00172 
00173 eds=app.service("EventDataSvc")
00174 eds.ForceLeaves=True
00175 
00176 
00177 
00178 # Make Geant4 sing!
00179 ggrm = app.property("GiGa.GiGaMgr")
00180 ggrm.Verbosity = 0
00181 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00182 verbosity_cmds = [
00183     "/control/verbose 0",
00184     "/run/verbose 0",
00185     "/event/verbose 2",
00186     "/tracking/verbose 2",
00187     "/geometry/navigator/verbose 0"
00188     ]
00189 silent_cmds = [
00190     "/control/verbose 0",
00191     "/run/verbose 0",
00192     "/event/verbose 0",
00193     "/tracking/verbose 0",
00194     "/geometry/navigator/verbose 0"
00195     ]
00196 
00197 event_ac_cmds.BeginOfEventCommands = silent_cmds
00198 giga.EventAction = "GiGaEventActionCommand"
00199 
00200 
00201 app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00202 simseq = app.algorithm("SimSeq")
00203 simseq.Members = [ "GiGaInputStream/GGInStream" ]
00204 
00205 ggin = app.algorithm("GGInStream")
00206 #ggin.OutputLevel = 1
00207 ggin.ExecuteOnce = True
00208 ggin.ConversionSvcName = "GiGaGeo"
00209 ggin.DataProviderSvcName = "DetectorDataSvc"
00210 #ggin.StreamItems = [ "/dd/Structure/DayaBay", ]
00211 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00212                      "/dd/Geometry/AdDetails/AdSurfacesAll",
00213                      "/dd/Geometry/AdDetails/AdSurfacesFar",
00214                      "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00215                      "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00216                      ]
00217 
00218 simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00219 pull = app.algorithm("PullEvent")
00220 pull.OutputLevel = 1 
00221 push = app.algorithm("PushKine")
00222 push.Converter = "HepMCtoG4"
00223 #push.Location = "/Event/Gen/GenHeader" # default anyway
00224 
00225 # Class name to use is set in DetDesc xml's "sensdet" attribute.
00226 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00227 pmtsd.OutputLevel = 4
00228 
00229 # Add the GenHist algorithm
00230 app.TopAlg += ["DetSimVali"]
00231 vali= app.algorithm("DetSimVali")
00232 vali.OutPutLevel=1
00233 
00234 histsvc = app.service("THistSvc")
00235 histsvc.Output =["file1 DATAFILE='../mc_ntuple/photon2.5.root' OPT='RECREATE' TYP='ROOT' "]
00236 
00237     
00238 app.run(100000)
| 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