2 =================================================
3 * @file clitkMergeRootFiles.cxx
4 * @author David Sarrut <david.sarrut@creatis.insa-lyon.fr>
9 =================================================*/
11 #include "clitkMergeRootFiles_ggo.h"
12 #include "clitkCommon.h"
15 #include <TPluginManager.h>
17 #include <TFileMerger.h>
24 //-----------------------------------------------------------------------------
25 int main(int argc, char * argv[]) {
27 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo", "*",
28 "TStreamerInfo", "RIO", "TStreamerInfo()");
31 GGO(clitkMergeRootFiles, args_info);
34 if (args_info.input_given < 2) {
35 FATAL("Error, please provide at least two inputs files");
39 bool is_pet_output = true;
40 for (uint i=0; i<args_info.input_given; i++)
42 const char* filename = args_info.input_arg[i];
43 TFile* handle = TFile::Open(filename,"READ");
44 TTree* hits = dynamic_cast<TTree*>(handle->Get("Hits"));
45 cout << "testing " << filename << " " << hits << endl;
48 is_pet_output &= (hits==NULL);
50 cout << "is_pet_output " << is_pet_output << endl;
53 TFileMerger * merger = new TFileMerger;
54 for (uint i=0; i<args_info.input_given; i++) merger->AddFile(args_info.input_arg[i]);
55 merger->OutputFile(args_info.output_arg);
58 // this is the end my friend
61 //-----------------------------------------------------------------------------