00001
00002 '''
00003 Test the DybInputLoadTool and DybEntryPolicyTool
00004
00005 nuwa.py -n 10 -o output.root -m 'TestLoader [opts] input.root ...'
00006 nuwa.py -n 10 -o output.root -m "TestLoader [-t test_type] -I {'input1.root':1,'dd.root':'default','input2.root':2}"
00007
00008 '''
00009
00010 from DybPython.Tools import mapify
00011
00012 def configure(argv=None):
00013 if argv is None: argv = list()
00014
00015
00016 from optparse import OptionParser
00017 parser = OptionParser(usage=__doc__)
00018 parser.add_option("-I", "--input-streams",default="{}",
00019 help="Input file map")
00020 parser.add_option("-t","--test-type",type="int",default=0,
00021 help="Test type [0-4]");
00022
00023 opts,args = parser.parse_args(args=argv)
00024
00025
00026 print opts.input_streams
00027 opts.input_streams = eval(opts.input_streams)
00028 print opts.input_streams
00029
00030
00031 try:
00032 default = opts.input_streams['default']
00033 except KeyError:
00034 default = []
00035 default += args
00036 opts.input_streams['default'] = default
00037
00038 from Gaudi.Configuration import ApplicationMgr
00039 theApp = ApplicationMgr()
00040
00041
00042 from RootIOSvc.RootIOSvcConf import RootIOCnvSvc
00043 rio = RootIOCnvSvc()
00044 theApp.ExtSvc.append(rio)
00045
00046 from RootIOSvc import wash_streams
00047 print opts.input_streams
00048 rio.InputStreams = wash_streams(opts.input_streams)
00049
00050 from DybIO.DybIOConf import TestInputLoadAlg, DybInputLoadTool, DybNextEntryPolicyTool
00051 alg = TestInputLoadAlg()
00052
00053 loader = DybInputLoadTool()
00054 loader.RootIOSvc = rio
00055 loader.ConversionSvc = rio
00056 alg.Loader = loader
00057
00058 policy = DybNextEntryPolicyTool()
00059 policy.Start = 0
00060 policy.Mode = "sequential"
00061 alg.Policy = policy
00062
00063 alg.Path = '/Event/Sim/SimHeader'
00064 alg.TestType = int(opts.test_type)
00065
00066 theApp.TopAlg.append(alg);
00067 return
00068