From 2d3891628f707d8f2d4a32cd77b2749746705bb9 Mon Sep 17 00:00:00 2001 From: silverweed Date: Thu, 3 Sep 2026 14:45:09 +0200 Subject: [PATCH 1/2] [ntupleutil] clang-format RNTupleInspector.hxx --- tree/ntupleutil/inc/ROOT/RNTupleInspector.hxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tree/ntupleutil/inc/ROOT/RNTupleInspector.hxx b/tree/ntupleutil/inc/ROOT/RNTupleInspector.hxx index 88bf518fd6130..96c67dc29055f 100644 --- a/tree/ntupleutil/inc/ROOT/RNTupleInspector.hxx +++ b/tree/ntupleutil/inc/ROOT/RNTupleInspector.hxx @@ -105,7 +105,9 @@ public: : fColumnDescriptor(colDesc), fCompressedPageSizes(compressedPageSizes), fElementSize(elemSize), - fNElements(nElems){}; + fNElements(nElems) + { + } ~RColumnInspector() = default; const ROOT::RColumnDescriptor &GetDescriptor() const { return fColumnDescriptor; } @@ -136,7 +138,9 @@ public: public: RFieldTreeInspector(const ROOT::RFieldDescriptor &fieldDesc, std::uint64_t onDiskSize, std::uint64_t inMemSize) - : fRootFieldDescriptor(fieldDesc), fCompressedSize(onDiskSize), fUncompressedSize(inMemSize){}; + : fRootFieldDescriptor(fieldDesc), fCompressedSize(onDiskSize), fUncompressedSize(inMemSize) + { + } ~RFieldTreeInspector() = default; const ROOT::RFieldDescriptor &GetDescriptor() const { return fRootFieldDescriptor; } From c8ff26b3bcd672b758c6844392958f766e7fd94c Mon Sep 17 00:00:00 2001 From: silverweed Date: Thu, 3 Sep 2026 14:39:21 +0200 Subject: [PATCH 2/2] [ntupleutil] add RNTupleInspector::GetPagesPerClusterDistribution --- tree/ntupleutil/inc/ROOT/RNTupleInspector.hxx | 4 ++ tree/ntupleutil/src/RNTupleInspector.cxx | 48 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/tree/ntupleutil/inc/ROOT/RNTupleInspector.hxx b/tree/ntupleutil/inc/ROOT/RNTupleInspector.hxx index 96c67dc29055f..384a3dc9bab50 100644 --- a/tree/ntupleutil/inc/ROOT/RNTupleInspector.hxx +++ b/tree/ntupleutil/inc/ROOT/RNTupleInspector.hxx @@ -430,6 +430,10 @@ public: std::string histName = "", std::string histTitle = "", size_t nBins = 64); + std::unique_ptr GetPagesPerClusterDistribution(std::initializer_list colTypes = {}, + std::string histName = "", std::string histTitle = "", + size_t nBins = 64); + ///////////////////////////////////////////////////////////////////////////// /// \brief Get storage information for a given (sub)field by ID. /// diff --git a/tree/ntupleutil/src/RNTupleInspector.cxx b/tree/ntupleutil/src/RNTupleInspector.cxx index f906bbf523a6d..4153ce40e526f 100644 --- a/tree/ntupleutil/src/RNTupleInspector.cxx +++ b/tree/ntupleutil/src/RNTupleInspector.cxx @@ -455,6 +455,54 @@ ROOT::Experimental::RNTupleInspector::GetPageSizeDistribution(std::initializer_l return stackedHist; } +std::unique_ptr ROOT::Experimental::RNTupleInspector::GetPagesPerClusterDistribution( + std::initializer_list colTypes, std::string histName, std::string histTitle, size_t nBins) +{ + if (histName.empty()) + histName = "pagesPerClusterHist"; + if (histTitle.empty()) + histTitle = "Per-column type pages per cluster distribution"; + + auto stackedHist = std::make_unique(histName.c_str(), histTitle.c_str()); + + double histMin = std::numeric_limits::max(); + double histMax = 0; + std::vector> pagesPerCluster; + + std::vector colTypeVec = colTypes; + if (std::empty(colTypes)) { + colTypeVec = GetColumnTypes(); + } + + for (const auto &clDesc : fDescriptor.GetClusterIterable()) { + auto &pagesInThisCluster = pagesPerCluster.emplace_back(); + for (const auto &colRange : clDesc.GetColumnRangeIterable()) { + const auto colId = colRange.GetPhysicalColumnId(); + const auto &colDesc = fDescriptor.GetColumnDescriptor(colId); + const auto nPages = clDesc.GetPageRange(colId).GetPageInfos().size(); + auto &pagesPerType = pagesInThisCluster[colDesc.GetType()]; + pagesPerType += nPages; + histMin = std::min(histMin, static_cast(pagesPerType)); + histMax = std::max(histMax, static_cast(pagesPerType)); + } + } + + for (const auto colType : colTypeVec) { + auto hist = std::make_unique( + TString::Format("%s%s", histName.c_str(), RColumnElementBase::GetColumnTypeName(colType)), + RColumnElementBase::GetColumnTypeName(colType), nBins, histMin, + histMax + ((histMax - histMin) / static_cast(nBins))); + for (const auto &pagesInCluster : pagesPerCluster) { + auto it = pagesInCluster.find(colType); + hist->Fill(it == pagesInCluster.end() ? 0u : it->second); + } + + stackedHist->Add(hist.release()); + } + + return stackedHist; +} + //------------------------------------------------------------------------------ const ROOT::Experimental::RNTupleInspector::RFieldTreeInspector &