1 #include "merge/merge.C"
5 ::printf(
"Gaudi merge facility for ROOT tree based files.\n"
7 "gaudi_merge -o <output-file> -i <input-file 1> [ -i <input-file 2> ...]\n\n"
8 "input- and output files may specify any legal (ROOT) file name.\n"
9 " -output Specify output file name.\n"
10 " -input Specify input file name.\n"
11 " -debug Switch debug flag on.\n"
17 bool dbg =
false, fixup=
true;
21 if ( *argv[
i] ==
'-' ) {
30 if (
i+1 < argc ) output = argv[
i+1];
34 if (
i+1 < argc ) input.push_back(argv[
i+1]);
42 if ( input.empty() ) {
43 ::printf(
"\nERROR: No input file(s) supplied\n\n");
46 else if ( output.empty() ) {
47 ::printf(
"\nERROR: No output file supplied.\n\n");
50 gROOT->SetBatch(kTRUE);
51 for(
size_t i=0;
i<input.size();++
i) {
52 const string& in = input[
i];
53 bool do_fixup = fixup && ((
i+1)==input.size());
56 int result =
merge(output.c_str(),in.c_str(),do_fixup,dbg);
57 if ( result == MERGE_ERROR ) {
58 printf(
"\nERROR: File merge failed after %ld files.\n\n",
long(
i+1));