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

In This Package:

readoutiotest.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import sys
00004 try:
00005     io = sys.argv[1]
00006 except IndexError:
00007     io = "output"
00008 input = False
00009 if "input" == io: input = True
00010 
00011 output = not input
00012 use_aes = True
00013 dump = False
00014 
00015 import GaudiPython as gp
00016 
00017 if use_aes:
00018 
00019     iapp = gp.iService("ApplicationMgr")
00020     iapp.SvcMapping = [
00021         'EvtDataSvc/EventDataArchiveSvc',
00022         'DybDataSvc/EventDataSvc', 
00023         #"EvtDataSvc/EventDataSvc",
00024         "DetDataSvc/DetectorDataSvc",
00025         "HistogramSvc/HistogramDataSvc",
00026         "HbookCnv::PersSvc/HbookHistSvc",
00027         "RootHistCnv::PersSvc/RootHistSvc",
00028         "EvtPersistencySvc/EventPersistencySvc",
00029         "DetPersistencySvc/DetectorPersistencySvc",
00030         "HistogramPersistencySvc/HistogramPersistencySvc",
00031         ]
00032 
00033 
00034 if not input:
00035     import xmldetdesc
00036     xmldetdesc.config()
00037 
00038 app = gp.AppMgr(outputlevel=3)
00039 
00040 msg = app.service("MessageSvc")
00041 #msg.Format = "\--%-F%40W%S%7W%R%T %23W%t\n \-> %0W%M"
00042 msg.Format = "% F%25W%S%7W%R%T %0W%M"
00043 msg.useColors = True
00044 msg.fatalColorCode=['red','white']
00045 msg.errorColorCode=['red']
00046 msg.warningColorCode=['yellow']
00047 msg.debugColorCode=['blue']
00048 msg.verboseColorCode=['cyan']
00049 
00050 
00051 app.EvtMax = 1
00052 if input:
00053     app.EvtSel =""              # yeah, I know, it's weird.
00054 else:
00055     app.EvtSel = "NONE"
00056 
00057 if input:
00058     #app.ExtSvc += [ "RootIOEvtSelector/EventSelector" ]
00059     app.ExtSvc += [ "DybEvtSelector/EventSelector" ]
00060 if output:
00061     app.ExtSvc += [ "DybStorageSvc" ]
00062     dss = app.service("DybStorageSvc")
00063     dss.OutputLevel = 1
00064     
00065 app.ExtSvc += [ "RootIOCnvSvc" ]
00066 
00067 per = app.service("EventPersistencySvc")
00068 per.CnvServices = [ "RootIOCnvSvc" ];
00069 
00070 eds = app.service("EventDataService")
00071 eds.OutputLevel = 1
00072 
00073 rio = app.property("RootIOCnvSvc")
00074 rio.OutputLevel = 1
00075 
00076 iomap = { "default": "readoutiotest.root" };
00077 
00078 if input:
00079     rio.InputStreams = iomap
00080 if output:
00081     rio.OutputStreams = iomap
00082 
00083 app.TopAlg = [ ]
00084 
00085 # set up gentools
00086 if not input:
00087     import xmldetdesc
00088     xmldetdesc.config()
00089 
00090     volume = "/dd/Structure/AD/far-oil2"
00091 
00092     # time
00093     import GaudiKernel.SystemOfUnits as units
00094     tim = app.property("ToolSvc.GtTimeratorTool")
00095     tim.LifeTime = int(1*units.second)
00096 
00097     # position
00098     poser = app.property("ToolSvc.GtPositionerTool")
00099     poser.Volume = volume
00100     poser.Mode = "Fixed"
00101     poser.Position = [0,0,0]
00102 
00103     # momentum
00104     gun = app.property("ToolSvc.GtGunGenTool")
00105     gun.ParticlesPerEvent = 1
00106     gun.ParticleName = "e+"
00107     gun.Momentum = 3*units.MeV
00108     gun.MomentumMode = "Fixed"
00109     gun.DirectionMode = "Fixed"
00110     gun.Direction = [ 1,0,0 ]
00111 
00112     # translate from local volume to global
00113     trans = app.property("ToolSvc.GtTransformTool")
00114     trans.Volume = volume
00115     
00116     app.TopAlg += [ 'GtGenerator/gen' ]
00117     gen = app.algorithm("gen")
00118     gen.GenTools = [ "GtGunGenTool", "GtPositionerTool", "GtTimeratorTool", "GtTransformTool" ]
00119     gen.GenName = "Bang Bang"
00120     gen.OutputLevel=1
00121     pass
00122 
00123 # set up detsim
00124 if not input:
00125     modularPL = app.property("GiGa.GiGaPhysListModular")
00126     #modularPL.OutputLevel = 1
00127     modularPL.CutForElectron = 100*units.micrometer
00128     modularPL.CutForPositron = 100*units.micrometer
00129     modularPL.CutForGamma = 1*units.millimeter
00130     modularPL.PhysicsConstructors = [ 
00131         "DsPhysConsGeneral", 
00132         "DsPhysConsOptical",
00133         "DsPhysConsEM",
00134         #"DsPhysConsElectroNu",
00135         #"DsPhysConsHadron",
00136         #"DsPhysConsIon"
00137         ]
00138     optical = app.property("GiGa.GiGaPhysListModular.DsPhysConsOptical")
00139     #optical.UseCerenkov = False
00140     #optical.UseScintillation = False
00141 
00142     giga = app.service("GiGa")
00143     #giga.OutputLevel = 1
00144     giga.PhysicsList = "GiGaPhysListModular"
00145     giga.SteppingAction = "GiGaStepActionSequence"
00146     stepseq = app.property("GiGa.GiGaStepActionSequence")
00147     stepseq.Members = ["HistorianStepAction","UnObserverStepAction"]
00148 
00149     params = {
00150         'start' :"(start > 0)",
00151         'track1':"(id==1 and ProcessType==1)",
00152         'track2':"(id==2 and ProcessType==1)",
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.Stats=[
00161         ["pdgId_Trk1","pdg","%(track1)s and %(start)s"%params],
00162         ["t_Trk1",    "t" , "%(track1)s and %(start)s"%params],
00163         ["x_Trk1",    "lx", "%(track1)s and %(start)s"%params],
00164         ["y_Trk1",    "ly", "%(track1)s and %(start)s"%params],
00165         ["z_Trk1",    "lz", "%(track1)s and %(start)s"%params],
00166         ["e_Trk1",    "E",  "%(track1)s and %(start)s"%params],
00167         ["p_Trk1",    "p",  "%(track1)s and %(start)s"%params],
00168         ["ke_Trk1",   "KE", "%(track1)s and %(start)s"%params],
00169         ["vx_Trk1",   "lvx","%(track1)s and %(start)s"%params],
00170         ["vy_Trk1",   "lvy","%(track1)s and %(start)s"%params],
00171         ["vz_Trk1",   "lvz","%(track1)s and %(start)s"%params],
00172         ["TrkLength_GD_Trk1",  "dx","%(track1)s and %(GD)s"%params],
00173         ["TrkLength_iAV_Trk1", "dx","%(track1)s and %(iAV)s"%params],
00174         ["TrkLength_LS_Trk1",  "dx","%(track1)s and %(LS)s"%params],
00175         ["TrkLength_oAV_Trk1", "dx","%(track1)s and %(oAV)s"%params],
00176         ["TrkLength_Oil_Trk1", "dx","%(track1)s and %(oil)s"%params],
00177         # for track 2 now
00178         ["pdgId_Trk2","pdg","%(track2)s and %(start)s"%params],
00179         ["t_Trk2",    "t" , "%(track2)s and %(start)s"%params],
00180         ["x_Trk2",    "lx", "%(track2)s and %(start)s"%params],
00181         ["y_Trk2",    "ly", "%(track2)s and %(start)s"%params],
00182         ["z_Trk2",    "lz", "%(track2)s and %(start)s"%params],
00183         ["e_Trk2",    "E",  "%(track2)s and %(start)s"%params],
00184         ["p_Trk2",    "p",  "%(track2)s and %(start)s"%params],
00185         ["ke_Trk2",   "KE", "%(track2)s and %(start)s"%params],
00186         ["vx_Trk2",   "lvx","%(track2)s and %(start)s"%params],
00187         ["vy_Trk2",   "lvy","%(track2)s and %(start)s"%params],
00188         ["vz_Trk2",   "lvz","%(track2)s and %(start)s"%params],
00189         ["TrkLength_GD_Trk2",  "dx","%(track2)s and %(GD)s"%params],
00190         ["TrkLength_iAV_Trk2", "dx","%(track2)s and %(iAV)s"%params],
00191         ["TrkLength_LS_Trk2",  "dx","%(track2)s and %(LS)s"%params],
00192         ["TrkLength_oAV_Trk2", "dx","%(track2)s and %(oAV)s"%params],
00193         ["TrkLength_Oil_Trk2", "dx","%(track2)s and %(oil)s"%params]
00194         ]
00195 
00196     gggeo = app.service("GiGaGeo")
00197     #gggeo.OutputLevel = 1
00198     gggeo.XsizeOfWorldVolume = 2.4*units.kilometer
00199     gggeo.YsizeOfWorldVolume = 2.4*units.kilometer
00200     gggeo.ZsizeOfWorldVolume = 2.4*units.kilometer
00201     app.TopAlg += [ "GaudiSequencer/SimSeq" ]
00202     simseq = app.algorithm("SimSeq")
00203     simseq.Members = [ "GiGaInputStream/GGInStream" ]
00204 
00205     ggin = app.algorithm("GGInStream")
00206     #ggin.OutputLevel = 1
00207     ggin.ExecuteOnce = True
00208     ggin.ConversionSvcName = "GiGaGeo"
00209     ggin.DataProviderSvcName = "DetectorDataSvc"
00210     ggin.StreamItems = [ "/dd/Structure/Sites/far-rock",
00211                          "/dd/Geometry/AdDetails/AdSurfacesAll",
00212                          "/dd/Geometry/AdDetails/AdSurfacesFar",
00213                          "/dd/Geometry/PoolDetails/FarPoolSurfaces",
00214                          "/dd/Geometry/PoolDetails/PoolSurfacesAll",
00215                          ]
00216 
00217     simseq.Members += [ "DsPushKine/PushKine", "DsPullEvent/PullEvent" ]
00218     push = app.algorithm("PushKine")
00219     push.Converter = "HepMCtoG4"
00220     
00221     pull = app.algorithm("PullEvent")
00222     #pull.OutputLevel = 1
00223     
00224     # Class name to use is set in DetDesc xml's "sensdet" attribute.
00225     pmtsd = app.property("GiGaGeo.DsPmtSensDet")
00226     #pmtsd.OutputLevel = 2
00227     pass
00228 
00229 # setup elecsim
00230 if not input:
00231     app.TopAlg += [ "GaudiSequencer/ElecSeq" ]
00232     simseq = app.algorithm("ElecSeq")
00233     simseq.Members = [ "EsFrontEndAlg/FeeAlg" ]
00234     feeAlg = app.algorithm("FeeAlg")
00235     feeAlg.OutputLevel=3
00236     pass
00237 
00238 # setup trigsim
00239 if not input:
00240     mtool=app.property("ToolSvc.TsMultTriggerTool")
00241     mtool.OutputLevel=3
00242 
00243     app.TopAlg += [ "TsTriggerAlg/trig" ]
00244     trig=app.algorithm("trig")
00245     trig.OutputLevel=3
00246     trig.TrigTools=["TsMultTriggerTool"]
00247     pass
00248 
00249 if not input:
00250     fecRoTool=app.property("ToolSvc.ROsFecReadoutTool")
00251     fecRoTool.OutputLevel=2
00252     feeRoTool=app.property("ToolSvc.ROsFeeReadoutTool")
00253     feeRoTool.OutputLevel=2
00254     #feeRoTool.readoutCycles=[0,1,2,3,4,5,6,7]
00255     
00256     app.TopAlg += [ "ROsReadoutAlg/roa"]
00257     roa=app.algorithm("roa")
00258     roa.OutputLevel=1
00259     roa.RoTools=["ROsFecReadoutTool","ROsFeeReadoutTool"]
00260     pass 
00261     
00262 if input:
00263     rioes = app.service("RootIOEvtSelector")
00264     rioes.OutputLevel = 1
00265     pass
00266 
00267 if dump:
00268     app.TopAlg += [ 'RegSeqDumpAlg/rsd' ]
00269     rsd = app.algorithm("rsd")
00270     rsd.OutputLevel = 1
00271     pass
00272 
00273 if output:
00274     app.TopAlg += [ 'DybStoreAlg/dsa' ]
00275     dsa = app.algorithm("dsa")
00276     dsa.OutputLevel = 1
00277     pass
00278     
00279 # Run...
00280 app.initialize()
00281 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