Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CDBTTree.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CDBTTree.h
1 #ifndef CDBOBJECTS_CDBTTREE_H
2 #define CDBOBJECTS_CDBTTREE_H
3 
4 #include <cstdint>
5 #include <map>
6 #include <string>
7 
8 class TTree;
9 
10 class CDBTTree
11 {
12  public:
13  CDBTTree() = default;
14  explicit CDBTTree(const std::string &fname);
15  ~CDBTTree();
16  void SetFloatValue(int channel, const std::string &name, float value);
17  void SetDoubleValue(int channel, const std::string &name, double value);
18  void SetIntValue(int channel, const std::string &name, int value);
19  void SetUInt64Value(int channel, const std::string &name, uint64_t value);
20  void Commit();
21  void SetSingleFloatValue(const std::string &name, float value);
22  void SetSingleDoubleValue(const std::string &name, double value);
23  void SetSingleIntValue(const std::string &name, int value);
24  void SetSingleUInt64Value(const std::string &name, uint64_t value);
25  void CommitSingle();
26  void WriteCDBTTree();
27  void WriteSingleCDBTTree();
28  void WriteMultipleCDBTTree();
29  void Print();
30  void LoadCalibrations();
31  float GetSingleFloatValue(const std::string &name, int verbose = 1);
32  float GetFloatValue(int channel, const std::string &name, int verbose = 1);
33  double GetSingleDoubleValue(const std::string &name, int verbose = 1);
34  double GetDoubleValue(int channel, const std::string &name, int verbose = 1);
35  int GetSingleIntValue(const std::string &name, int verbose = 1);
36  int GetIntValue(int channel, const std::string &name, int verbose = 1);
37  uint64_t GetSingleUInt64Value(const std::string &name, int verbose = 1);
38  uint64_t GetUInt64Value(int channel, const std::string &name, int verbose = 1);
39 
40  private:
41  enum
42  {
45  };
46  const std::string m_TTreeName[2] = {"Single", "Multiple"};
47  TTree *m_TTree[2] = {nullptr};
48  bool m_Locked[2] = {false};
49 
51  std::map<int, std::map<std::string, float>> m_FloatEntryMap;
52  std::map<std::string, float> m_SingleFloatEntryMap;
53  std::map<int, std::map<std::string, double>> m_DoubleEntryMap;
54  std::map<std::string, double> m_SingleDoubleEntryMap;
55  std::map<int, std::map<std::string, int>> m_IntEntryMap;
56  std::map<std::string, int> m_SingleIntEntryMap;
57  std::map<int, std::map<std::string, uint64_t>> m_UInt64EntryMap;
58  std::map<std::string, uint64_t> m_SingleUInt64EntryMap;
59 };
60 
61 #endif