#include <StandaloneDataIO.h>
Definition at line 111 of file StandaloneDataIO.h.
◆ read_cell_info()
Definition at line 200 of file StandaloneDataIO.h.
203 {
204 std::ifstream in(
file.native(), std::ios_base::binary);
205 cell_info.binary_input(in);
206 if (in.fail())
207 {
210 }
211 in.close();
213 }
static void report_error(const std::filesystem::path &file, const std::string &kind, const bool really_report=false)
◆ read_cluster_info()
Definition at line 116 of file StandaloneDataIO.h.
119 {
121
122 std::ifstream in(
file.native(), std::ios_base::binary);
123
124 auto reader = [&](
auto *
ptr,
const auto & size)
125 {
126 in.read(reinterpret_cast<char *>(ptr), sizeof(*ptr) * size);
127 };
128
129 reader(
static_cast<CaloRecGPU::ClusterBaseInfo *
>(clusters), 1);
130
132 {
135 }
136
138 {
144 }
145
147 {
149 [[fallthrough]];
152 break;
154 [[fallthrough]];
156 [[fallthrough]];
158 [[fallthrough]];
164 break;
165 default:
166 break;
167 }
168
170 {
171 clusters->for_all_moments([&](
auto & arr)
172 {
173 unsigned long long base_size;
174 if constexpr (std::is_pointer_v<std::decay_t<decltype(*arr)>>)
175 {
176 base_size = sizeof(**arr) * sizeof(arr)/sizeof(*arr);
177 }
178 else
179 {
180 base_size = sizeof(*arr);
181 }
182 in.read(
reinterpret_cast<char *
>(arr), base_size *
clusters->number);
183 });
184 }
185
186 if (in.fail())
187 {
190 }
191
192 in.close();
193
195
196 }
constexpr int NMaxClusters
reader
read the goodrunslist xml file(s)
◆ write_cell_info()
Definition at line 290 of file StandaloneDataIO.h.
293 {
294 file.replace_extension(
".cellinfo");
295 std::ofstream
out(
file, std::ios_base::binary);
296 cell_info.binary_output(out);
298 {
301 }
304 }
◆ write_cluster_info()
Definition at line 215 of file StandaloneDataIO.h.
218 {
219 file.replace_extension(
".clusterinfo");
220 std::ofstream
out(
file, std::ios_base::binary);
221
222 auto writer = [&](
const auto *
ptr,
const auto & size)
223 {
224 out.write(
reinterpret_cast<const char *
>(ptr),
sizeof(*ptr) * size);
225 };
226
227
228 out.write(
reinterpret_cast<const char *
>(
static_cast<const CaloRecGPU::ClusterBaseInfo *
>(clusters)),
sizeof(CaloRecGPU::ClusterBaseInfo));
229
231 {
237 }
238
240 {
242 [[fallthrough]];
245 break;
247 [[fallthrough]];
249 [[fallthrough]];
251 [[fallthrough]];
257 break;
258 default:
259 break;
260 }
261
263 {
264 clusters->for_all_moments([&](
const auto & arr)
265 {
266 unsigned long long base_size;
267 if constexpr (std::is_pointer_v<std::decay_t<decltype(*arr)>>)
268 {
269 base_size = sizeof(**arr) * sizeof(arr)/sizeof(*arr);
270 }
271 else
272 {
273 base_size = sizeof(*arr);
274 }
275 out.write(
reinterpret_cast<const char *
>(arr), base_size *
clusters->number);
276 });
277 }
278
280 {
283 }
286 }
writer
show summary of content
◆ StandaloneDataIO
The documentation for this struct was generated from the following file: