]> Creatis software - clitk.git/blob - tools/GateMergeManager.hh
Debug clitkNormalizeImage
[clitk.git] / tools / GateMergeManager.hh
1 /*----------------------
2    GATE version name: gate_v...
3
4    Copyright (C): OpenGATE Collaboration
5
6 This software is distributed under the terms
7 of the GNU Lesser General  Public Licence (LGPL)
8 See GATE/LICENSE.txt for further details
9 ----------------------*/
10
11
12 #ifndef GateMergeManager_h
13 #define GateMergeManager_h 1
14 #include <iostream>
15 #include <string>
16 #include <vector>
17 #include <TFile.h>
18 #include <TChain.h>
19 #include <cstdlib>
20 #include <list>
21
22 using namespace std;
23 typedef list<string> Strings;
24
25 class GateMergeManager
26 {
27 public:
28
29   GateMergeManager(bool fastMerge,int verboseLevel,bool forced,Long64_t maxRoot,string outDir){
30      m_verboseLevel = verboseLevel;
31      m_forced       =       forced;
32      m_maxRoot      =      maxRoot;
33      m_outDir       =       outDir;
34      m_CompLevel    =            1;
35      m_fastMerge    =    fastMerge;
36   };
37   ~GateMergeManager()
38   {
39           for (std::vector<TFile*>::const_iterator iter=filearr.begin(); iter!=filearr.end(); iter++)
40           {
41                   (*iter)->Close();
42                   delete *iter;
43           }
44   }
45
46
47   void StartMerging(string splitfileName);
48   void StartMergingFromFilenames(Strings filenames, string outputfile);
49   void ReadSplitFile(string splitfileName);
50   bool MergeTree(string name);
51   bool MergeGate(TChain* chain);
52   bool MergeSing(TChain* chain);
53   bool MergeCoin(TChain* chain);
54
55   // the cleanup after succesful merging
56   void StartCleaning(string splitfileName,bool test);
57
58   // the merging methods
59   void MergeRoot();
60
61 private:
62   void FastMergeRoot(); 
63   bool FastMergeGate(string name);
64   bool FastMergeSing(string name);
65   bool FastMergeCoin(string name); 
66   bool           m_forced;             // if to overwrite existing files
67   int      m_verboseLevel;  
68   std::vector<TFile*>         filearr;
69   Long64_t      m_maxRoot;             // maximum size of root output file
70   int         m_CompLevel;             // compression level for root output
71   string         m_outDir;             // where to save the output files
72   int            m_Nfiles;             // number of files to mergw
73   vector<int> m_lastEvents;            // latestevent from al files
74   vector<string> m_vRootFileNames;     // names of root files to merge
75   TFile*         m_RootTarget;         // root output file
76   string         m_RootTargetName;     // name of target i.e. root output file
77   bool           m_fastMerge;          // fast merge option, corrects the eventIDs locally
78 };
79
80
81 #endif