Plotting RNTuple same as TTree

With TTree object in a root file, I could do:

tree->Draw("some_leaf", "some cut", "draw opts");

I was frequently using this e.g. in macros to plot histograms from trees.

Is this still possible with RNTuple? I cannot find anything in the documentation.

Hi Rafal,

Thanks for the post.
RNTuple can be easily analysed with RDataFrame.

ROOT::RDataFrame df("myTree", "myFileName.root");
auto h = df.Filter("some cut").Histo1D("some_leaf");
h->Draw("draw opts");

Cheers,
Danilo

Thanks for this example.

However I was thinking about situation where ones open the root file with root. With TTree in the file, you see the tree object and can call obj->Draw(...) directly. Would it be possible to make it the same for RNTuples? Your example is a different approach.

I am thinking about migrating from TTree to RNTuple but lack of RNTuple::Draw means I need to rewrite all the macros we used for our tools set.

I have plenty of macros which I call: root file_name.root macro.C and the macro expects the tree object being available and draw from it.

Note that to ease the transition you can create a RDataFrame from a TTree (derefenced) pointer.

Hi Rafał,

Thanks for describing your “user story”, which I find very reasonable and sound.

Let me first observe that the snipped above works if myTree is a TTree or an RNTuple instance - exactly the same code, the input format can be transparently switched.

We consciously decided not to try to re-implement TTree::Draw for RNtuple because of the design of the two columnar formats interfaces, which are intrinsically different. Honestly, it would not be possible to re-implement the entire “TTree::Draw cut language” functionality for RNTuple.

Can we help you somehow with the migration to RDF?

Cheers,
D

This is very bad. The TTree::Draw() is very handy for quick tree inspection. Like open file in the T/Web browser and with one-liner you can draw almost anything you want. With RDataFrame it becomes convoluted.

So I already see that I will have hard time convincing people to move to RNTuple, and most likely we will stick with TTrees.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.