]> Creatis software - clitk.git/commitdiff
fixed clitkMergeRootFiles build
authorPierre Gueth <pierre.gueth@creatis.insa-lyon.fr>
Fri, 1 Feb 2013 15:31:19 +0000 (16:31 +0100)
committerDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Fri, 26 Jul 2013 06:32:31 +0000 (08:32 +0200)
tests_dav/clitkMergeRootFiles.cxx

index cb352bec897f6370e66335c3db2b557205d8ba9e..4c86c57068185856f6d83fa4eecc5419e2044646 100644 (file)
 #include "clitkMergeRootFiles_ggo.h"
 #include "clitkCommon.h"
 #include <string> 
-#include "TROOT.h"
-#include "TPluginManager.h"
-#include "TFile.h"
-#include "TFileMerger.h"
+#include <TROOT.h>
+#include <TPluginManager.h>
+#include <TFile.h>
+#include <TFileMerger.h>
+#include <TTree.h>
+#include <iostream>
+
+using std::endl;
+using std::cout;
 
 //-----------------------------------------------------------------------------
 int main(int argc, char * argv[]) {
@@ -30,6 +35,20 @@ int main(int argc, char * argv[]) {
     FATAL("Error, please provide at least two inputs files");
   }
 
+  // Detect Pet output
+  bool is_pet_output = true;
+  for (uint i=0; i<args_info.input_given; i++) 
+  {
+         const char* filename = args_info.input_arg[i];
+         TFile* handle = TFile::Open(filename,"READ");
+         TTree* hits = dynamic_cast<TTree*>(handle->Get("Hits"));
+         cout << "testing " << filename << " " << hits << endl;
+         handle->Close();
+         delete handle;
+         is_pet_output &= (hits==NULL);
+  }
+  cout << "is_pet_output " << is_pet_output << endl;
+
   // Merge
   TFileMerger * merger = new TFileMerger;
   for (uint i=0; i<args_info.input_given; i++) merger->AddFile(args_info.input_arg[i]);