Skip to content

Commit 8d0908e

Browse files
committed
[ntuple] Add RMiniFile::GetNTupleProperAtOffset
1 parent 05afcff commit 8d0908e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tree/ntuple/inc/ROOT/RMiniFile.hxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ private:
6868
/// Used when the file turns out to be a TFile container. The ntuplePath variable is either the ntuple name
6969
/// or an ntuple name preceded by a directory (`myNtuple` or `foo/bar/myNtuple` or `/foo/bar/myNtuple`)
7070
RResult<RNTuple> GetNTupleProper(std::string_view ntuplePath);
71+
/// Loads an RNTuple anchor from a TFile at the given file offset (unzipping it if necessary).
72+
RResult<RNTuple> GetNTupleProperAtOffset(std::uint64_t keyOffset);
7173

7274
/// Searches for a key with the given name and type in the key index of the directory starting at offsetDir.
7375
/// The offset points to the start of the TDirectory DATA section, without the key and without the name and title

tree/ntuple/src/RMiniFile.cxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,14 @@ ROOT::RResult<ROOT::RNTuple> ROOT::Internal::RMiniFileReader::GetNTupleProper(st
754754
return R__FAIL("no RNTuple named '" + std::string(ntupleName) + "' in file '" + fRawFile->GetUrl() + "'");
755755
}
756756

757+
auto res = GetNTupleProperAtOffset(offset);
758+
return res;
759+
}
760+
761+
ROOT::RResult<ROOT::RNTuple> ROOT::Internal::RMiniFileReader::GetNTupleProperAtOffset(std::uint64_t keyOffset)
762+
{
763+
auto offset = keyOffset;
764+
RTFKey key;
757765
ReadBuffer(&key, sizeof(key), offset);
758766
offset = key.GetSeekKey() + key.fKeyLen;
759767

0 commit comments

Comments
 (0)