From dd5763577ecf4cfe20dc12a0bef6f7625010ee7b Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Wed, 21 Feb 2024 18:41:41 +0100 Subject: [PATCH] Add an rntuple option --- scripts/createEDM4hepFile.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/createEDM4hepFile.py b/scripts/createEDM4hepFile.py index 039ce63fa..2e41b8155 100644 --- a/scripts/createEDM4hepFile.py +++ b/scripts/createEDM4hepFile.py @@ -6,6 +6,7 @@ import cppyy.ll from itertools import count import argparse +import sys frames = 10 # How many frames or events will be written vectorsize = 5 # For vector members, each vector member will have this size @@ -15,8 +16,19 @@ parser = argparse.ArgumentParser(description='Create a file with EDM4hep data') parser.add_argument('--use-pre1', action='store_true', help='Use a pre 1.0 version of EDM4hep') +parser.add_argument('--rntuple', action='store_true', help='Use a ROOT ntuple instead of EDM4hep') args = parser.parse_args() +if args.rntuple: + try: + writer = podio.root_io.ROOTNTupleWriter(output_file) + except AttributeError: + writer = podio.root_io.ROOTRNTupleWriter(output_file) + except AttributeError: + print('The RNTuple writer from podio is not available but was requested') + sys.exit(1) + + writer = podio.root_io.Writer(output_file) for i in range(frames):