1 /*----------------------
2 GATE version name: gate_v...
4 Copyright (C): OpenGATE Collaboration
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 ----------------------*/
12 #ifndef GateMergeManager_h
13 #define GateMergeManager_h 1
23 class GateMergeManager
27 GateMergeManager(bool fastMerge,int verboseLevel,bool forced,Long64_t maxRoot,string outDir){
28 m_verboseLevel = verboseLevel;
33 m_fastMerge = fastMerge;
35 //check if a .Gate directory can be found
36 if (!getenv("GC_DOT_GATE_DIR")) {
37 cout<<"Environment variable GC_DOT_GATE_DIR not set !"<<endl;
40 m_dir=getenv("GC_DOT_GATE_DIR");
41 if (m_dir.substr(m_dir.length()-1,m_dir.length())=="/") m_dir=m_dir+".Gate/";
42 else m_dir=m_dir+"/.Gate/";
43 ifstream dirstream(m_dir.c_str());
45 cout<<"Failed to open .Gate directory"<<endl;
53 if (filearr) delete filearr;
57 void StartMerging(string splitfileName);
58 void ReadSplitFile(string splitfileName);
59 bool MergeTree(string name);
60 bool MergeGate(TChain* chain);
61 bool MergeSing(TChain* chain);
62 bool MergeCoin(TChain* chain);
64 // the cleanup after succesful merging
65 void StartCleaning(string splitfileName,bool test);
67 // the merging methods
72 bool FastMergeGate(string name);
73 bool FastMergeSing(string name);
74 bool FastMergeCoin(string name);
75 bool m_forced; // if to overwrite existing files
78 Long64_t m_maxRoot; // maximum size of root output file
79 int m_CompLevel; // compression level for root output
80 string m_dir; // .Gate directory path
81 string m_outDir; // where to save the output files
82 int m_Nfiles; // number of files to mergw
83 vector<int> m_lastEvents; // latestevent from al files
84 vector<string> m_vRootFileNames; // names of root files to merge
85 TFile* m_RootTarget; // root output file
86 string m_RootTargetName; // name of target i.e. root output file
87 bool m_fastMerge; // fast merge option, corrects the eventIDs locally