GamR  0.0.0
GammaROOT
Loading...
Searching...
No Matches
ExpDefn.hh
Go to the documentation of this file.
1#ifndef GAMROOT_TREE_EXPDEFN_HH
2#define GAMROOT_TREE_EXPDEFN_HH
3
4/* STD */
5#include <memory>
6#include <string>
7#include <thread>
8
9#include <map>
10#include <tuple>
11#include <vector>
12
13/* ROOT */
14#include <TChain.h>
15#include <TFile.h>
16#include <TObject.h>
17#include <TROOT.h>
18#include <TTree.h>
19
20/* VENDOR */
21#include <inih/INIReader.h>
22
23namespace GamR {
24namespace Tree {
25
26template <class... ADefns>
27class TExpDefn : public TObject {
28public:
29 // TFile* fRawFile;
30 TFile *fOutFile;
31 // TTree* fRawTree;
32 TChain *fRawChain;
33 TTree *fOutTree;
34 std::tuple<std::vector<ADefns>...> fDetDefns;
35 std::map<std::string, void *> fBranchMap;
36 std::vector<std::string> fDetGroups;
37 INIReader fINIReader;
38 std::string fINI;
39
40private:
41 struct FillDetDefns; // Load(...)
42
43public:
44 TExpDefn() { ROOT::EnableImplicitMT(std::thread::hardware_concurrency()); }
46 {
47 for (auto itr : fBranchMap) {
48 std::free(itr.second);
49 }
50 gROOT->CloseFiles();
51 }
52
53 template <int N>
54 auto GetDetDefns() -> decltype(std::get<N>(fDetDefns)) &
55 {
56 return std::get<N>(fDetDefns);
57 }
58 auto GetAllDetDefns() -> decltype(fDetDefns) & { return fDetDefns; }
59 void CloseFiles() { gROOT->CloseFiles(); }
60 Int_t Load(std::vector<std::string> rootfn, std::string inifn, Bool_t quiet = kFALSE);
61 Int_t LoadRaw(std::vector<std::string> branchlist, std::string inifn, Bool_t quiet);
62 void ResetBranches(std::vector<std::string>);
63 template <typename EventType>
64 ULong64_t Convert(std::string outfn, ULong64_t eventoffset, ULong64_t nevents = 0, Bool_t quiet = kFALSE,
65 Int_t compression = 201, ULong64_t splitmb = 2000, Bool_t overwrite = kFALSE);
66
68};
69
70} // namespace Tree
71} // namespace GamR
72
73#include "ExpDefn.tt"
74
75#endif
auto GetDetDefns() -> decltype(std::get< N >(fDetDefns)) &
Definition ExpDefn.hh:54
ClassDef(TExpDefn, 1)
Int_t Load(std::vector< std::string > rootfn, std::string inifn, Bool_t quiet=kFALSE)
Definition ExpDefn.tt:73
std::map< std::string, void * > fBranchMap
Definition ExpDefn.hh:35
std::vector< std::string > fDetGroups
Definition ExpDefn.hh:36
ULong64_t Convert(std::string outfn, ULong64_t eventoffset, ULong64_t nevents=0, Bool_t quiet=kFALSE, Int_t compression=201, ULong64_t splitmb=2000, Bool_t overwrite=kFALSE)
Definition ExpDefn.tt:234
void ResetBranches(std::vector< std::string >)
Definition ExpDefn.tt:223
std::string fINI
Definition ExpDefn.hh:38
std::tuple< std::vector< ADefns >... > fDetDefns
Definition ExpDefn.hh:34
Int_t LoadRaw(std::vector< std::string > branchlist, std::string inifn, Bool_t quiet)
Definition ExpDefn.tt:167
auto GetAllDetDefns() -> decltype(fDetDefns) &
Definition ExpDefn.hh:58
INIReader fINIReader
Definition ExpDefn.hh:37
Definition Gain.cc:19