39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
|
internal
|
||
|
String8 rntuple_description(Arena *arena, const RNTuple &anchor)
|
||
|
{
|
||
|
String8 desc = push_str8f(arena, "version %u.%u.%u.%u",
|
||
|
anchor.GetVersionEpoch(),
|
||
|
anchor.GetVersionMajor(),
|
||
|
anchor.GetVersionMinor(),
|
||
|
anchor.GetVersionPatch());
|
||
|
return desc;
|
||
|
}
|
||
|
|
||
|
internal
|
||
|
RNTuple_Info *get_rntuple_info(Arena *arena, const char *fname, const char *ntpl_name)
|
||
|
{
|
||
|
RNTuple_Info *info = arena_push_zeroed<RNTuple_Info>(arena);
|
||
|
|
||
|
// Open the TFile
|
||
|
TFile *tfile = TFile::Open(fname, "READ");
|
||
|
if (!tfile) {
|
||
|
fprintf(stderr, "Failed to open TFile.\n");
|
||
|
return info;
|
||
|
}
|
||
|
defer { delete tfile; };
|
||
|
|
||
|
// Get the RNTuple information
|
||
|
const RNTuple *anchor = tfile->Get<RNTuple>(ntpl_name);
|
||
|
if (anchor) {
|
||
|
info->anchor = *anchor;
|
||
|
info->header.start = anchor->GetSeekHeader();
|
||
|
info->header.len = anchor->GetNBytesHeader();
|
||
|
info->footer.start = anchor->GetSeekFooter();
|
||
|
info->footer.len = anchor->GetNBytesFooter();
|
||
|
} else {
|
||
|
fprintf(stderr, "RNTuple '%s' not found in %s.\n", ntpl_name, fname);
|
||
|
}
|
||
|
|
||
|
return info;
|
||
|
}
|