27{
28 void SampleHist ::
29 testInvariant () const
30 {
32 }
33
34
35
36 SampleHist ::
37 SampleHist ()
38 : Sample ("unnamed")
39 {
41 }
42
43
44
45 SampleHist ::
46 SampleHist (
const std::string& name,
const std::string&
file)
48 {
50 }
51
52
53
54 std::size_t SampleHist ::
55 getNumFiles () const
56 {
58 return 1;
59 }
60
61
62
63 std::string SampleHist ::
64 getFileName (const std::size_t
65#ifndef NDEBUG
67#endif
68 ) const
69 {
72 return m_file;
73 }
74
75
76
77 std::unique_ptr<SampleLocal> SampleHist ::
78 doMakeLocal () const
79 {
81 throw std::runtime_error ("Sample::makeLocal not supported for SampleHist");
82 }
83
84
85
86 std::vector<std::string> SampleHist ::
87 doMakeFileList () const
88 {
90
91 std::vector<std::string>
result;
94 }
95
96
97
98 void SampleHist ::
99 doUpdateLocation (const std::string& from, const std::string& to)
100 {
102
103
104
105 if (m_file.starts_with (from) &&
106 (m_file.size() == from.size() || m_file[from.size()] == '/'))
107 {
108 std::string rest = m_file.substr (from.size());
109 if (!rest.empty() && rest.front() == '/')
110 rest.erase (0, 1);
111 m_file = rest.empty() ?
to :
to +
"/" + rest;
112 }
113 }
114
115
116
117 TObject *SampleHist ::
118 doReadHist (const std::string& name) const
119 {
121
122 std::unique_ptr<TFile>
file (TFile::Open (m_file.c_str(),
"READ"));
123 if (
file.get() ==
nullptr)
124 throw std::runtime_error ("could not open file " + m_file);
125 TObject *
object =
file->Get (
name.c_str());
126 if (object != nullptr)
129 }
130}
#define RCU_CHANGE_INVARIANT(x)
#define RCU_NEW_INVARIANT(x)
#define RCU_READ_INVARIANT(x)
bool SetDirectory(TObject *object, TDirectory *directory)
effects: set the directory this object is associated with returns: whether the object type actively k...