30 std::shared_ptr<ROOT::RNTupleReader> fReader;
34 std::unique_ptr<TH1> fHistogram;
35 std::string fFieldName;
36 std::string fTypeName;
42 const auto &desc = fReader->GetDescriptor();
44 fIsLeaf = desc.GetFieldDescriptor(fBrowsableFieldId).GetLinkIds().empty();
45 fFieldName = desc.GetFieldDescriptor(fFieldId).GetFieldName();
46 fTypeName = desc.GetFieldDescriptor(fFieldId).GetTypeName();
54 const auto &desc = fReader->GetDescriptor();
60 auto view = fReader->GetView<
void>(desc.GetQualifiedFieldName(fBrowsableFieldId));
64 fHistogram = std::unique_ptr<TH1>(
drawVisitor.MoveHist());
65 if (fHistogram->GetEntries() == 0) {
66 gPad->DrawFrame(-1., -1., 1., 1.);
78 for (
const auto &
f : desc.GetFieldIterable(fBrowsableFieldId)) {
79 b->Add(
new RFieldBrowsable(fReader,
f.GetId()),
f.GetFieldName().c_str());
84 bool IsFolder()
const final {
return !fIsLeaf; }
85 const char *GetIconName()
const final {
return IsFolder() ?
"RNTuple-folder" :
"RNTuple-leaf"; }
87 const char *GetName()
const final {
return fFieldName.c_str(); }
88 const char *GetTitle()
const final {
return fTypeName.c_str(); }
91class RVisualizationBrowsable :
public TObject {
93 std::unique_ptr<ROOT::Experimental::RNTupleInspector> fInspector;
94 std::unique_ptr<ROOT::Experimental::RTreeMapPainter> fTreeMap;
98 : fInspector(
ROOT::Experimental::RNTupleInspector::Create(
ntuple))
105 gPad->GetListOfPrimitives()->Clear();
111 const char *GetIconName()
const final {
return "RNTuple-visualization"; }
113 const char *GetName()
const final {
return "Visualization"; }
114 const char *GetTitle()
const final {
return "TreeMap visualization of RNTuple structure and disk usage"; }
125 const auto &desc =
reader->GetDescriptor();
126 b->Add(
new RVisualizationBrowsable(*
static_cast<const ROOT::RNTuple *
>(
ntuple)),
"Visualization");
127 for (
const auto &
f : desc.GetTopLevelFields()) {
128 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