CbmRoot
CbmHaddBase.h
Go to the documentation of this file.
1 
8 #ifndef CBM_HADD_BASE_H
9 #define CBM_HADD_BASE_H
10 
11 #include "TObject.h"
12 
13 #include <string>
14 #include <vector>
15 
16 class TFile;
17 class TList;
18 class TDirectory;
19 
20 using namespace std;
21 
22 class CbmHaddBase : public TObject {
23 
24 public:
25  /*
26  *\brief Hadd all files in a dir with a specified fileTemplate.
27  *\param dir Path to the directory with files
28  *\param fileTemplate [addString].auau.25gev.[00000][.root] [] - will be add to the file name automatically
29  *\param addString analysis or litqa
30  *\param nofFiles number Of files to add
31  */
32  static void AddFilesInDir(const std::string& dir,
33  const std::string& fileTemplate,
34  const std::string& addString,
35  Int_t nofFiles,
36  Int_t fileSizeLimit = 50000,
37  Int_t nofEvents = 1000);
38 
39 
40  static vector<string> GetFilesByPattern(const string& pattern);
41 
42  static vector<string>
43  GetGoodFiles(const string& pattern, Int_t fileSizeLimit, Int_t nofEvents);
44 
45 private:
46  static TFile* CreateAndMergeTempTargetFile(const std::string& dir,
47  const std::string& addString,
48  Int_t targetFileNum,
49  TList* fileList);
50 
51  /*
52  * \brief Close and delete files in the list.
53  */
54  static void CloseFilesFromList(TList* fileList);
55 
56  /*
57  * \brief Check that file is not NULL and file size is more then a size limit.
58  */
59  static Bool_t CheckFileSize(TFile* file, Int_t fileSizeLimit = 50000);
60 
61  /*
62  * \brief Check that file is not NULL, file size is more than a limit, number of events is equal to nofEvents
63  */
64  static Bool_t
65  CheckFile(TFile* file, Int_t fileSizeLimit = 50000, Int_t nofEvents = 1000);
66 
67  /*
68  * \brief Merge root file into one. This function was taken from hadd.C macro.
69  */
70  static void MergeRootfile(TDirectory* target, TList* sourcelist);
71 
73 };
74 
75 
76 #endif
CbmHaddBase::ClassDef
ClassDef(CbmHaddBase, 1)
CbmHaddBase
Definition: CbmHaddBase.h:22