How to explore RNTuples in the interpreter

Dear ROOT community,

I’ve been experimenting with RNTuples and, while they are generally a net upgrade over TTrees, I have not found as nice a way to explore the data in the ROOT interpreter.

Whereas TTree has Print, Draw, Scan… The best solution I’ve found for RNTuple was to place them in a RDataFrame and then do operations (Describe, Define, Filter, Foreach, Histo1D…) over them. It works but it really isn’t as practical as the TTree functions. The Histo1D in particular is quite unpractical as it requires defining the histogram model which means having already some idea as to the data range.

Am I missing something? Is there a better way to explore RNTuple data?

Best wishes,

*EK

Please read tips for efficient and successful posting and posting code*

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: 6.38.02
Platform: x86_64 Linux 6.12.74-1-lts
Compiler: Not Provided


Hello @EKEK,

for the very start, to get some first impression, you can use the RNTupleReader, and specifically Show() and PrintInfo().

If you want more details about e.g. the achieved compression, there is RNTupleInspector.

For plotting, we would indeed recommend RDataFrame. You don’t actually need to know the data range, and can use auto-binning similar to how it’s done with TTree. There is a table of command examples in the RDataFrame documentation, the Rosetta Stone. In your case, the first example might already be useful:

auto *tree = file->Get<TTree>("myTree");
tree->Draw("x", "y > 2");

becomes:

ROOT::RDataFrame df("myNTuple", file);
df.Filter("y > 2").Histo1D("x")->Draw();

When you don’t specify any HistoModel, it falls back to auto-binning. Concretely, it goes to this overload of Histo1D().

Thanks for the answer!

So I have to define an extra object (RNTupleInspector or RDataFrame) to investigate the RNTuple correct? There is no way to simply Draw like for TTree?
Perhaps I missed it but is there an alternative for TTree::Scan?