12from mdst
import add_mdst_output
16def prepare_path(File1, File2, FileOut):
17 """Prepare path for event embedding.
19 File1: primary input file (ROE)
20 File2: secondary input file (truth-matched signal)
21 FileOut: output embedded file.
25 input1 = basf2.register_module('RootInput')
26 input1.param(
'inputFileName', File1)
27 main.add_module(input1).set_name(
"input1")
30 input2 = basf2.register_module(
'RootInput')
31 input2.param(
'inputFileName', File2)
32 input2.param(
'isSecondaryInput',
True)
33 indep.add_module(input2).set_name(
"input2")
38 main.add_independent_merge_path(
40 merge_back_event=branches)
42 main.add_module(
'FixMergedObjects')
43 main.add_module(
"PostMergeUpdater")
47 additionalBranches = [
'MergedArrayIndices',
48 'EventLevelClusteringInfo_indepPath',
49 'EventLevelTrackingInfo_indepPath',
50 'EventMetaData_indepPath',
51 'TRGSummary_indepPath',
52 'SoftwareTriggerResult_indepPath'
56 add_mdst_output(main, filename=FileOut, additionalBranches=additionalBranches)
62 """Handles the command-line argument parsing.
65 argparse.Namespace: The parsed arguments.
67 parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
68 parser.add_argument('--filePrimary', help=
'Input file to be used as a primary (tag-side data or MC)', required=
True)
69 parser.add_argument(
'--fileSecondary', help=
'Input file to be used as a secondary (signal-side MC)', required=
True)
70 parser.add_argument(
"--fileOut", default=
'merged.root', help=
'Output file name')
74if __name__ ==
'__main__':
75 args = get_parser().parse_args()
77 path = prepare_path(args.filePrimary, args.fileSecondary, args.fileOut)
79 path.add_module(
'Progress')
81 print(basf2.statistics)