Skip to content

[ntuple] implement feature to draw storage layout#4634

Closed
lesimon74 wants to merge 4 commits into
root-project:masterfrom
lesimon74:ntuple-draw-structure
Closed

[ntuple] implement feature to draw storage layout#4634
lesimon74 wants to merge 4 commits into
root-project:masterfrom
lesimon74:ntuple-draw-structure

Conversation

@lesimon74

@lesimon74 lesimon74 commented Nov 21, 2019

Copy link
Copy Markdown
Contributor

This new feature allows to display the storage layout of an RNTuple and to click on its pages to display information about a page. It creates a new ntupledraw library to limit dependencies.
Syntax is similar to RNTupleReader and RNTupleWriter:
auto reader = RNTupleReader::Open("ntupleName", "fileName");
auto draw = RNTupleDraw::Open(reader);
draw->Draw();
or
auto draw = RNTupleDraw(reader);
draw.Draw();

An example of a displayed RNTuple is shown below, zooming into the pages is possible:
Screenshot 2019-11-21 at 12 18 57

@phsft-bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@jblomer jblomer self-assigned this Nov 21, 2019

@jblomer jblomer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost perfect!

Comment thread tree/ntupledraw/v7/inc/ROOT/RDrawStorage.hxx Outdated
Comment thread tree/ntupledraw/v7/inc/ROOT/RDrawStorage.hxx Outdated
// ROOT.
std::vector<TCanvas *> fCanvasPtrs;
RDrawStorage(RNTupleReader *reader);
/// holds all created RDrawStorage instances until the lifetime

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

until the lifetime --> for the lifetime of the process?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, it's until the ROOT program is terminated to be on the safe side. I updated the comment.

Comment thread tree/ntupledraw/v7/inc/ROOT/RDrawStorage.hxx Outdated
Comment thread tree/ntupledraw/v7/src/RDrawStorage.cxx Outdated
Comment thread tree/ntupledraw/v7/src/RDrawStorage.cxx Outdated
{
switch (columnType) {
case EColumnType::kIndex:
fColumnType = "Index";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should put that information in RColumnModel.hxx. There can be static arrays with the names and on disk sizes, so that we can use something like kColumnNames[static_cast<int>(columnType)]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I implemented it.


// ------------------------------ RNTupleDraw -------------------------------

ROOT::Experimental::RNTupleDraw::RNTupleDraw(const std::unique_ptr<RNTupleReader> &reader)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just pass an RNTupleReader *reader? The Draw object does not own the reader, correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally I also wanted to just pass a raw pointer to avoid complications. But since RNTupleReader::Open() returns a unique_ptr and there might be non-C++ inclined users who don't know how to get the raw pointer form a unique_ptr, I thought it would be less confusing for users this way. I would leave the decision up to you if it should accept a raw pointer, reference to unique_ptr or allow both.

Comment thread tree/ntupledraw/v7/src/RDrawStorage.cxx Outdated
@jblomer

jblomer commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Replaced by #22641

@jblomer jblomer closed this Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants