00001
00002
00003 import PyCintex
00004
00005 import sys
00006 try:
00007 io = sys.argv[1]
00008 except IndexError:
00009 io = "input"
00010 input = False
00011 if "input" == io: input = True
00012
00013 output = not input
00014 use_aes = True
00015
00016 import GaudiPython as gp
00017
00018 if use_aes:
00019
00020 iapp = gp.iService("ApplicationMgr")
00021 iapp.SvcMapping = [
00022 'EvtDataSvc/EventDataArchiveSvc',
00023 'DybDataSvc/EventDataSvc',
00024
00025 "DetDataSvc/DetectorDataSvc",
00026 "HistogramSvc/HistogramDataSvc",
00027 "HbookCnv::PersSvc/HbookHistSvc",
00028 "RootHistCnv::PersSvc/RootHistSvc",
00029 "EvtPersistencySvc/EventPersistencySvc",
00030 "DetPersistencySvc/DetectorPersistencySvc",
00031 "HistogramPersistencySvc/HistogramPersistencySvc",
00032 ]
00033
00034
00035 app = gp.AppMgr(outputlevel=1)
00036 app.OutputLevel = 1
00037
00038 msg = app.service("MessageSvc")
00039
00040 msg.Format = "% F%25W%S%7W%R%T %0W%M"
00041 msg.useColors = False
00042 msg.fatalColorCode=['red','white']
00043 msg.errorColorCode=['red']
00044 msg.warningColorCode=['yellow']
00045 msg.debugColorCode=['blue']
00046 msg.verboseColorCode=['cyan']
00047
00048
00049 app.EvtMax = 3
00050 if input:
00051 app.EvtSel =""
00052 else:
00053 app.EvtSel = "NONE"
00054
00055 if input:
00056
00057 app.ExtSvc += [ "DybEvtSelector/EventSelector" ]
00058 if output:
00059 app.ExtSvc += [ "DybStorageSvc" ]
00060 dss = app.service("DybStorageSvc")
00061 dss.OutputLevel = 1
00062
00063 app.ExtSvc += [ "RootIOCnvSvc" ]
00064
00065 per = app.service("EventPersistencySvc")
00066 per.CnvServices = [ "RootIOCnvSvc" ];
00067
00068 eds = app.service("EventDataService")
00069 eds.OutputLevel = 1
00070
00071 rio = app.property("RootIOCnvSvc")
00072 rio.OutputLevel = 1
00073 if input:
00074 rio.InputStreams = { "/Event/foo": "foo.root",
00075 "default": "default.root" }
00076 if output:
00077 rio.OutputStreams = { "/Event/foo": "foo.root",
00078 "default": "default.root" }
00079
00080
00081 if input:
00082 rioes = app.service("RootIOEvtSelector")
00083 rioes.OutputLevel = 1
00084 else:
00085 spew = app.algorithm("spew")
00086 spew.OutputLevel = 1
00087
00088 app.TopAlg = [ ]
00089
00090 if not input:
00091 app.TopAlg += [ 'ObjectSpew/spew' ]
00092
00093 app.TopAlg += [ 'SimpleInputModule/sim' ]
00094
00095 if output:
00096
00097 app.TopAlg += [ 'DybStoreAlg/som' ]
00098
00099 sim = app.algorithm("sim")
00100 sim.OutputLevel = 1
00101
00102 if output:
00103 som = app.algorithm("som")
00104 som.OutputLevel = 1
00105
00106
00107 app.initialize()
00108 app.run(app.EvtMax)