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

In This Package:

U-Th-K.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 import xmldetdesc
00008 xmldetdesc.config()
00009 
00010 import GaudiPython as gp
00011 
00012 iapp = gp.iService("ApplicationMgr")
00013 iapp.SvcMapping = [
00014     'EvtDataSvc/EventDataArchiveSvc',
00015     'DybDataSvc/EventDataSvc',
00016     #"EvtDataSvc/EventDataSvc",
00017     "DetDataSvc/DetectorDataSvc",
00018     "HistogramSvc/HistogramDataSvc",
00019     "HbookCnv::PersSvc/HbookHistSvc",
00020     "RootHistCnv::PersSvc/RootHistSvc",
00021     "EvtPersistencySvc/EventPersistencySvc",
00022     "DetPersistencySvc/DetectorPersistencySvc",
00023     "HistogramPersistencySvc/HistogramPersistencySvc",
00024     ]
00025         
00026 app = gp.AppMgr()
00027 
00028 app.EvtSel = "NONE"
00029 
00030 trimSvc = app.service('ArchiveTrimSvc')
00031 trimSvc.DefaultWindowSeconds = 0.0001 # not in system-of-units time!
00032 
00033 app.TopAlg = ["GiGaInputStream/GGInStream",
00034               'Sim15',
00035               'DybTrimIO'
00036               ]
00037 
00038 StageKin=app.property("ToolSvc.Kinematic")
00039 StageKin.Sequencer='GnrtrSeq'
00040 GenSeq=app.property('GnrtrSeq')
00041 GenSeq.Members = [
00042 #    "Gnrtr/GenK40",
00043     "Gnrtr/GenU",
00044 #    "Gnrtr/GenTh",
00045     ]
00046 
00047 StageDet=app.property("ToolSvc.Detector")
00048 StageDet.Sequencer='DetSimSeq'
00049 DSSeq=app.property('DetSimSeq')
00050 DSSeq.Members = ['DetSimProc']
00051 
00052 StageElec=app.property("ToolSvc.Electronic")
00053 StageElec.Sequencer='ElecSimSeq'
00054 ESSeq=app.property('ElecSimSeq')
00055 ESSeq.Members = ['ElecSimProc']
00056 
00057 StageTrig=app.property("ToolSvc.Trigger")
00058 StageTrig.Sequencer='TrigSimSeq'
00059 TSSeq=app.property('TrigSimSeq')
00060 TSSeq.Members = ['TrigReadProc']
00061 
00062 StageSingle=app.property("ToolSvc.SingleLoader")
00063 StageSingle.Sequencer='SingleSeq'
00064 SingleSeq=app.property('SingleSeq')
00065 SingleSeq.Members = ['SingleLoader']
00066 
00067 
00068 # Kinematic
00069 genk40=app.algorithm('GenK40')
00070 genk40.ThisStageName='Kinematic'
00071 genk40.LowerStageName=''
00072 
00073 genu=app.algorithm('GenU')
00074 genu.ThisStageName='Kinematic'
00075 genu.LowerStageName=''
00076 
00077 genth=app.algorithm('GenTh')
00078 genth.ThisStageName='Kinematic'
00079 genth.LowerStageName=''
00080 
00081 # Detector
00082 sim=app.algorithm('DetSimProc')
00083 sim.ThisStageName='Detector'
00084 sim.LowerStageName='Kinematic'
00085 
00086 # Electronic
00087 elec=app.algorithm('ElecSimProc')
00088 elec.ThisStageName='Electronic'
00089 elec.LowerStageName='Detector'
00090 
00091 # Trigger
00092 trig=app.algorithm('TrigReadProc')
00093 trig.ThisStageName='Trigger'
00094 trig.LowerStageName='Electronic'
00095 
00096 # SingleLoader
00097 singll=app.algorithm('SingleLoader')
00098 singll.ThisStageName='SingleLoader'
00099 singll.LowerStageName='Trigger'
00100 
00101 # Configure generator
00102 # K40
00103 genk40.GenTools = [ "GtHepEvtGenTool/K40Gen",
00104                     "GtPositionerTool/K40Pos",
00105                     "GtTimeratorTool/K40Tim",
00106                     "GtTransformTool/K40Tra"]
00107 genk40.OutputLevel = 2
00108 genk40.GenName = "K40_ticktack"
00109 
00110 volume =  "/dd/Structure/AD/far-lso2"
00111 #genk40.Location = "/Event/Gen/HepMCEvents" # this is default anyways
00112 #
00113 # Set up K40Gen
00114 seed=1234567
00115 nevents=1000
00116 hepevt_source="K40.exe -seed %(seed)s -n %(nevents)s|"
00117 # Deal with executable
00118 if hepevt_source[-1] == "|":
00119     exe = hepevt_source.split(' ')[0]
00120     if exe[0] != '/':   # Try to find full path
00121         import os, os.path
00122         path = os.getenv('PATH')
00123         for p in path:
00124             if (os.path.isfile(path+"/"+exe)):
00125                 exe = path+"/"+exe
00126                 break
00127             continue
00128         pass
00129     source = exe + ' ' + ' '.join(hepevt_source.split(' ')[1:])
00130     if "%" in source:   # Fill in any placemarks
00131         source = source%{'nevents':str(nevents),
00132                          'seed':str(seed)}
00133         pass
00134     pass
00135 
00136 
00137 #generator
00138 k40gen=app.property('ToolSvc.K40Gen')
00139 k40gen.OutputLevel = 2
00140 k40gen.HepEvtDataSource = source
00141 
00142 # Set up positioner
00143 k40pos=app.property('ToolSvc.K40Pos')
00144 k40pos.OutputLevel = 2
00145 k40pos.Volume = volume
00146 k40pos.Strategy = "FullVolume" # also "AvoidDaughters" and "Surface"
00147 #k40pos.Mode = "Uniform"
00148 k40pos.Mode = "Fixed"
00149 k40pos.Spread = 4*units.m
00150 k40pos.Position = [0,0,2.5*units.m]
00151 
00152 # Set up timerator
00153 app.property('ToolSvc.K40Tim').LifeTime = int(30000*units.ns)
00154 
00155 # transform
00156 k40tra = app.property("ToolSvc.K40Tra")
00157 k40tra.Volume = volume
00158 
00159 
00160 #setup U decay
00161 genu.GenTools = [ "GtUDecaysGenTool/UGen",
00162                   "GtPositionerTool/UPos",
00163                   "GtUDecaysTimeTool/UTim",
00164                   "GtTransformTool/UTra" ]
00165 genu.OutputLevel = 2
00166 genu.GenName = "U_ticktack"
00167 
00168 # U decay generator
00169 ugen=app.property("ToolSvc.UGen")
00170 ugen.OutputLevel =1
00171 ugen.RandomSeed =450
00172 
00173 spray_photons = True
00174 
00175 # Set up positioner
00176 upos = app.property("ToolSvc.UPos")
00177 upos.Volume = volume
00178 upos.Mode = "Fixed"
00179 if spray_photons:
00180     upos.Position = [0,0,2500*units.mm]
00181 else:
00182     upos.Position = [-3*units.meter,3*units.meter,0]
00183 upos.OutputLevel = 2
00184                 
00185 # Set up timerator
00186 utim = app.property("ToolSvc.UTim")
00187 utim.LifeTime = int(30000*units.ns)
00188 utim.OutputLevel = 2
00189 
00190 # set up transform
00191 utrans = app.property("ToolSvc.UTra")
00192 utrans.Volume = volume
00193 utrans.OutputLevel = 2
00194 
00195 # set up thorium decay
00196 genth.GenTools = [ "GtThDecaysGenTool/ThGen",
00197                    "GtPositionerTool/ThPos",
00198                    "GtTimeratorTool/ThTim",   # ??? no GtThDecaysTimeTool
00199                    "GtTransformTool/ThTra" ]
00200 genth.OutputLevel = 2
00201 genth.GenName = "Th_ticktack"
00202 
00203 # Th decay generator
00204 thgen=app.property("ToolSvc.ThGen")
00205 thgen.OutputLevel =2
00206 thgen.RandomSeed =100
00207 
00208 # Set up positioner
00209 thpos = app.property("ToolSvc.ThPos")
00210 thpos.Volume = volume
00211 thpos.Mode = "Fixed"
00212 if spray_photons:
00213     upos.Position = [0,0,2500*units.mm]
00214 else:
00215     upos.Position = [-3*units.meter,3*units.meter,0]
00216 thpos.OutputLevel = 2
00217 
00218 # Set up timerator
00219 thtim = app.property("ToolSvc.ThTim")
00220 thtim.LifeTime = int(30000*units.ns)
00221 thtim.OutputLevel = 2
00222 
00223 # set up transform
00224 thtrans = app.property("ToolSvc.ThTra")
00225 thtrans.Volume = volume
00226 thtrans.OutputLevel = 2
00227 
00228 #-------------------------------------------------------------------------
00229 # Configure geant4 simulation
00230 app.ExtSvc += ["GiGa"]
00231 modularPL = app.property("GiGa.GiGaPhysListModular")
00232 #modularPL.OutputLevel = 1
00233 modularPL.CutForElectron = 100*units.micrometer
00234 modularPL.CutForPositron = 100*units.micrometer
00235 modularPL.CutForGamma = 1*units.millimeter
00236 modularPL.PhysicsConstructors = [
00237             "DsPhysConsGeneral",
00238             "DsPhysConsOptical",
00239             "DsPhysConsEM",
00240 #            "DsPhysConsElectroNu",
00241 #            "DsPhysConsHadron",
00242 #            "DsPhysConsIon"
00243             ]
00244 # in DsPhysConsOptical.cc these properties are declared.
00245 optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00246 #
00247 #optical.UseScintillation = False  # false option will kill all optical photons, should be true all the time
00248 #optical.UseRayleigh = True       # enable rayleigh scattering
00249 optical.CerenPhotonScaleWeight=4.0  # scale photon yield down and scale QE up
00250 optical.ScintPhotonScaleWeight=4.0
00251 
00252 giga = app.service("GiGa")
00253 giga.OutputLevel = 2
00254 giga.PhysicsList = "GiGaPhysListModular"
00255 
00256 gggeo = app.service("GiGaGeo")
00257 gggeo.OutputLevel = 3
00258 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00259 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00260 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00261 
00262 giga.SteppingAction = "GiGaStepActionSequence"
00263 stepseq = app.property("GiGa.GiGaStepActionSequence")
00264 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00265 
00266 # Make Geant4 sing!
00267 ggrm = app.property("GiGa.GiGaMgr")
00268 ggrm.Verbosity = 0
00269 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00270 verbosity_cmds = [
00271         "/control/verbose 0",
00272         "/run/verbose 0",
00273         "/event/verbose 2",
00274         "/tracking/verbose 2",
00275         "/geometry/navigator/verbose 0"
00276         ]
00277 silent_cmds = [
00278         "/control/verbose 0",
00279         "/run/verbose 0",
00280         "/event/verbose 0",
00281         "/tracking/verbose 0",
00282         "/geometry/navigator/verbose 0"
00283         ]
00284 
00285 event_ac_cmds.BeginOfEventCommands = silent_cmds
00286 giga.EventAction = "GiGaEventActionCommand"
00287 
00288 
00289 ggin = app.algorithm("GGInStream")
00290 
00291 #ggin.OutputLevel = 1
00292 ggin.ExecuteOnce = True
00293 ggin.ConversionSvcName = "GiGaGeo"
00294 ggin.DataProviderSvcName = "DetectorDataSvc"
00295 #ggin.StreamItems = [ "/dd/Structure/DayaBay", ]
00296 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00297                      "/dd/Geometry/AdDetails/AdSurfacesAll",
00298                      "/dd/Geometry/AdDetails/AdSurfacesFar",
00299                      "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00300                      "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00301                      ]
00302 
00303 # Class name to use is set in DetDesc xml's "sensdet" attribute.
00304 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00305 pmtsd.OutputLevel = 4
00306 
00307 sim.Converter = "HepMCtoG4"
00308 #push.Location = "/Event/Gen/GenHeader" # default anyway
00309 sim.OutputLevel=2
00310 
00311 # other properties for ElecSim
00312 #elec.PmtTool = 'EsPmtEffectPulseTool'
00313 elec.PmtTool = 'EsIdealPulseTool'
00314 elec.RpcTool = 'EsIdealPulseTool'
00315 elec.FeeTool = 'EsIdealFeeTool'
00316 elec.FecTool = 'EsIdealFecTool'
00317 elec.OutputLevel=2
00318 
00319 # trigger tools
00320 trig.TrigTools=['TsMultTriggerTool']  # default
00321 trig.RoTools=['ROsFeeReadoutTool','ROsFecReadoutTool']
00322 trig.OutputLevel=2
00323 nhits=app.property("ToolSvc.TsMultTriggerTool")
00324 nhits.OutputLevel=2
00325 fee=app.property("ToolSvc.ROsFeeReadoutTool")
00326 fec=app.property("ToolSvc.ROsFecReadoutTool")
00327 fee.OutputLevel=2
00328 fec.OutputLevel=2
00329 
00330 # Single Loader
00331 singll.OutputLevel=2
00332 
00333 # others
00334 eds=app.service("EventDataSvc")
00335 eds.ForceLeaves=True
00336 
00337 #
00338 app.EvtMax = 150
00339 app.EvtSel ="NONE"
00340 
00341 #
00342 sim15=app.algorithm('Sim15')
00343 #sim15.TopStage='Kinematic'
00344 #sim15.TopStage='Detector'
00345 sim15.TopStage='Electronic'
00346 #sim15.TopStage='Trigger'
00347 #sim15.TopStage='SingleLoader'
00348 sim15.OutputLevel=2
00349 
00350 histsvc = app.service("THistSvc")
00351 
00352 msv = app.service('MessageSvc')
00353 msv.OutputLevel = 2
00354 app.initialize()
00355 app.run( app.EvtMax )
00356 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