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

In This Package:

sim15.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 from  GaudiPython import AppMgr
00003 from GaudiKernel import SystemOfUnits as units
00004 
00005 import os,sys
00006 
00007 print "\tBuilding detector\n"
00008 import xmldetdesc
00009 xmldetdesc.config()
00010 
00011 app = AppMgr()
00012 app.TopAlg = []
00013 app.EvtSel = "NONE"
00014 
00015 import GaudiPython as gp
00016 
00017 iapp = gp.iService("ApplicationMgr")
00018 iapp.SvcMapping = [
00019     'EvtDataSvc/EventDataArchiveSvc',
00020     'DybDataSvc/EventDataSvc',
00021     #"EvtDataSvc/EventDataSvc",
00022     "DetDataSvc/DetectorDataSvc",
00023     "HistogramSvc/HistogramDataSvc",
00024     "HbookCnv::PersSvc/HbookHistSvc",
00025     "RootHistCnv::PersSvc/RootHistSvc",
00026     "EvtPersistencySvc/EventPersistencySvc",
00027     "DetPersistencySvc/DetectorPersistencySvc",
00028     "HistogramPersistencySvc/HistogramPersistencySvc",
00029     ]
00030         
00031 
00032 app.TopAlg = ["GiGaInputStream/GGInStream",
00033               'Sim15',
00034               ]
00035 
00036 StageKin=app.property("ToolSvc.Kinematic")
00037 StageKin.Sequencer='GnrtrSeq'
00038 GenSeq=app.property('GnrtrSeq')
00039 GenSeq.Members = ["Gnrtr/Gen1"]
00040 
00041 StageDet=app.property("ToolSvc.Detector")
00042 StageDet.Sequencer='DetSimSeq'
00043 DSSeq=app.property('DetSimSeq')
00044 DSSeq.Members = ['DetSimProc']
00045 
00046 StageElec=app.property("ToolSvc.Electronic")
00047 StageElec.Sequencer='ElecSimSeq'
00048 ESSeq=app.property('ElecSimSeq')
00049 ESSeq.Members = ['ElecSimProc']
00050 
00051 StageTrig=app.property("ToolSvc.Trigger")
00052 StageTrig.Sequencer='TrigSimSeq'
00053 TSSeq=app.property('TrigSimSeq')
00054 TSSeq.Members = ['TrigReadProc']
00055 
00056 StageSingle=app.property("ToolSvc.SingleLoader")
00057 StageSingle.Sequencer='SingleSeq'
00058 SingleSeq=app.property('SingleSeq')
00059 SingleSeq.Members = ['SingleLoader']
00060 
00061 
00062 # Kinematic
00063 gen=app.algorithm('Gen1')
00064 gen.ThisStageName='Kinematic'    
00065 gen.LowerStageName=''            
00066 
00067 # Detector
00068 sim=app.algorithm('DetSimProc')
00069 sim.ThisStageName='Detector'     
00070 sim.LowerStageName='Kinematic'   
00071 
00072 # Electronic
00073 elec=app.algorithm('ElecSimProc')
00074 elec.ThisStageName='Electronic'  
00075 elec.LowerStageName='Detector'   
00076 
00077 # Trigger
00078 trig=app.algorithm('TrigReadProc')
00079 trig.ThisStageName='Trigger'     
00080 trig.LowerStageName='Electronic' 
00081 
00082 # SingleLoader
00083 singll=app.algorithm('SingleLoader')
00084 singll.ThisStageName='SingleLoader'
00085 singll.LowerStageName='Trigger'
00086 
00087 # Configure generator
00088 #gen.OutputLevel = 1
00089 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ]
00090 gen.GenName = "ticktack"
00091 #gen.Location = "/Event/Gen/GenHeader" # this is default anyways
00092 gen.OutputLevel=2
00093 
00094 volume = "/dd/Structure/AD/far-lso2"
00095 
00096 # Set up timerator
00097 tim = app.property("ToolSvc.GtTimeratorTool")
00098 tim.LifeTime = int(20000*units.nanosecond)
00099 tim.Distribution = "Uniform"
00100 #tim.Mode="Relative"
00101 tim.OutputLevel=2
00102 
00103 # Set up positioner
00104 poser = app.property("ToolSvc.GtPositionerTool")
00105 #poser.OutputLevel = 1
00106 poser.Strategy = "FullVolume"
00107 poser.Volume = volume
00108 poser.Mode = "Fixed"
00109 #poser.Mode = "Uniform"
00110 #poser.Mode = "Smeared"
00111 poser.Spread = 2.6*units.meter
00112 poser.Position = [0,0,2.5*units.meter]
00113 
00114 # Set up gun
00115 gun = app.property("ToolSvc.GtGunGenTool")
00116 #gun.OutputLevel = 1
00117 gun.ParticlesPerEvent = 1
00118 gun.ParticleName = "e-"
00119 #gun.Momentum = 6*units.eV   # try to enhance rayleigh scattering
00120 gun.Momentum = 2*units.MeV
00121 gun.MomentumMode = "Smeared"
00122 #gun.MomentumMode = "Fixed"
00123 #gun.MomentumMode = "Uniform"
00124 gun.MomentumSpread = 1.0*units.MeV
00125 
00126 gun.DirectionMode = "Uniform"
00127 #from math import sin, cos, pi
00128 #pmt_column_number = 9
00129 #angle = (2*pmt_column_number - 1)*pi/24.0;
00130 #gun.Direction = [ cos(angle),sin(angle),0 ] # aim for PMT
00131 gun.Direction = [ 1, 0, 0 ] # aim for a PMT
00132 gun.DirectionSpread = 3
00133 print 'gun.Direction=',gun.Direction
00134 
00135 trans = app.property("ToolSvc.GtTransformTool")
00136 trans.Volume = volume
00137 
00138 #-------------------------------------------------------------------------
00139 # Configure geant4 simulation
00140 app.ExtSvc += ["GiGa"]
00141 modularPL = app.property("GiGa.GiGaPhysListModular")
00142 #modularPL.OutputLevel = 1
00143 modularPL.CutForElectron = 100*units.micrometer
00144 modularPL.CutForPositron = 100*units.micrometer
00145 modularPL.CutForGamma = 1*units.millimeter
00146 modularPL.PhysicsConstructors = [
00147             "DsPhysConsGeneral",
00148             "DsPhysConsOptical",
00149             "DsPhysConsEM",
00150         #    "DsPhysConsElectroNu",
00151         #    "DsPhysConsHadron",
00152         #    "DsPhysConsIon"
00153             ]
00154 # in DsPhysConsOptical.cc these properties are declared.
00155 optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00156 #
00157 #optical.UseScintillation = False  # false option will kill all optical photons, should be true all the time
00158 #optical.UseRayleigh = True       # enable rayleigh scattering
00159 optical.CerenPhotonScaleWeight=4.0  # scale photon yield down and scale QE up
00160 optical.ScintPhotonScaleWeight=4.0
00161 
00162 giga = app.service("GiGa")
00163 giga.OutputLevel = 4
00164 giga.PhysicsList = "GiGaPhysListModular"
00165 
00166 gggeo = app.service("GiGaGeo")
00167 gggeo.OutputLevel = 3
00168 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00169 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00170 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00171 
00172 giga.SteppingAction = "GiGaStepActionSequence"
00173 stepseq = app.property("GiGa.GiGaStepActionSequence")
00174 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00175 
00176 # Make Geant4 sing!
00177 ggrm = app.property("GiGa.GiGaMgr")
00178 ggrm.Verbosity = 0
00179 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00180 verbosity_cmds = [
00181         "/control/verbose 0",
00182         "/run/verbose 0",
00183         "/event/verbose 2",
00184         "/tracking/verbose 2",
00185         "/geometry/navigator/verbose 0"
00186         ]
00187 silent_cmds = [
00188         "/particle/property/verbose 0",
00189         "/control/verbose 0",
00190         "/run/verbose 0",
00191         "/event/verbose 0",
00192         "/tracking/verbose 0",
00193         "/geometry/navigator/verbose 0"
00194         ]
00195 
00196 event_ac_cmds.BeginOfEventCommands = silent_cmds
00197 giga.EventAction = "GiGaEventActionCommand"
00198 
00199 
00200 ggin = app.algorithm("GGInStream")
00201 
00202 #ggin.OutputLevel = 1
00203 ggin.ExecuteOnce = True
00204 ggin.ConversionSvcName = "GiGaGeo"
00205 ggin.DataProviderSvcName = "DetectorDataSvc"
00206 #ggin.StreamItems = [ "/dd/Structure/DayaBay", ]
00207 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00208                      "/dd/Geometry/AdDetails/AdSurfacesAll",
00209                      "/dd/Geometry/AdDetails/AdSurfacesFar",
00210                      "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00211                      "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00212                      ]
00213 
00214 # Class name to use is set in DetDesc xml's "sensdet" attribute.
00215 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00216 pmtsd.OutputLevel = 4
00217 
00218 sim.Converter = "HepMCtoG4"
00219 #push.Location = "/Event/Gen/GenHeader" # default anyway
00220 sim.OutputLevel=2
00221 
00222 # other properties for ElecSim
00223 #elec.PmtTool = 'EsPmtEffectPulseTool'
00224 elec.PmtTool = 'EsIdealPulseTool'
00225 elec.RpcTool = 'EsIdealPulseTool'
00226 elec.FeeTool = 'EsIdealFeeTool'
00227 elec.FecTool = 'EsIdealFecTool'
00228 elec.OutputLevel=2
00229 
00230 # trigger tools
00231 trig.TrigTools=['TsMultTriggerTool']  # default
00232 trig.RoTools=['ROsFeeReadoutTool',
00233               #'ROsFecReadoutTool'
00234               ]
00235 trig.OutputLevel=2
00236 nhits=app.property("ToolSvc.TsMultTriggerTool")
00237 nhits.OutputLevel=2
00238 fee=app.property("ToolSvc.ROsFeePeakOnlyTool")
00239 #fec=app.property("ToolSvc.ROsFecReadoutTool")
00240 #fee.OutputLevel=1
00241 #fec.OutputLevel=1
00242 
00243 
00244 # Single Loader
00245 singll.OutputLevel=2
00246 
00247 # others
00248 eds=app.service("EventDataSvc")
00249 eds.ForceLeaves=True
00250 
00251 #
00252 app.EvtMax = 10
00253 app.EvtSel ="NONE"
00254 
00255 #
00256 sim15=app.algorithm('Sim15')
00257 #sim15.TopStage='Kinematic'
00258 #sim15.TopStage='Detector'
00259 #sim15.TopStage='Electronic'
00260 #sim15.TopStage='Trigger'
00261 sim15.TopStage='SingleLoader'
00262 sim15.OutputLevel=2
00263 
00264 histsvc = app.service("THistSvc")
00265 #histsvc.Output =["file1 DATAFILE='./elec.root' OPT='RECREATE' TYP='ROOT' "]
00266 
00267 msv = app.service('MessageSvc')
00268 msv.OutputLevel = 3
00269 app.initialize()
00270 app.run( app.EvtMax )
00271 app.exit()
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:36:44 2011 for Sim15 by doxygen 1.4.7