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

In This Package:

elecIoTest.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 use_aes = True
00004 
00005 import GaudiPython as gp
00006 
00007 if use_aes:
00008 
00009     iapp = gp.iService("ApplicationMgr")
00010     iapp.SvcMapping = [
00011         'EvtDataSvc/EventDataArchiveSvc',
00012         'DybDataSvc/EventDataSvc', 
00013         #"EvtDataSvc/EventDataSvc",
00014         "DetDataSvc/DetectorDataSvc",
00015         "HistogramSvc/HistogramDataSvc",
00016         "HbookCnv::PersSvc/HbookHistSvc",
00017         "RootHistCnv::PersSvc/RootHistSvc",
00018         "EvtPersistencySvc/EventPersistencySvc",
00019         "DetPersistencySvc/DetectorPersistencySvc",
00020         "HistogramPersistencySvc/HistogramPersistencySvc",
00021         ]
00022 
00023 
00024 
00025 import xmldetdesc
00026 xmldetdesc.config()
00027 
00028 app = gp.AppMgr(outputlevel=3)
00029 #app.OutputLevel = 3
00030 
00031 msg = app.service("MessageSvc")
00032 #msg.Format = "\--%-F%40W%S%7W%R%T %23W%t\n \-> %0W%M"
00033 msg.Format = "% F%25W%S%7W%R%T %0W%M"
00034 msg.useColors = True
00035 msg.fatalColorCode=['red','white']
00036 msg.errorColorCode=['red']
00037 msg.warningColorCode=['yellow']
00038 msg.debugColorCode=['blue']
00039 msg.verboseColorCode=['cyan']
00040 
00041 
00042 app.EvtMax = 1
00043 
00044 app.EvtSel = "NONE"
00045 
00046 app.ExtSvc += [ "DybStorageSvc" ]
00047 dss = app.service("DybStorageSvc")
00048 dss.OutputLevel = 3
00049     
00050 app.ExtSvc += [ "RootIOCnvSvc" ]
00051 
00052 per = app.service("EventPersistencySvc")
00053 per.CnvServices = [ "RootIOCnvSvc" ];
00054 
00055 eds = app.service("EventDataService")
00056 eds.OutputLevel = 3
00057 
00058 rio = app.property("RootIOCnvSvc")
00059 rio.OutputLevel = 3
00060 
00061 iomap = { "/Event/Gen/GenHeader": "gen.root",
00062           "/Event/Elec/ElecHeader": "elec.root",
00063           "default": "default.root" };
00064 
00065 
00066 rio.OutputStreams = iomap
00067 
00068 app.TopAlg = [ ]
00069 
00070 # set up gentools
00071 
00072 import xmldetdesc
00073 xmldetdesc.config()
00074 
00075 volume = "/dd/Structure/AD/far-oil2"
00076 
00077 # time
00078 import GaudiKernel.SystemOfUnits as units
00079 tim = app.property("ToolSvc.GtTimeratorTool")
00080 tim.LifeTime = int(1*units.second)
00081 
00082 # position
00083 poser = app.property("ToolSvc.GtPositionerTool")
00084 poser.Volume = volume
00085 poser.Mode = "Fixed"
00086 poser.Position = [0,0,0]
00087 
00088 # momentum
00089 gun = app.property("ToolSvc.GtGunGenTool")
00090 gun.ParticlesPerEvent = 1
00091 gun.ParticleName = "e+"
00092 gun.Momentum = 3*units.MeV
00093 gun.MomentumMode = "Fixed"
00094 gun.DirectionMode = "Fixed"
00095 gun.Direction = [ 1,0,0 ]
00096 
00097 # translate from local volume to global
00098 trans = app.property("ToolSvc.GtTransformTool")
00099 trans.Volume = volume
00100 
00101 app.TopAlg += [ 'GtGenerator/gen' ]
00102 gen = app.algorithm("gen")
00103 gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ]
00104 gen.GenName = "Bang Bang"
00105 
00106 app.ExtSvc += ["GiGa"]
00107 
00108 modularPL = app.property("GiGa.GiGaPhysListModular")
00109 #modularPL.OutputLevel = 3
00110 modularPL.CutForElectron = 100*units.micrometer
00111 modularPL.CutForPositron = 100*units.micrometer
00112 modularPL.CutForGamma = 1*units.millimeter
00113 modularPL.PhysicsConstructors = [ 
00114     "DsPhysConsGeneral", 
00115     "DsPhysConsOptical",
00116     "DsPhysConsEM"
00117 #    "DsPhysConsElectroNu",
00118 #    "DsPhysConsHadron",
00119 #    "DsPhysConsIon"
00120     ]
00121 
00122 # in DsPhysConsOptical.cc these properties are declared.
00123 optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00124 
00125 #optical.UseScintillation = False  # false option will kill all optical photons, should be true all the time
00126 #optical.UseRayleigh = True       # enable rayleigh scattering
00127 
00128 giga = app.service("GiGa")
00129 giga.OutputLevel = 3
00130 giga.PhysicsList = "GiGaPhysListModular"
00131 
00132 gggeo = app.service("GiGaGeo")
00133 gggeo.OutputLevel = 3
00134 gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00135 gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00136 gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00137 
00138 giga.SteppingAction = "GiGaStepActionSequence"
00139 stepseq = app.property("GiGa.GiGaStepActionSequence")
00140 stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00141 
00142 
00143 TH2DE="TH2DE"       # TH2DE is the fastest
00144 #TH2DE="TouchableToDetectorElementFast"
00145 historian = app.property("GiGa.GiGaStepActionSequence.HistorianStepAction")
00146 historian.TouchableToDetelem = TH2DE
00147 
00148 params = {
00149     'track1':"(id == 1 and ProcessType == 1)",
00150     'track2':"(id == 2 and ProcessType == 1)",
00151 #    'track1':"(id == 1)",
00152 #    'track2':"(id == 2)",
00153     'GD':    "MaterialName == '/dd/Materials/GdDopedLS'",
00154     'LS':    "MaterialName == '/dd/Materials/LiquidScintillator'",
00155     'oil':   "MaterialName == '/dd/Materials/MineralOil'",
00156     'iAV':   "MaterialName == '/dd/Materials/Acrylic'",
00157     'oAV':   "MaterialName == '/dd/Materials/Acrylic'"
00158     }
00159 unobs = app.property("GiGa.GiGaStepActionSequence.UnObserverStepAction")
00160 unobs.TouchableToDetelem = TH2DE
00161 unobs.Stats=[
00162     ["pdgId_Trk1","pdg","%(track1)s"%params],
00163     ["t_Trk1",    "t" , "%(track1)s"%params],
00164     ["x_Trk1",    "lx", "%(track1)s"%params],
00165     ["y_Trk1",    "ly", "%(track1)s"%params],
00166     ["z_Trk1",    "lz", "%(track1)s"%params],
00167     ["e_Trk1",    "E",  "%(track1)s"%params],
00168     ["p_Trk1",    "p",  "%(track1)s"%params],
00169     ["ke_Trk1",   "KE", "%(track1)s"%params],
00170     ["vx_Trk1",   "vx", "%(track1)s"%params],
00171     ["vy_Trk1",   "vy", "%(track1)s"%params],
00172     ["vz_Trk1",   "vz", "%(track1)s"%params],
00173     ["TrkLength_GD_Trk1",  "dx","%(track1)s and %(GD)s"%params],
00174     ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(iAV)s"%params],
00175     ["TrkLength_LS_Trk1",  "dx","%(track1)s and %(LS)s"%params],
00176     ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(oAV)s"%params],
00177     ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(oil)s"%params]
00178     ]
00179                                                 
00180 
00181 # Make Geant4 sing!
00182 ggrm = app.property("GiGa.GiGaMgr")
00183 ggrm.Verbosity = 3
00184 event_ac_cmds = app.property("GiGa.GiGaEventActionCommand")
00185 verbosity_cmds = [
00186     "/control/verbose 0",
00187     "/run/verbose 0",
00188     "/event/verbose 2",
00189     "/tracking/verbose 2",
00190     "/geometry/navigator/verbose 0"
00191     ]
00192 silent_cmds = [
00193     "/control/verbose 0",
00194     "/run/verbose 0",
00195     "/event/verbose 0",
00196     "/tracking/verbose 0",
00197     "/geometry/navigator/verbose 0"
00198     ]
00199 
00200 event_ac_cmds.BeginOfEventCommands = silent_cmds
00201 giga.EventAction = "GiGaEventActionCommand"
00202 
00203 
00204 app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00205 simseq = app.algorithm("SimSeq")
00206 simseq.Members = [ "GiGaInputStream/GGInStream" ]
00207 
00208 ggin = app.algorithm("GGInStream")
00209 #ggin.OutputLevel = 1
00210 ggin.ExecuteOnce = True
00211 ggin.ConversionSvcName = "GiGaGeo"
00212 ggin.DataProviderSvcName = "DetectorDataSvc"
00213 #ggin.StreamItems = [ "/dd/Structure/DayaBay", ]
00214 ggin.StreamItems = [ "/dd/Structure/Sites/far-rock", ]
00215 
00216 simseq.Members = [ "GiGaInputStream/GGInStream", "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00217 pull = app.algorithm("PullEvent")
00218 #pull.OutputLevel = 1 
00219 push = app.algorithm("PushKine")
00220 push.Converter = "HepMCtoG4"
00221 #push.Location = "/Event/Gen/GenHeader" # default anyway
00222 
00223 # Class name to use is set in DetDesc xml's "sensdet" attribute.
00224 pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00225 pmtsd.OutputLevel = 4
00226 
00227 app.TopAlg +=["ESFEEAlg"]
00228 
00229 fee=app.algorithm("ESFEEAlg")
00230 fee.OutputLevel = 1;
00231 fee.ElecHeaderPath = '/Event/Elec/ElecHeader'
00232 
00233 feeTool=app.tool("ToolSvc.ESFeeTool")
00234 feeTool.OutputLevel = 1;
00235 
00236 
00237 app.TopAlg += [ 'RegSeqDumpAlg/rsd' ]
00238 rsd = app.algorithm("rsd")
00239 rsd.OutputLevel = 3
00240 
00241 app.TopAlg += [ 'DybStoreAlg/dsa' ]
00242 dsa = app.algorithm("dsa")
00243 dsa.OutputLevel = 3
00244 
00245 # Run...
00246 app.initialize()
00247 app.run(app.EvtMax)
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:58:40 2011 for RootIOTest by doxygen 1.4.7