View contents of ROOT file like a csv viewer

Hello

Is there a way to view data in a ROOT file in the same way that Jupyter lab shows the contents of a csv file? There doesn’t seem to be any way at the moment - this would be a really helpful addition. Thank you!

Yannis


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi Yannis,

Please specify what type of data you have in your root file. It can be a TTree, a histogram or Canvas. You can even make available the file here I believe.

In any case, after opening a file using:

root my_file_name.root

You can always use TBrowser to quickly inspect files and plot things:

new TBrowser

Or you can check the content using

.ls

If it is a TTree (named “mytree”), you can use

mytree->Print()

to check all branches sizes, types, etc. If you want to scan a branch named “coordinates” and another one named “time”, you can do it by:

mytree->Scan("coordinates:time")

For scanning all branches use Scan(“*”).

Hope that helps.

Cheers

You can also see/manipulate the content of ROOT’s files using the command line tools.

Thank you both for your replies. I am aware of these solutions, I was thinking about this more from the perspective of a non-coder who would like to view the contents of the file in an eye-pleasing way. I was thinking something along the lines of different csv viewer tools in VS Code and Jupyter Lab (see for example https://user-images.githubusercontent.com/44871521/86041615-85f25000-ba63-11ea-97e4-45f76f33138d.png), where different vectors inside the ROOT file are presented in a similar way. I guess this does not quite exist at the moment, but it would be a nice addition, I think.

Thanks again for your help - and have a great day!

Cheers

Not the same, but also interesting: TBrowser alternative for non-X11 mode - #19 by couet
and: [gui] Variable Explorer GUI class · Issue #11295 · root-project/root · GitHub
and: Converting root file to csv using root2csv