diff --git a/k4MarlinWrapper/python/k4MarlinWrapper/inputReader.py b/k4MarlinWrapper/python/k4MarlinWrapper/inputReader.py index 99879862..d60afc10 100644 --- a/k4MarlinWrapper/python/k4MarlinWrapper/inputReader.py +++ b/k4MarlinWrapper/python/k4MarlinWrapper/inputReader.py @@ -18,7 +18,7 @@ # import sys -from Configurables import LcioEvent, PodioInput +from Configurables import LcioEvent, PodioInput, MarlinProcessorWrapper, EDM4hep2LcioTool def create_reader(input_files, evtSvc): """Create the appropriate reader for the input files""" @@ -37,3 +37,20 @@ def create_reader(input_files, evtSvc): evtSvc.inputs = input_files return read + + +def attach_edm4hep2lcio_conversion(algList, read): + if not isinstance(read, PodioInput): + # nothing to convert :) + return + + # find first wrapper + for alg in algList: + if (isinstance(alg, MarlinProcessorWrapper)): + break + + EDM4hep2LcioInput = EDM4hep2LcioTool("InputConversion") + EDM4hep2LcioInput.convertAll = True + # Adjust for the different naming conventions + EDM4hep2LcioInput.collNameMapping = {"MCParticles": "MCParticle"} + alg.EDM4hep2LcioTool = EDM4hep2LcioInput