113#include "haddCommandLineOptionsHelp.h"
124 if (
argc < 3 ||
"-h" == std::string(
argv[1]) ||
"--help" == std::string(
argv[1]) ) {
126 return (
argc == 2 && (
"-h" == std::string(
argv[1]) ||
"--help" == std::string(
argv[1]))) ? 0 : 1;
149 for(
int a = 1;
a <
argc; ++
a ) {
172 std::cerr <<
"Error: could not access the directory specified: " <<
argv[
a + 1]
173 <<
". We will use the system's temporal directory.\n";
180 std::cout <<
"-d: no directory specified. We will use the system's temporal directory.\n";
188 for (
char *
c =
argv[
a + 1]; *
c !=
'\0'; ++
c) {
191 std::cerr <<
"Error: could not parse the number of processes to run in parallel passed after -j: "
192 <<
argv[
a + 1] <<
". We will use the system maximum.\n";
203 std::cout <<
"Parallelizing with " <<
nProcesses <<
" processes.\n";
205 std::cerr <<
"Error: could not parse the number of processes to use passed after -j: " <<
argv[
a + 1]
206 <<
". We will use the default value (number of logical cores).\n";
217 std::cerr <<
"Error: could not parse the cache size passed after -cachesize: "
218 <<
argv[
a + 1] <<
". We will use the default value.\n";
221 const char *
munit =
nullptr;
223 std::cerr <<
"Error: the cache size passed after -cachesize is too large: "
224 <<
argv[
a + 1] <<
" is greater than " <<
m <<
munit
225 <<
". We will use the default value.\n";
227 cacheSize =
"cachesize=";
233 std::cerr <<
"Error: no cache size number was provided after -cachesize.\n";
238 std::cerr <<
"Error: could not parse the cache size passed after -cachesize: "
239 <<
argv[
a + 1] <<
". We will use the default value.\n";
242 const char *
munit =
nullptr;
244 std::cerr <<
"Error: the cache size passed after -cachesize is too large: "
245 <<
argv[
a + 1] <<
" is greater than " <<
m <<
munit
246 <<
". We will use the default value.\n";
250 cacheSize =
"cachesize=";
257 }
else if (!
strcmp(
argv[
a],
"-experimental-io-features")) {
259 std::cerr <<
"Error: no IO feature was specified after -experimental-io-features; ignoring\n";
261 std::stringstream
ss;
265 while (std::getline(
ss, item,
',')) {
267 std::cerr <<
"Ignoring unknown feature request: " << item << std::endl;
274 std::cerr <<
"Error: no maximum number of opened was provided after -n.\n";
282 std::cerr <<
"Error: could not parse the max number of opened file passed after -n: " <<
argv[
a+1] <<
". We will use the system maximum.\n";
294 for (
char *
c =
argv[
a+1]; *
c !=
'\0'; ++
c) {
309 std::cerr <<
"Error: could not parse the verbosity level passed after -v: " <<
argv[
a+1] <<
". We will use the default value (99).\n";
314 }
else if (
argv[
a][0] ==
'-' ) {
318 std::cerr <<
"Error: Using option " <<
argv[
a] <<
" more than once is not supported.\n";
322 const char *prefix =
"";
333 if (
argv[
a][3] !=
'\0') {
334 std::cerr <<
"Error: option -ff should not have any suffix: " <<
argv[
a] <<
" (suffix has been ignored)\n";
339 for(
int j=0;
j<=9; ++
j ) {
352 std::cerr <<
"Error: option " <<
argv[
a] <<
" is not a supported option.\n";
370 std::cout <<
"hadd Target file: " <<
targetname << std::endl;
389 std::cerr <<
"hadd could not open indirect file " << (
argv[
a] + 1) << std::endl;
397 std::cerr <<
"hadd could not validate the file name \"" <<
line <<
"\" within indirect file "
398 << (
argv[
a] + 1) << std::endl;
409 std::cerr <<
"hadd could not validate argument \"" <<
line <<
"\" as input file " << std::endl;
417 std::cerr <<
"hadd could not find any valid input file " << std::endl;
436 std::cout <<
"hadd compression setting for meta data: " <<
newcomp <<
'\n';
438 std::cout <<
"hadd compression setting for all output: " <<
newcomp <<
'\n';
442 std::cerr <<
"hadd error opening target file for update :" <<
argv[
ffirst-1] <<
"." << std::endl;
446 std::cerr <<
"hadd error opening target file (does " <<
argv[
ffirst-1] <<
" exist?)." << std::endl;
447 if (!
force) std::cerr <<
"Pass \"-f\" argument to force re-creation of output file." << std::endl;
456 std::cout <<
"Each process should handle at least 3 files for efficiency.";
457 std::cout <<
" Setting the number of processes to: " <<
nProcesses << std::endl;
471 for (
auto i = 0; (i * step) <
allSubfiles.size(); i++) {
472 std::stringstream buffer;
485 std::cout <<
"hadd Sources and Target have different compression levels" << std::endl;
486 std::cout <<
"hadd merging will be slower" << std::endl;
490 merger.SetMergeOptions(cacheSize);
504 std::cerr <<
"hadd skipping file with error: " <<
allSubfiles[i] << std::endl;
506 std::cerr <<
"hadd exiting due to error in " <<
allSubfiles[i] << std::endl;
522 std::cerr <<
"hadd error opening target partial file" << std::endl;
541 status = std::accumulate(res.begin(), res.end(), 0U) ==
partialFiles.size();
545 std::cout <<
"hadd failed at the parallel stage" << std::endl;
562 <<
") input (partial) files into " <<
targetname <<
".\n";
567 std::cout <<
"hadd failure during the merge of " <<
allSubfiles.size() <<
" ("
568 <<
fileMerger.GetMergeList()->GetEntries() <<
") input (partial) files into " <<
targetname <<
".\n";
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
R__EXTERN TSystem * gSystem
TIOFeatures provides the end-user with the ability to change the IO behavior of data written via a TT...
This class provides a simple interface to execute the same task multiple times in parallel,...
This class provides file copy and merging services.
@ kAll
Merge all type of objects (default)
@ kIncremental
Merge the input file with the content of the output file (if already existing).
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
TString & Append(const char *cs)
virtual int GetSysInfo(SysInfo_t *info) const
Returns static system info, like OS type, CPU type, number of CPUs RAM size, etc into the SysInfo_t s...
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual int Unlink(const char *name)
Unlink, i.e.
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
void ToHumanReadableSize(value_type bytes, Bool_t si, Double_t *coeff, const char **units)
Return the size expressed in 'human readable' format.
EFromHumanReadableSize FromHumanReadableSize(std::string_view str, T &value)
Convert strings like the following into byte counts 5MB, 5 MB, 5M, 3.7GB, 123b, 456kB,...
@ kUseCompiledDefault
Use the compile-time default setting.