#include "Compression.h"
#include <ROOT/RConfig.hxx>
#include "ROOT/TIOFeatures.hxx"
#include "TFile.h"
#include "THashList.h"
#include "TKey.h"
#include "TClass.h"
#include "TSystem.h"
#include "TUUID.h"
#include "ROOT/StringConv.hxx"
#include "snprintf.h"
#include <string>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <climits>
#include <sstream>
#include "haddCommandLineOptionsHelp.h"
#include "TFileMerger.h"
#include "ROOT/TProcessExecutor.hxx"
Functions | |
int | main (int argc, char **argv) |
This program will add histograms (see note) and Trees from a list of root files and write them to a target root file.
The target file is newly created and must not be identical to one of the source files.
Syntax:
or
(targetfile is overwritten if it exists)
-a | Append to the output |
-f | Force overwriting of output file. |
-f[0-9] | Set target compression level. 0 = uncompressed, 9 = highly compressed. Default is 1 (kDefaultZLIB). You can also specify the full compresion algorithm, e.g. -f206 |
-fk | Sets the target file to contain the baskets with the same compression as the input files (unless -O is specified). Compresses the meta data using the compression level specified in the first input or the compression setting after fk (for example 206 when using -fk206) |
-ff | The compression level used is the one specified in the first input |
-k | Skip corrupt or non-existent files, do not exit |
-O | Re-optimize basket size when merging TTree |
-T | Do not merge Trees |
-v | Explicitly set the verbosity level: 0 request no output, 99 is the default |
-j | Parallelise the execution in J processes. If the number of processes is not specified, use the system maximum. |
-dbg | Enable verbosity. If -j was specified, do not not delete partial files stored inside working directory. |
-d | Carry out the partial multiprocess execution in the specified directory |
-n | Open at most N files at once (use 0 to request to use the system maximum) |
-cachesize | Resize the prefetching cache use to speed up I/O operations (use 0 to disable). |
-experimental-io-features | <feature> Enables the corresponding experimental feature for output trees. |
For example assume 3 files f1, f2, f3 containing histograms hn and Trees Tn
The files may contain sub-directories.
If the source files contains histograms and Trees, one can skip the Trees with
Wildcarding and indirect files are also supported
will merge all files in myfil*.root
will merge file1.root, file2.root, all files in myfil*.root and all files in the indirect text file list.txt ("@" as the first character of the file indicates an indirect file. An indirect file is a text file containing a list of other files, including other indirect files, one line per file).
If the sources and and target compression levels are identical (default), the program uses the TChain::Merge function with option "fast", ie the merge will be done without unzipping or unstreaming the baskets (i.e. direct copy of the raw byte on disk). The "fast" mode is typically 5 times faster than the mode unzipping and unstreaming the baskets.
If the option -cachesize is used, hadd will resize (or disable if 0) the prefetching cache use to speed up I/O operations.
For options that take a size as argument, a decimal number of bytes is expected. If the number ends with a k
, m
, g
, etc., the number is multiplied by 1000 (1K), 1000000 (1MB), 1000000000 (1G), etc. If this prefix is followed by i
, the number is multiplied by the traditional 1024 (1KiB), 1048576 (1MiB), 1073741824 (1GiB), etc. The prefix can be optionally followed by B whose casing is ignored, eg. 1k, 1K, 1Kb and 1KB are the same.
Definition in file hadd.cxx.