Converts a full event fragment, from the old to new format, using the space of contiguous memory storage area given. If the event given is already on v3.0 format, no conversion takes place.
250{
252
256 }
258 }
259
260
263 memcpy(dest, src, sizeof(uint32_t)*src[1]);
264 return src[1];
265 }
268
269
270 old::FullEventFragment fe(src);
271 fe.check_tree();
272
273
274
275
276 eformat::write::FullEventFragment nfe(
convert_source(fe.source_id()),
277
278 fe.date(), fe.global_id(), fe.run_no(),
279 fe.lvl1_id(), fe.lvl1_trigger_type(),
280 fe.lvl2_trigger_info(), fe.event_filter_info());
281 nfe.status(fe.nstatus(), fe.status());
282 nfe.minor_version(version.minor2());
283
284
285
286
287
288 std::vector<eformat::write::SubDetectorFragment*> acc_sd;
289 std::vector<eformat::write::ROSFragment*> acc_ros;
290 std::vector<eformat::write::ROBFragment*> acc_rob;
291
292 for (size_t i=0; i<fe.noffset(); ++i) {
293 old::SubDetectorFragment sd(fe.child(i));
294
295
296
297
298 eformat::write::SubDetectorFragment* nsd =
299 new eformat::write::SubDetectorFragment(
convert_source(sd.source_id()));
300
301 nsd->
status(sd.nstatus(), sd.status());
302 helper::Version sd_version(sd.version());
304
305 for (size_t j=0; j<sd.noffset(); ++j) {
306 old::ROSFragment ros(sd.child(j));
307
308
309
310
311 eformat::write::ROSFragment* nros =
313 ros.run_no(), ros.lvl1_id(), ros.bc_id());
314
315 nros->
status(ros.nstatus(), ros.status());
316 helper::Version ros_version(ros.version());
318
319 for (size_t k=0; k<ros.noffset(); ++k) {
320 old::ROBFragment rob(ros.child(k));
321 uint32_t source_id = rob.source_id();
322
323 for (size_t l=0; l<rob.noffset(); ++l) {
324 old::RODFragment rod(rob.rod(l));
325 if (rob.noffset() != 1) source_id = rod.source_id();
326
327
328 eformat::write::ROBFragment* nrob = new eformat::write::ROBFragment
329
331 rod.bc_id(), rod.lvl1_trigger_type(), rod.detev_type(),
332 rod.ndata(), rod.data(), rod.status_position());
333 nrob->
status(rob.nstatus(), rob.status());
334 nrob->
rod_status(rod.nstatus(), rod.status());
335 helper::Version rob_version(rob.version());
337 helper::Version rod_version(rod.version());
339
340
342
343 acc_rob.push_back(nrob);
344 }
345 }
346
348
349 acc_ros.push_back(nros);
350 }
351
352 nfe.append(nsd);
353
354 acc_sd.push_back(nsd);
355 }
356
357
359
361
362
363 for (size_t i=0; i<acc_rob.size(); ++i) delete acc_rob[i];
364 for (size_t i=0; i<acc_ros.size(); ++i) delete acc_ros[i];
365 for (size_t i=0; i<acc_sd.size(); ++i) delete acc_sd[i];
366
367 return retval;
368}
#define EFORMAT_BAD_VERSION(current, supported)
#define EFORMAT_WRONG_MARKER(current, expected)
uint32_t convert_ros(const uint32_t *src, uint32_t *dest, uint32_t max)