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

In This Package:

electron_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 = 0.05*units.meter
00034 poser.Position = [0.05*units.meter, 0.05*units.meter, 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 = "e+"
00041 #gun.Momentum = 6*units.eV   # try to enhance rayleigh scattering
00042 gun.Momentum = 1*units.MeV
00043 gun.MomentumMode = "Fixed"
00044 #gun.MomentumMode = "Smeared"
00045 #gun.MomentumSpread = 1*units.MeV
00046 gun.DirectionMode = "Fixed"
00047 
00048 #from math import sin, cos, pi
00049 #pmt_column_number = 9
00050 #angle = (2*pmt_column_number - 1)*pi/24.0;
00051 #gun.Direction = [ cos(angle),sin(angle),0 ] # aim for PMT 
00052 gun.Direction = [ 1, 0, 0 ] # aim for a PMT
00053 print 'gun.Direction=',gun.Direction
00054 
00055 trans = app.property("ToolSvc.GtTransformTool")
00056 trans.Volume = volume
00057                 
00058 
00059 app.TopAlg += [ "GaudiSequencer/GenSeq" ]
00060 genseq = app.algorithm("GenSeq")
00061 genseq.Members = [ "GtGenerator/GenAlg", "GtHepMCDumper/GenDump" ]
00062 
00063 
00064 gen = app.algorithm("GenAlg")
00065 #gen.OutputLevel = 1
00066 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ]
00067 gen.GenName = "Bang Bang"
00068 #gen.Location = "/Event/Gen/GenHeader" # this is default anyways
00069 
00070 #print " GtDumper"
00071 gendump = app.algorithm("GenDump")
00072 #gendump.Location = "/Event/Gen/GenHeader"  # this is default anyways.
00073 
00074 app.ExtSvc += ["GiGa"]
00075 
00076 modularPL = app.property("GiGa.GiGaPhysListModular")
00077 #modularPL.OutputLevel = 1
00078 modularPL.CutForElectron = 100*units.micrometer
00079 modularPL.CutForPositron = 100*units.micrometer
00080 modularPL.CutForGamma = 1*units.millimeter
00081 modularPL.PhysicsConstructors = [ 
00082     "DsPhysConsGeneral", 
00083     "DsPhysConsOptical",
00084     "DsPhysConsEM",
00085     "DsPhysConsElectroNu",
00086     "DsPhysConsHadron",
00087     "DsPhysConsIon"
00088     ]
00089 
00090 # in DsPhysConsOptical.cc these properties are declared.
00091 optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00092 #
00093 #optical.UseScintillation = False  # false option will kill all optical photons, should be true all the time
00094 #optical.UseRayleigh = True       # enable rayleigh scattering
00095 
00096 giga = app.service("GiGa")
00097 giga.OutputLevel = 1
00098 giga.PhysicsList = "GiGaPhysListModular"
00099 
00100 gggeo = app.service("GiGaGeo")
00101 gggeo.OutputLevel = 1
00102 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00103 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00104 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00105 
00106 giga.SteppingAction = "GiGaStepActionSequence"
00107 stepseq = app.property("GiGa.GiGaStepActionSequence")
00108 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00109 
00110 
00111 TH2DE="TH2DE"       # TH2DE is the fastest
00112 #TH2DE="TouchableToDetectorElementFast"
00113 historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction")
00114 historian.TouchableToDetelem = TH2DE
00115 
00116 params = {
00117     'start' :"(start > 0)",
00118     'track1':"(id==1 and ProcessType==1)",
00119     'track2':"(id==2 and ProcessType==1)",
00120     'GD':    "MaterialName == '/dd/Materials/GdDopedLS'",
00121     'LS':    "MaterialName == '/dd/Materials/LiquidScintillator'",
00122     'oil':   "MaterialName == '/dd/Materials/MineralOil'",
00123     'iAV':   "MaterialName == '/dd/Materials/Acrylic'",
00124     'oAV':   "MaterialName == '/dd/Materials/Acrylic'"
00125     }
00126 unobs = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction")
00127 unobs.TouchableToDetelem = TH2DE
00128 unobs.Stats=[
00129     ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00130     ["t_Trk1",    "t" , "%(track1)s and %(start)s"%params],
00131     ["x_Trk1",    "x", "%(track1)s and %(start)s"%params],
00132     ["y_Trk1",    "y", "%(track1)s and %(start)s"%params],
00133     ["z_Trk1",    "z", "%(track1)s and %(start)s"%params],
00134     ["e_Trk1",    "E",  "%(track1)s and %(start)s"%params],
00135     ["p_Trk1",    "p",  "%(track1)s and %(start)s"%params],
00136     ["ke_Trk1",   "KE", "%(track1)s and %(start)s"%params],
00137     ["vx_Trk1",   "lvx","%(track1)s and %(start)s"%params],
00138     ["vy_Trk1",   "lvy","%(track1)s and %(start)s"%params],
00139     ["vz_Trk1",   "lvz","%(track1)s and %(start)s"%params],
00140     ["TrkLength_GD_Trk1",  "dx","%(track1)s and %(GD)s"%params],
00141     ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(iAV)s"%params],
00142     ["TrkLength_LS_Trk1",  "dx","%(track1)s and %(LS)s"%params],
00143     ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(oAV)s"%params],
00144     ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(oil)s"%params],
00145 # for track 2 now
00146     ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00147     ["t_Trk2",    "t" , "%(track2)s and %(start)s"%params],
00148     ["x_Trk2",    "x", "%(track2)s and %(start)s"%params],
00149     ["y_Trk2",    "y", "%(track2)s and %(start)s"%params],
00150     ["z_Trk2",    "z", "%(track2)s and %(start)s"%params],
00151     ["e_Trk2",    "E",  "%(track2)s and %(start)s"%params],
00152     ["p_Trk2",    "p",  "%(track2)s and %(start)s"%params],
00153     ["ke_Trk2",   "KE", "%(track2)s and %(start)s"%params],
00154     ["vx_Trk2",   "lvx","%(track2)s and %(start)s"%params],
00155     ["vy_Trk2",   "lvy","%(track2)s and %(start)s"%params],
00156     ["vz_Trk2",   "lvz","%(track2)s and %(start)s"%params],
00157     ["TrkLength_GD_Trk2",  "dx","%(track2)s and %(GD)s"%params],
00158     ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(iAV)s"%params],
00159     ["TrkLength_LS_Trk2",  "dx","%(track2)s and %(LS)s"%params],
00160     ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(oAV)s"%params],
00161     ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(oil)s"%params]
00162     ]
00163                                                 
00164 
00165 # Make Geant4 sing!
00166 ggrm = app.property("GiGa.GiGaMgr")
00167 ggrm.Verbosity = 0
00168 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00169 verbosity_cmds = [
00170     "/control/verbose 0",
00171     "/run/verbose 0",
00172     "/event/verbose 2",
00173     "/tracking/verbose 2",
00174     "/geometry/navigator/verbose 0"
00175     ]
00176 silent_cmds = [
00177     "/control/verbose 0",
00178     "/run/verbose 0",
00179     "/event/verbose 0",
00180     "/tracking/verbose 0",
00181     "/geometry/navigator/verbose 0"
00182     ]
00183 
00184 event_ac_cmds.BeginOfEventCommands = silent_cmds
00185 giga.EventAction = "GiGaEventActionCommand"
00186 
00187 
00188 app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00189 simseq = app.algorithm("SimSeq")
00190 simseq.Members = [ "GiGaInputStream/GGInStream" ]
00191 
00192 ggin = app.algorithm("GGInStream")
00193 #ggin.OutputLevel = 1
00194 ggin.ExecuteOnce = True
00195 ggin.ConversionSvcName = "GiGaGeo"
00196 ggin.DataProviderSvcName = "DetectorDataSvc"
00197 #ggin.StreamItems = [ "/dd/Structure/DayaBay", ]
00198 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock", ]
00199 
00200 simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00201 pull = app.algorithm("PullEvent")
00202 pull.OutputLevel = 1 
00203 push = app.algorithm("PushKine")
00204 push.Converter = "HepMCtoG4"
00205 #push.Location = "/Event/Gen/GenHeader" # default anyway
00206 
00207 # Class name to use is set in DetDesc xml's "sensdet" attribute.
00208 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00209 pmtsd.OutputLevel = 4
00210 
00211 # Add the GenHist algorithm
00212 app.TopAlg += ["DetSimVali"]
00213 vali= app.algorithm("DetSimVali")
00214 vali.OutPutLevel=3
00215 
00216 histsvc = app.service("THistSvc")
00217 histsvc.Output =["file1 DATAFILE='../mc_ntuple/elec_gun.root' OPT='RECREATE' TYP='ROOT' "]
00218     
00219 app.run(100)
00220     
| 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