1 #include "merge/merge.C" 6 ::printf(
"Gaudi merge facility for ROOT tree based files.\n" 8 "gaudi_merge -o <output-file> -i <input-file 1> [ -i <input-file 2> ...]\n\n" 9 "input- and output files may specify any legal (ROOT) file name.\n" 10 " -output Specify output file name.\n" 11 " -input Specify input file name.\n" 12 " -debug Switch debug flag on.\n" );
16 static ErrorHandlerFunc_t s_err =
nullptr;
17 static void err_handler( Int_t
level, Bool_t abort_bool,
const char*
location,
const char*
msg ) {
18 if ( msg &&
strstr( msg,
"no dictionary for class" ) )
return;
19 s_err( level, abort_bool, location, msg );
23 bool dbg =
false, fixup =
true;
26 for (
int i = 1; i <
argc; ++i ) {
27 if ( *argv[i] ==
'-' ) {
28 switch ( ::
toupper( *( argv[i] + 1 ) ) ) {
36 if ( i + 1 < argc ) output = argv[i + 1];
40 if ( i + 1 < argc ) input.push_back( argv[i + 1] );
48 if ( input.empty() ) {
49 ::printf(
"\nERROR: No input file(s) supplied\n\n" );
51 }
else if ( output.empty() ) {
52 ::printf(
"\nERROR: No output file supplied.\n\n" );
55 gROOT->SetBatch( kTRUE );
56 s_err = SetErrorHandler( err_handler );
57 for (
size_t i = 0; i < input.size(); ++i ) {
58 const string& in = input[i];
59 bool do_fixup = fixup && ( ( i + 1 ) == input.size() );
62 int result = merge( output.c_str(), in.c_str(), do_fixup, dbg );
63 if ( result == MERGE_ERROR ) {
64 printf(
"\nERROR: File merge failed after %ld files.\n\n",
long( i + 1 ) );
void usage(std::string argv0)
int main(int argc, char **argv)
void toupper(std::string &s)