Skip to content
Snippets Groups Projects
Commit a2920197 authored by Teng Jian Khoo's avatar Teng Jian Khoo
Browse files

Dump output branch list with -O

parent 42068b40
No related branches found
No related tags found
No related merge requests found
......@@ -92,6 +92,15 @@ def defineArgs(flags):
const="analysis-variables.root",
help="Output ROOT file name",
)
add_analysis_arg(
"-O",
"--dump-output-branchlist",
action="store_true",
help=(
"enable output branch list dump."
"Will be written to output-branches-[out-file].txt"
)
)
add_analysis_arg(
"-m",
"--cache-metadata",
......
......@@ -72,7 +72,7 @@ declare -A TESTS=(
)
# some common variables in the tests
COMMON="-o"
COMMON="-o -O"
# specific tests
ntuple-dump() {
......
......@@ -161,6 +161,18 @@ def minituple_cfg(flags, trigger_chains, do_PRW=False, do_OR=False):
log.info("Add tree seq")
cfg.merge(tree_cfg(flags, branches=tree_branches))
if flags.Analysis.dump_output_branchlist:
outf_sub = flags.Analysis.out_file.replace('root','txt')
if '/' in outf_sub:
outf_dir, outf_sub = outf_sub.rsplit('/',1)
branches_fname = f"{outf_dir}/output-branches-{outf_sub}"
else:
branches_fname = f"output-branches-{outf_sub}"
with open(branches_fname,'w') as branches_f:
for b in tree_branches:
branches_f.write(f"{b}\n")
return cfg
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment