Skip to content

Commit 8848962

Browse files
committed
Switch event_display example to use new functionality
1 parent 4b557ba commit 8848962

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

k4MarlinWrapper/examples/event_display.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
#
2020

2121
from Gaudi.Configuration import INFO
22-
from Configurables import MarlinProcessorWrapper, k4DataSvc, GeoSvc
22+
from Configurables import MarlinProcessorWrapper, EventDataSvc, GeoSvc
23+
from k4FWCore import ApplicationMgr, IOSvc
2324
from k4FWCore.parseArgs import parser
24-
from k4MarlinWrapper.inputReader import create_reader, attach_edm4hep2lcio_conversion
25+
from k4MarlinWrapper.io_helpers import IOHandlerHelper
2526

2627

2728
parser.add_argument(
@@ -42,25 +43,18 @@
4243
reco_args = parser.parse_known_args()[0]
4344

4445
algList = []
45-
svcList = []
46-
47-
evtsvc = k4DataSvc("EventDataSvc")
48-
svcList.append(evtsvc)
46+
svcList = [EventDataSvc("EventDataSvc")]
4947

48+
iosvc = IOSvc()
5049

5150
geoSvc = GeoSvc("GeoSvc")
5251
geoSvc.detectors = [reco_args.compactFile]
5352
geoSvc.OutputLevel = INFO
5453
geoSvc.EnableGeant4Geo = False
5554
svcList.append(geoSvc)
5655

57-
58-
if reco_args.inputFiles:
59-
read = create_reader(reco_args.inputFiles, evtsvc)
60-
read.OutputLevel = INFO
61-
algList.append(read)
62-
else:
63-
read = None
56+
io_handler = IOHandlerHelper(algList, iosvc)
57+
io_handler.add_reader(reco_args.inputFiles)
6458

6559
MyCEDViewer = MarlinProcessorWrapper("MyCEDViewer")
6660
MyCEDViewer.OutputLevel = INFO
@@ -527,8 +521,8 @@
527521
algList.append(MyCEDViewer)
528522

529523
# We need to convert the inputs in case we have EDM4hep input
530-
attach_edm4hep2lcio_conversion(algList, read)
524+
io_handler.finalize_converters()
531525

532-
from Configurables import ApplicationMgr
533-
534-
ApplicationMgr(TopAlg=algList, EvtSel="NONE", EvtMax=10, ExtSvc=svcList, OutputLevel=INFO)
526+
ApplicationMgr(
527+
TopAlg=algList, EvtSel="NONE", EvtMax=10, ExtSvc=svcList, OutputLevel=INFO
528+
)

0 commit comments

Comments
 (0)