ParameterStorage_ROOT.h
Go to the documentation of this file.
1 #ifndef _ParameterStorage_ROOT_h_
2 #define _ParameterStorage_ROOT_h_
3 
4 #ifndef __CINT__
5 # include <utl/ParameterStorage.h>
6 #endif
7 #include <io/EventIO.h>
8 #include <Rtypes.h>
9 #include <map>
10 
11 
12 namespace io {
13 
22 
23  public:
25 #ifndef __CINT__
26  template<class ParameterStorage>
27  ParameterStorage_ROOT(const ParameterStorage& h)
28  {
29  const auto pars = h.GetEnumVector();
30  for (const auto p : pars)
31  fParameterMap[p] = std::make_pair(h.GetParameter(p), h.GetParameterLockStatus(p));
32 
33  const auto ppars = h.GetCovarianceEnumVector();
34  for (const auto& pp : ppars) {
35  const auto& i = pp.first;
36  const auto& j = pp.second;
38  std::make_pair(h.GetParameterCovariance(i, j), h.GetParameterCovarianceLockStatus(i, j));
39  }
40  }
41 
42  template<class ParameterStorage>
43  void
44  operator>>(ParameterStorage& h)
45  const
46  {
47  for (const auto& ivl : fParameterMap) {
48  const auto i = static_cast<typename ParameterStorage::Parameter>(ivl.first);
49  const auto& vl = ivl.second;
50  const auto& v = vl.first;
51  const auto& l = vl.second;
52  h.SetParameter(i, v, l);
53  }
54 
55  for (const auto& ijvl : fParameterCovarianceMap) {
56  const auto& ij = ijvl.first;
57  const auto i = static_cast<typename ParameterStorage::Parameter>(ij.first);
58  const auto j = static_cast<typename ParameterStorage::Parameter>(ij.second);
59  const auto& vl = ijvl.second;
60  const auto& v = vl.first;
61  const auto& l = vl.second;
62  h.SetParameterCovariance(i, j, v, l);
63  }
64  }
65 #endif
66 
67  std::map<int, std::pair<double, bool>> fParameterMap;
68  std::map<std::pair<int, int>, std::pair<double, bool>> fParameterCovarianceMap;
69  std::string fParameterStorageName;
70 
72 
73  };
74 
75 }
76 
77 
78 #endif
ParameterStorage_ROOT(const ParameterStorage &h)
ClassDefNV(ParameterStorage_ROOT, DONT_CHANGE_THIS_NUMBER)
Persistent ParameterStorage object using ROOT.
std::map< int, std::pair< double, bool > > fParameterMap
std::map< std::pair< int, int >, std::pair< double, bool > > fParameterCovarianceMap
void operator>>(ParameterStorage &h) const
#define DONT_CHANGE_THIS_NUMBER
Definition: EventIO.h:21

, generated on Tue Sep 26 2023.