Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
hadd-argparse.py
Go to the documentation of this file.
1import argparse
2import textwrap
3
4
6 DESCRIPTION = textwrap.fill(
7 "This program will add histograms, trees and other objects from a list "
8 "of ROOT files and write them to a target ROOT file. The target file is "
9 "newly created and must not exist, or if -f (\"force\") is given, must "
10 "not be one of the source files.")
11
12 EPILOGUE = textwrap.fill(
13 "If TARGET and SOURCES have different compression settings a slower "
14 "method is used. For options that takes a size as argument, a decimal "
15 "number of bytes is expected. If the number ends with a ``k'', ``m'', "
16 "``g'', etc., the number is multiplied by 1000 (1K), 1000000 (1MB), "
17 "1000000000 (1G), etc. If this prefix is followed by i, the number is "
18 "multiplied by the traditional 1024 (1KiB), 1048576 (1MiB), 1073741824 "
19 "(1GiB), etc. The prefix can be optionally followed by B whose casing "
20 "is ignored, eg. 1k, 1K, 1Kb and 1KB are the same. ")
21 parser = argparse.ArgumentParser(add_help=False, prog='hadd',
22 description=DESCRIPTION, epilog=EPILOGUE)
23 parser.add_argument("-a", help="Append to the output", action = 'store_true')
24 parser.add_argument("-f", help=textwrap.fill(
25 "Force overwriting of output file"), action = 'store_true')
26 parser.add_argument("-f[0-9]", help=textwrap.fill(
27 "Gives the ability to specify the compression algorithm i and level j of the target file, "
28 "by passing the number i*100 + j, e.g. -f505. "
29 "The last digit (j) can be set from 0 = uncompressed to 9 = highly compressed. "
30 "The first digit (i) is 1 for ZLIB, 2 for LZMA, 4 for LZ4 and 5 for ZSTD. "
31 "Recommended numbers are 101 (ZLIB), 207 (LZMA), 404 (LZ4), 505 (ZSTD). "
32 "The default value for this flag is 101 (kDefaultZLIB). "
33 "See ROOT::RCompressionSetting and TFile::TFile documentation for more details."), action = 'store_true')
34 parser.add_argument("-fk", help=textwrap.fill(
35 "Sets the target file to contain the baskets with the same compression "
36 "as the input files (unless -O is specified). Compresses the meta data "
37 "using the compression level specified in the first input or the "
38 "compression setting after fk (for example 206 when using -fk206)"), action = 'store_true')
39 parser.add_argument("-ff", help="The compression level use is the one specified in the first input", action = 'store_true')
40 parser.add_argument("-k", help="Skip corrupt or non-existent files, do not exit", action = 'store_true')
41 parser.add_argument("-L", help=textwrap.fill(
42 "Read the list of objects from FILE and either only merge or skip those objects depending on "
43 "the value of \"-Ltype\". FILE must contain one object name per line, which cannot contain "
44 "whitespaces or '/'. You can also pass TDirectory names, which apply to the entire directory "
45 "content. Lines beginning with '#' are ignored. If this flag is passed, \"-Ltype\" MUST be "
46 "passed as well."), action = 'store_true')
47 parser.add_argument("-Ltype", help=textwrap.fill(
48 "Sets the type of operation performed on the objects listed in FILE given with the "
49 "\"-L\" flag. \"SkipListed\" will skip all the listed objects; \"OnlyListed\" will only merge those "
50 "objects. If this flag is passed, \"-L\" must be passed as well."), action = 'store_true')
51 parser.add_argument("-O", help="Re-optimize basket size when merging TTree", action = 'store_true')
52 parser.add_argument("-T", help="Do not merge Trees", action = 'store_true')
53 parser.add_argument("-v", help=textwrap.fill(
54 "Explicitly set the verbosity level: 0 request no output, 99 is the default"))
55 parser.add_argument("-j", help=textwrap.fill(
56 "Parallelize the execution in 'J' processes. If the number of "
57 "processes is not specified, use the system maximum."))
58 parser.add_argument("-dbg", help=textwrap.fill(
59 "Enable verbosity. If -j was specified, do not not delete partial files "
60 "stored inside working directory."), action = 'store_true')
61 parser.add_argument("-d", help=textwrap.fill(
62 "Carry out the partial multiprocess execution in the specified directory"))
63 parser.add_argument("-n", help=textwrap.fill(
64 "Open at most 'N' files at once (use 0 to request to use the system maximum)"))
65 parser.add_argument("-cachesize", help=textwrap.fill(
66 "Resize the prefetching cache use to speed up I/O operations (use 0 to disable)"))
67 parser.add_argument("-experimental-io-features", help=textwrap.fill(
68 "Used with an argument provided, enables the corresponding experimental "
69 "feature for output trees. See ROOT::Experimental::EIOFeatures"))
70 parser.add_argument("TARGET", help="Target file")
71 parser.add_argument("SOURCES", help="Source files")
72 return parser