15from argparse
import ArgumentParser
18if __name__ ==
'__main__':
19 parser = ArgumentParser()
20 parser.add_argument(
"input_file", help=
"Input file name")
21 parser.add_argument(
"output_file", help=
"Output file name")
22 parser.add_argument(
"--number", help=
"How many events should be converted", default=0, type=int)
24 args = parser.parse_args()
25 input_file = args.input_file
26 output_file = args.output_file
29 extension = os.path.splitext(input_file)[-1]
30 if extension ==
".root":
31 path.add_module(
"RootInput", inputFileName=input_file, branchNames=HLT_INPUT_OBJECTS)
32 elif extension ==
".sroot":
33 path.add_module(
"SeqRootInput", inputFileName=input_file)
35 raise AttributeError(f
"Do not understand file format of {input_file}")
37 path.add_module(
"Root2Raw", outputFileName=output_file)
38 basf2.process(path, args.number)