15#ifndef ROOT7_RNTupleInspector
16#define ROOT7_RNTupleInspector
99 std::uint32_t elemSize, std::uint64_t nElems)
112 static_cast<std::uint64_t
>(0));
190 static std::unique_ptr<RNTupleInspector>
Create(
const RNTuple &sourceNTuple);
199 static std::unique_ptr<RNTupleInspector>
Create(std::string_view ntupleName, std::string_view storage);
331 std::ostream &output = std::cout);
345 std::string_view histTitle =
"");
359 std::string histTitle =
"",
size_t nBins = 64);
373 std::string histTitle =
"",
size_t nBins = 64);
387 std::string histName =
"", std::string histTitle =
"",
421 std::string histName =
"", std::string histTitle =
"",
448 size_t GetFieldCountByType(
const std::regex &typeNamePattern,
bool searchInSubfields =
true)
const;
468 std::vector<ROOT::DescriptorId_t>
469 GetFieldsByName(
const std::regex &fieldNamePattern,
bool searchInSubfields =
true)
const;
475 std::vector<ROOT::DescriptorId_t>
GetFieldsByName(std::string_view fieldNamePattern,
bool searchInSubfields =
true)
477 return GetFieldsByName(std::regex{std::string(fieldNamePattern)}, searchInSubfields);
const ROOT::RColumnDescriptor & fColumnDescriptor
std::uint64_t GetElementSize() const
RColumnInspector(const ROOT::RColumnDescriptor &colDesc, const std::vector< std::uint64_t > &compressedPageSizes, std::uint32_t elemSize, std::uint64_t nElems)
const ROOT::RColumnDescriptor & GetDescriptor() const
std::uint64_t GetCompressedSize() const
std::uint64_t GetUncompressedSize() const
std::uint64_t GetNPages() const
std::uint64_t GetNElements() const
const std::vector< std::uint64_t > fCompressedPageSizes
std::uint32_t fElementSize
ROOT::ENTupleColumnType GetType() const
const std::vector< std::uint64_t > & GetCompressedPageSizes() const
~RColumnInspector()=default
Provides field-level storage information.
RFieldTreeInspector(const ROOT::RFieldDescriptor &fieldDesc, std::uint64_t onDiskSize, std::uint64_t inMemSize)
std::uint64_t fCompressedSize
std::uint64_t GetCompressedSize() const
std::uint64_t fUncompressedSize
~RFieldTreeInspector()=default
const ROOT::RFieldDescriptor & fRootFieldDescriptor
std::uint64_t GetUncompressedSize() const
const ROOT::RFieldDescriptor & GetDescriptor() const
float GetCompressionFactor() const
Get the compression factor of the RNTuple being inspected.
std::vector< ROOT::DescriptorId_t > GetFieldsByName(const std::regex &fieldNamePattern, bool searchInSubfields=true) const
Get the IDs of (sub-)fields whose name matches the given string.
RNTupleInspector & operator=(RNTupleInspector &&other)=delete
const RFieldTreeInspector & GetFieldTreeInspector(ROOT::DescriptorId_t fieldId) const
Get storage information for a given (sub)field by ID.
std::unique_ptr< TH1D > GetPageSizeDistribution(ROOT::DescriptorId_t physicalColumnId, std::string histName="", std::string histTitle="", size_t nBins=64)
Get a histogram containing the size distribution of the compressed pages for an individual column.
const ROOT::RNTupleDescriptor & GetDescriptor() const
Get the descriptor for the RNTuple being inspected.
RNTupleInspector(const RNTupleInspector &other)=delete
std::uint64_t GetCompressedSize() const
Get the compressed, on-disk size of the RNTuple being inspected.
size_t GetColumnCountByType(ROOT::ENTupleColumnType colType) const
Get the number of columns of a given type present in the RNTuple.
std::uint64_t GetUncompressedSize() const
Get the uncompressed total size of the RNTuple being inspected.
void PrintFieldTreeAsDot(std::ostream &output=std::cout) const
Print the tree of all the (sub)fields of an RNTuple.
RNTupleInspector(RNTupleInspector &&other)=delete
std::optional< std::uint32_t > fCompressionSettings
The compression settings are unknown for an empty ntuple.
std::vector< ROOT::ENTupleColumnType > GetColumnTypes()
Get all column types present in the RNTuple being inspected.
size_t GetFieldCountByType(const std::regex &typeNamePattern, bool searchInSubfields=true) const
Get the number of fields of a given type or class present in the RNTuple.
std::vector< ROOT::DescriptorId_t > GetColumnsByType(ROOT::ENTupleColumnType colType)
Get the IDs of all columns with the given type.
std::string GetCompressionSettingsAsString() const
Get a string describing compression settings of the RNTuple being inspected.
RFieldTreeInspector CollectFieldTreeInfo(ROOT::DescriptorId_t fieldId)
Recursively gather field-level information.
std::uint64_t fCompressedSize
RNTupleInspector(std::unique_ptr< ROOT::Internal::RPageSource > pageSource)
size_t GetFieldCountByType(std::string_view typeNamePattern, bool searchInSubfields=true) const
Get the number of fields of a given type or class present in the RNTuple.
void PrintColumnTypeInfo(ENTupleInspectorPrintFormat format=ENTupleInspectorPrintFormat::kTable, std::ostream &output=std::cout)
Print storage information per column type.
std::optional< std::uint32_t > GetCompressionSettings() const
Get the compression settings of the RNTuple being inspected.
std::uint64_t fUncompressedSize
const RColumnInspector & GetColumnInspector(ROOT::DescriptorId_t physicalColumnId) const
Get storage information for a given column.
std::unique_ptr< ROOT::Internal::RPageSource > fPageSource
RNTupleInspector & operator=(const RNTupleInspector &other)=delete
static std::unique_ptr< RNTupleInspector > Create(const RNTuple &sourceNTuple)
Create a new RNTupleInspector.
std::unordered_map< int, RFieldTreeInspector > fFieldTreeInfo
void CollectColumnInfo()
Gather column-level and RNTuple-level information.
std::unordered_map< int, RColumnInspector > fColumnInfo
void PrintFieldTreeAsDot(const ROOT::RFieldDescriptor &fieldDescriptor, std::ostream &output=std::cout) const
Print a .dot string that represents the tree of the (sub)fields of an RNTuple.
std::vector< ROOT::DescriptorId_t > GetFieldsByName(std::string_view fieldNamePattern, bool searchInSubfields=true)
Get the IDs of (sub-)fields whose name matches the given string.
std::vector< ROOT::DescriptorId_t > GetAllColumnsOfField(ROOT::DescriptorId_t fieldId) const
Get the columns that make up the given field, including its subfields.
std::unique_ptr< TH1D > GetColumnTypeInfoAsHist(ENTupleInspectorHist histKind, std::string_view histName="", std::string_view histTitle="")
Get a histogram showing information for each column type present,.
ROOT::RNTupleDescriptor fDescriptor
Abstract interface to read data from an ntuple.
Metadata stored for every column of an RNTuple.
Metadata stored for every field of an RNTuple.
The on-storage metadata of an RNTuple.
Representation of an RNTuple data set in a ROOT file.
Namespace for ROOT features in testing.
ENTupleInspectorPrintFormat
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.