Belle II Software  release-05-02-19
HandleRoot.h
1 #ifndef HANDLEROOT_H
2 #define HANDLEROOT_H
3 
4 #include <TTree.h>
5 #include <TFile.h>
6 #include <TClonesArray.h>
7 #include <TVectorD.h>
8 #include <map>
9 #include <string>
10 
11 namespace HandleRoot {
12  // Write functions.
13  void initializeEvent(
14  std::map<std::string, TVectorD*>& eventMapTVectorD,
15  std::map<std::string, TClonesArray*>& trackMapTVectorD
16  );
17  void initializeEvent(
18  std::map<std::string, TClonesArray*>& trackMapTVectorD
19  );
20  void initializeRoot(std::string prefix, TTree** runTree, TTree** eventTree,
21  std::map<std::string, TVectorD*>& runMapTVectorD,
22  std::map<std::string, TVectorD*>& eventMapTVectorD,
23  std::map<std::string, TClonesArray*>& trackMapTVectorD,
24  std::map<std::string, double>& constMapD, std::map<std::string, std::vector<double> >& constMapV,
25  std::map<std::string, double>& eventMapD, std::map<std::string, std::vector<double> >& eventMapV,
26  std::map<std::string, double>& trackMapD, std::map<std::string, std::vector<double> >& trackMapV
27  );
28  void initializeRoot(std::string prefix, TTree** runTree, TTree** eventTree,
29  std::map<std::string, TVectorD*>& runMapTVectorD,
30  std::map<std::string, TClonesArray*>& trackMapTVectorD,
31  std::map<std::string, double>& constMapD, std::map<std::string, std::vector<double> >& constMapV,
32  std::map<std::string, double>& trackMapD, std::map<std::string, std::vector<double> >& trackMapV
33  );
34  // Requries trackMapD to have key "iSave".
35  void saveTrackValues(std::string prefix,
36  std::map<std::string, TClonesArray*>& trackMapTVectorD,
37  std::map<std::string, double>& trackMapD, std::map<std::string, std::vector<double> >& trackMapV
38  );
39  void saveEventValues(std::string prefix,
40  std::map<std::string, TVectorD*>& eventMapTVectorD,
41  std::map<std::string, double>& eventMapD, std::map<std::string, std::vector<double> >& eventMapV
42  );
43  void writeRoot(TFile* file);
44 
45  // Read functions.
46  void initializeBranches(std::string& prefix, TFile* file, TTree** runTree, TTree** eventTree,
47  std::map<std::string, TVectorD*>& runMapTVectorD,
48  std::map<std::string, TVectorD*>& eventMapTVectorD,
49  std::map<std::string, TClonesArray*>& trackMapTVectorD
50  );
51  void initializeBranches(std::string& prefix, TFile* file, TTree** runTree, TTree** eventTree,
52  std::map<std::string, TVectorD*>& runMapTVectorD,
53  std::map<std::string, TClonesArray*>& trackMapTVectorD
54  );
55  void getRunValues(std::string prefix,
56  std::map<std::string, TVectorD*>& runMapTVectorD,
57  std::map<std::string, double>& constMapD, std::map<std::string, std::vector<double> >& constMapV
58  );
59  void getEventValues(std::string& prefix,
60  std::map<std::string, TVectorD*>& eventMapTVectorD,
61  std::map<std::string, double>& eventMapD, std::map<std::string, std::vector<double> >& eventMapV
62  );
63  void getTrackValues(std::string& prefix, int iTrack,
64  std::map<std::string, TClonesArray*>& trackMapTVectorD,
65  std::map<std::string, double>& trackMapD, std::map<std::string, std::vector<double> >& trackMapV
66  );
67 
68  // Common functions
69  void terminateRoot(
70  std::map<std::string, TVectorD*>& runMapTVectorD,
71  std::map<std::string, TVectorD*>& eventMapTVectorD,
72  std::map<std::string, TClonesArray*>& trackMapTVectorD
73  );
74  void terminateRoot(
75  std::map<std::string, TVectorD*>& runMapTVectorD,
76  std::map<std::string, TClonesArray*>& trackMapTVectorD
77  );
78 
79  // Utility functions
80  void convertSignalValuesToMaps(std::vector<std::tuple<std::string, double, int, double, double, int> > const& inValues,
81  std::map<std::string, double>& trackMapD, std::map<std::string, std::vector<double> >& trackMapV
82  );
83 
84 };
85 
86 #endif