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

In This Package:

neutron.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-lso2"
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 = "Uniform"
00032 #poser.Mode = "Smeared"
00033 poser.Spread = 2.6*units.meter
00034 poser.Position = [0,0,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 = "n0"
00041 #gun.Momentum = 6*units.eV   # try to enhance rayleigh scattering
00042 gun.Momentum = 5*units.MeV
00043 gun.MomentumMode = "Uniform"
00044 gun.MomentumSpread = 4*units.MeV
00045 
00046 gun.DirectionMode = "Uniform"
00047 #from math import sin, cos, pi
00048 #pmt_column_number = 9
00049 #angle = (2*pmt_column_number - 1)*pi/24.0;
00050 #gun.Direction = [ cos(angle),sin(angle),0 ] # aim for PMT 
00051 gun.Direction = [ 1, 0, 0 ] # aim for a PMT
00052 gun.DirectionSpread = 3
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 optical.CerenPhotonScaleWeight=4.0  # scale photon yield down and scale QE up
00096 optical.ScintPhotonScaleWeight=4.0
00097 
00098 giga = app.service("GiGa")
00099 giga.OutputLevel = 1
00100 giga.PhysicsList = "GiGaPhysListModular"
00101 
00102 gggeo = app.service("GiGaGeo")
00103 gggeo.OutputLevel = 3
00104 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00105 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00106 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00107 
00108 giga.SteppingAction = "GiGaStepActionSequence"
00109 stepseq = app.property("GiGa.GiGaStepActionSequence")
00110 stepseq.OutputLevel = 3
00111 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00112 
00113 
00114 TH2DE="TH2DE"       # TH2DE is the fastest
00115 #TH2DE="TouchableToDetectorElementFast"
00116 historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction")
00117 historian.TouchableToDetelem = TH2DE
00118 
00119 params = {
00120     'start' :"(start > 0)",
00121     'track1':"(id==1 and ProcessType==1)",
00122     'track2':"(id==2 and ProcessType==1)",
00123     'GD':    "MaterialName == '/dd/Materials/GdDopedLS'",
00124     'LS':    "MaterialName == '/dd/Materials/LiquidScintillator'",
00125     'oil':   "MaterialName == '/dd/Materials/MineralOil'",
00126     'iAV':   "MaterialName == '/dd/Materials/Acrylic'",
00127     'oAV':   "MaterialName == '/dd/Materials/Acrylic'"
00128     }
00129 
00130 Historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction");
00131 Historian.TrackSelection = "Process=='HadronCapture'"
00132 #Historian.VertexSelection = "Process=='HadronCapture'"
00133                         
00134 
00135 unobs = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction")
00136 unobs.TouchableToDetelem = TH2DE
00137 unobs.Stats=[
00138    # for track 1
00139     ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00140     ["t_Trk1",    "t" , "%(track1)s and %(start)s"%params],
00141     ["x_Trk1",    "x", "%(track1)s and %(start)s"%params],
00142     ["y_Trk1",    "y", "%(track1)s and %(start)s"%params],
00143     ["z_Trk1",    "z", "%(track1)s and %(start)s"%params],
00144     ["e_Trk1",    "E",  "%(track1)s and %(start)s"%params],
00145     ["p_Trk1",    "p",  "%(track1)s and %(start)s"%params],
00146     ["ke_Trk1",   "KE", "%(track1)s and %(start)s"%params],
00147     ["vx_Trk1",   "lvx","%(track1)s and %(start)s"%params],
00148     ["vy_Trk1",   "lvy","%(track1)s and %(start)s"%params],
00149     ["vz_Trk1",   "lvz","%(track1)s and %(start)s"%params],
00150     ["TrkLength_GD_Trk1",  "dx","%(track1)s and %(GD)s"%params],
00151     ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(iAV)s"%params],    # not fully implemented
00152     ["TrkLength_LS_Trk1",  "dx","%(track1)s and %(LS)s"%params],
00153     ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(oAV)s"%params],    # not fully implemented
00154     ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(oil)s"%params],
00155    # for track 2 now
00156     ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00157     ["t_Trk2",    "t" , "%(track2)s and %(start)s"%params],
00158     ["x_Trk2",    "x", "%(track2)s and %(start)s"%params],
00159     ["y_Trk2",    "y", "%(track2)s and %(start)s"%params],
00160     ["z_Trk2",    "z", "%(track2)s and %(start)s"%params],
00161     ["e_Trk2",    "E",  "%(track2)s and %(start)s"%params],
00162     ["p_Trk2",    "p",  "%(track2)s and %(start)s"%params],
00163     ["ke_Trk2",   "KE", "%(track2)s and %(start)s"%params],
00164     ["vx_Trk2",   "lvx","%(track2)s and %(start)s"%params],
00165     ["vy_Trk2",   "lvy","%(track2)s and %(start)s"%params],
00166     ["vz_Trk2",   "lvz","%(track2)s and %(start)s"%params],
00167     ["TrkLength_GD_Trk2",  "dx","%(track2)s and %(GD)s"%params],
00168     ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(iAV)s"%params],    # not fully implemented
00169     ["TrkLength_LS_Trk2",  "dx","%(track2)s and %(LS)s"%params],
00170     ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(oAV)s"%params],    # not fully implemented
00171     ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(oil)s"%params]
00172     ]
00173                                                 
00174 
00175 # Make Geant4 sing!
00176 ggrm = app.property("GiGa.GiGaMgr")
00177 ggrm.Verbosity = 0
00178 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00179 verbosity_cmds = [
00180     "/control/verbose 0",
00181     "/run/verbose 0",
00182     "/event/verbose 2",
00183     "/tracking/verbose 2",
00184     "/geometry/navigator/verbose 0"
00185     ]
00186 silent_cmds = [
00187     "/control/verbose 0",
00188     "/run/verbose 0",
00189     "/event/verbose 0",
00190     "/tracking/verbose 0",
00191     "/geometry/navigator/verbose 0"
00192     ]
00193 
00194 event_ac_cmds.BeginOfEventCommands = silent_cmds
00195 giga.EventAction = "GiGaEventActionCommand"
00196 
00197 
00198 app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00199 simseq = app.algorithm("SimSeq")
00200 simseq.Members = [ "GiGaInputStream/GGInStream" ]
00201 
00202 ggin = app.algorithm("GGInStream")
00203 #ggin.OutputLevel = 1
00204 ggin.ExecuteOnce = True
00205 ggin.ConversionSvcName = "GiGaGeo"
00206 ggin.DataProviderSvcName = "DetectorDataSvc"
00207 #ggin.StreamItems = [ "/dd/Structure/DayaBay", ]
00208 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00209                      "/dd/Geometry/AdDetails/AdSurfacesAll",
00210                      "/dd/Geometry/AdDetails/AdSurfacesFar",
00211                      "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00212                      "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00213                      ]
00214 
00215 simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00216 pull = app.algorithm("PullEvent")
00217 pull.OutputLevel = 1 
00218 push = app.algorithm("PushKine")
00219 push.Converter = "HepMCtoG4"
00220 #push.Location = "/Event/Gen/GenHeader" # default anyway
00221 
00222 # Class name to use is set in DetDesc xml's "sensdet" attribute.
00223 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00224 pmtsd.OutputLevel = 4
00225 
00226 # Add the GenHist algorithm
00227 app.TopAlg += ["DetSimVali"]
00228 vali= app.algorithm("DetSimVali")
00229 vali.OutPutLevel=3
00230 
00231 histsvc = app.service("THistSvc")
00232 histsvc.Output =["file1 DATAFILE='../mc_ntuple/neutron.root' OPT='RECREATE' TYP='ROOT' "]
00233     
00234 app.run(10)
00235     
| 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