]> Creatis software - clitk.git/blob - tests_dav/clitkMergeRootFiles.cxx
cb352bec897f6370e66335c3db2b557205d8ba9e
[clitk.git] / tests_dav / clitkMergeRootFiles.cxx
1 /**
2    =================================================
3    * @file   clitkMergeRootFiles.cxx
4    * @author David Sarrut <david.sarrut@creatis.insa-lyon.fr>
5    * @date   01 Apr 2009
6    * 
7    * @brief  
8    * 
9    =================================================*/
10
11 #include "clitkMergeRootFiles_ggo.h"
12 #include "clitkCommon.h"
13 #include <string> 
14 #include "TROOT.h"
15 #include "TPluginManager.h"
16 #include "TFile.h"
17 #include "TFileMerger.h"
18
19 //-----------------------------------------------------------------------------
20 int main(int argc, char * argv[]) {
21
22   gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo", "*",
23       "TStreamerInfo", "RIO", "TStreamerInfo()");
24
25   // init command line
26   GGO(clitkMergeRootFiles, args_info);
27
28   // Check parameters
29   if (args_info.input_given < 2) {
30     FATAL("Error, please provide at least two inputs files");
31   }
32
33   // Merge
34   TFileMerger * merger = new TFileMerger;
35   for (uint i=0; i<args_info.input_given; i++) merger->AddFile(args_info.input_arg[i]);
36   merger->OutputFile(args_info.output_arg);
37   merger->Merge();
38
39   // this is the end my friend  
40   return 0;
41 }
42 //-----------------------------------------------------------------------------