|
24 | 24 | from Configurables import LcioEvent, MarlinProcessorWrapper
|
25 | 25 | from k4MarlinWrapper.parseConstants import *
|
26 | 26 |
|
| 27 | +from Configurables import ToolSvc, Lcio2EDM4hepTool, EDM4hep2LcioTool |
| 28 | +from Configurables import k4DataSvc, PodioInput, PodioOutput, EventDataSvc |
| 29 | + |
| 30 | +from k4FWCore import ApplicationMgr, IOSvc |
| 31 | + |
27 | 32 | algList = []
|
28 | 33 |
|
29 | 34 |
|
|
33 | 38 |
|
34 | 39 | parseConstants(CONSTANTS)
|
35 | 40 |
|
36 |
| - |
37 |
| -# For converters |
38 |
| -from Configurables import ToolSvc, Lcio2EDM4hepTool, EDM4hep2LcioTool |
39 |
| - |
40 |
| - |
41 |
| -from Configurables import k4DataSvc, PodioInput |
42 |
| - |
43 |
| -evtsvc = k4DataSvc("EventDataSvc") |
44 |
| -evtsvc.input = os.path.join( |
45 |
| - "$TEST_DIR/inputFiles/", os.environ.get("INPUTFILE", "ttbar_edm4hep_frame.root") |
| 41 | +parser.add_argument( |
| 42 | + "--iosvc", action="store_true", default=False, help="Use IOSvc instead of PodioDataSvc" |
46 | 43 | )
|
47 |
| - |
48 |
| - |
49 |
| -inp = PodioInput("InputReader") |
50 |
| -inp.OutputLevel = DEBUG |
51 |
| - |
| 44 | +parser.add_argument("--rec-output", default=False, help="Output file name for the REC file") |
| 45 | +parser.add_argument("--dst-output", default=False, help="Output file name for the DST file") |
| 46 | + |
| 47 | +args = parser.parse_known_args()[0] |
| 48 | + |
| 49 | +if args.iosvc: |
| 50 | + evtsvc = EventDataSvc("EventDataSvc") |
| 51 | + iosvc = IOSvc() |
| 52 | + iosvc.Input = os.path.join( |
| 53 | + "$TEST_DIR/inputFiles/", os.environ.get("INPUTFILE", "ttbar_edm4hep_frame.root") |
| 54 | + ) |
| 55 | + iosvc.Output = "my_output.root" |
| 56 | +else: |
| 57 | + evtsvc = k4DataSvc("EventDataSvc") |
| 58 | + evtsvc.input = os.path.join( |
| 59 | + "$TEST_DIR/inputFiles/", os.environ.get("INPUTFILE", "ttbar_edm4hep_frame.root") |
| 60 | + ) |
| 61 | + |
| 62 | + inp = PodioInput("InputReader") |
| 63 | + inp.OutputLevel = DEBUG |
| 64 | + |
| 65 | + out = PodioOutput("PodioOutput", filename="my_output.root") |
| 66 | + out.outputCommands = ["keep *"] |
52 | 67 |
|
53 | 68 | MyAIDAProcessor = MarlinProcessorWrapper("MyAIDAProcessor")
|
54 | 69 | MyAIDAProcessor.OutputLevel = WARNING
|
|
2429 | 2444 | }
|
2430 | 2445 |
|
2431 | 2446 |
|
2432 |
| -# Write output to EDM4hep |
2433 |
| -from Configurables import PodioOutput |
2434 |
| - |
2435 |
| -out = PodioOutput("PodioOutput", filename="my_output.root") |
2436 |
| -out.outputCommands = ["keep *"] |
2437 |
| - |
2438 |
| - |
2439 |
| -algList.append(inp) |
2440 | 2447 | algList.append(MyAIDAProcessor)
|
2441 | 2448 | algList.append(EventNumber)
|
2442 | 2449 | algList.append(InitDD4hep)
|
|
2486 | 2493 | # # algList.append(VertexFinderUnconstrained) # Config.VertexUnconstrainedON
|
2487 | 2494 | algList.append(Output_REC)
|
2488 | 2495 | algList.append(Output_DST)
|
2489 |
| -algList.append(out) |
2490 | 2496 |
|
2491 |
| -from Configurables import ApplicationMgr |
| 2497 | +if not args.iosvc: |
| 2498 | + algList = [inp] + algList + [out] |
2492 | 2499 |
|
2493 | 2500 | ApplicationMgr(TopAlg=algList, EvtSel="NONE", EvtMax=3, ExtSvc=[evtsvc], OutputLevel=WARNING)
|
0 commit comments