31 std::shared_ptr<ROOT::RNTupleReader> fReader;
35 std::unique_ptr<TH1> fHistogram;
36 std::string fFieldName;
37 std::string fTypeName;
43 const auto &desc = fReader->GetDescriptor();
45 fIsLeaf = desc.GetFieldDescriptor(fBrowsableFieldId).GetLinkIds().empty();
46 fFieldName = desc.GetFieldDescriptor(fFieldId).GetFieldName();
47 fTypeName = desc.GetFieldDescriptor(fFieldId).GetTypeName();
55 const auto &desc = fReader->GetDescriptor();
61 auto view = fReader->GetView<
void>(desc.GetQualifiedFieldName(fBrowsableFieldId));
65 fHistogram = std::unique_ptr<TH1>(
drawVisitor.MoveHist());
66 if (fHistogram->GetEntries() == 0) {
67 gPad->DrawFrame(-1., -1., 1., 1.);
79 for (
const auto &
f : desc.GetFieldIterable(fBrowsableFieldId)) {
80 b->Add(
new RFieldBrowsable(fReader,
f.GetId()),
f.GetFieldName().c_str());
85 bool IsFolder()
const final {
return !fIsLeaf; }
86 const char *GetIconName()
const final {
return IsFolder() ?
"RNTuple-folder" :
"RNTuple-leaf"; }
88 const char *GetName()
const final {
return fFieldName.c_str(); }
89 const char *GetTitle()
const final {
return fTypeName.c_str(); }
92class RVisualizationBrowsable :
public TObject {
94 std::unique_ptr<ROOT::Experimental::RNTupleInspector> fInspector;
95 std::unique_ptr<ROOT::Experimental::RTreeMapPainter> fTreeMap;
99 : fInspector(
ROOT::Experimental::RNTupleInspector::Create(
ntuple))
106 gPad->GetListOfPrimitives()->Clear();
112 const char *GetIconName()
const final {
return "RNTuple-visualization"; }
114 const char *GetName()
const final {
return "Visualization"; }
115 const char *GetTitle()
const final {
return "TreeMap visualization of RNTuple structure and disk usage"; }
126 const auto &desc =
reader->GetDescriptor();
127 b->Add(
new RVisualizationBrowsable(*
static_cast<const ROOT::RNTuple *
>(
ntuple)),
"Visualization");
128 for (
const auto &
f : desc.GetTopLevelFields()) {
129 b->Add(
new RFieldBrowsable(
reader,
f.GetId()),
f.GetFieldName().c_str());
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Representation of an RNTuple data set in a ROOT file.
Using a TBrowser one can browse all ROOT objects.
Mother of all ROOT objects.
Base class for several text objects.
std::unique_ptr< RTreeMapPainter > CreateTreeMapFromRNTuple(const RNTupleInspector &insp)
Logic for converting an RNTuple to RTreeMapPainter given RNTupleInspector.
void BrowseRNTuple(const void *ntuple, TBrowser *b)
DescriptorId_t GetNextBrowsableField(DescriptorId_t fieldId, const RNTupleDescriptor &desc)
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr DescriptorId_t kInvalidDescriptorId