Creating and filling a ROOT file from a text file

user2518393 picture user2518393 · Jun 27, 2013 · Viewed 10.8k times · Source

this is about C++ coding in CERN ROOT. So I have a text file with columns of data. Now I need to make a .root file with all the data in a tree. How would I do this? Also, if the text file has column headers, how would I write my code to get them to be my tree's branch names? Thanks in advance!

Answer

Asen Christov picture Asen Christov · Jun 28, 2013

this example from the ROOT web page shows how to do exactly what you want:

http://root.cern.ch/root/html534/tutorials/tree/cernbuild.C.html