How to read data 2D array from a .txt file and make a ttree


I would like to read 2D array from a text file and would like to store the contents of the array in a TTree.

I am attaching the text file, where I have the mass and TKE of particles stored in a 2D array. I want to read the contents of the array and want to store the correlated mass and TKE in two separate branches of a TTree.

I don’t really understand how to do this (seeing the text file, which is the output from GEF calculations).
Any help will be really appreciated.
test.txt (29.4 KB)

Thank you.

Hi @gini ,

you can split the problem in 2: reading your data from the txt file is a generic C++ (or Python) question and you can find a lot of resources on the web to help with it. Then once you have the data you have to write it into a TTree; for that this should help: Trees - ROOT as well as the TTree tutorials.