HADD
Combine ntuples using the ROOT hadd command line tool
URL: https://root.cern/doc/master/hadd_8cxx.html
Example
This wrapper can be used in the following way:
rule hadd:
input:
expand("ntuple{n}.root", n=range(3)),
log:
"logs/hadd/hadd.log",
params:
extra="-f5",
threads: 2
output:
"ntuple.root",
wrapper:
"v3.8.0/phys/root/hadd"
Note that input, output and log file paths can be chosen freely.
When running with
snakemake --use-conda
the software dependencies will be automatically deployed into an isolated environment before execution.
Software dependencies
ROOT>6.24.0
Input/Output
Input:
ROOT files to be combined.
Output:
single ROOT file containing contents of input files.
Params
extra: extra parameters to hadd (see ROOT documentation, e.g. -f[0-9] for compression levels)
Code
__author__ = "Jamie Gooding"
__copyright__ = "Copyright 2024, Jamie Gooding"
__email__ = "jamie.gooding@cern.ch"
__license__ = "MIT"
from snakemake.shell import shell
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell()
shell("hadd -j {snakemake.threads} {extra} {snakemake.output} {snakemake.input} {log}")