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