Opening a .root tree file

Hi, I am sent a .root data file by a colleague and I know from speaking to him that this file is a tree. I am not sure how to open the file. When trying to open it through my IDA (PyCharm) it just opens as one single large file with lots of unreadable text. I have tried to manage the different file associations that related to .root files and to write a shell script from the automator (I’m using mac), both with no luck.

Does anybody know what what my issue is and how to deal with the problem?

Hi Ludvig,
and welcome to the ROOT forum!

Your ROOT file contains a TTree. You need to open it using ROOT! With a working ROOT installation, you can use rootbrowse <filename.root> to open a GUI that lets you inspect the file. To actually process it, there are a number of interfaces, see e.g. this answer for a list of the most common ones in C++. If you are using python, ROOT comes with dynamic python bindings that let you access almost all of the C++ classes and functions from python. There are a number of tutorials and a ROOT primer.

Do not hesitate to ask more specific questions in this thread.

1 Like