51 lines
1.7 KiB
C++
51 lines
1.7 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(const char *fname, const char *ntpl_name)
|
|
{
|
|
RNTuple_Info info = {};
|
|
|
|
// 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.rng_header.start = anchor->GetSeekHeader();
|
|
info.rng_header.len = anchor->GetNBytesHeader();
|
|
info.rng_footer.start = anchor->GetSeekFooter();
|
|
info.rng_footer.len = anchor->GetNBytesFooter();
|
|
} else {
|
|
fprintf(stderr, "RNTuple '%s' not found in %s.\n", ntpl_name, fname);
|
|
}
|
|
|
|
// TODO: proper error handling
|
|
auto raw_file = ROOT::Internal::RRawFile::Create(fname);
|
|
if (raw_file) {
|
|
PseudoMiniFileReader file_reader { raw_file.get() };
|
|
auto file_info = file_reader.GetNTupleProper(ntpl_name).Unwrap();
|
|
info.rng_anchor.start = file_info.anchor_seek;
|
|
info.rng_anchor.len = file_info.anchor_nbytes;
|
|
info.rng_anchor_key.start = file_info.anchor_key_seek;
|
|
info.rng_anchor_key.len = file_info.anchor_key_nbytes;
|
|
info.rblob_header_size = file_info.rblob_key_header_nbytes;
|
|
info.root_file_header_size = file_info.tfile_header_nbytes;
|
|
}
|
|
|
|
return info;
|
|
}
|