I dont have a very deep knowlage of root so I would like to know if its possible to read a given .root file so i can see the data inside in the form of columns. I know i can use TBrowser to see the data but that representation gives me an histogram and i would like to see just the raw data i have written inside a given file so i can understand how to perform my analisis.
How to “see inside” an object depends on what type of object it is (TTree, TGraph, TH1…).
From the terminal (outside ROOT) you can do:
$ rootls -l yourfile.root
to see what’s inside, e.g. (1st col. is the type; name is after the year):
$ rootls -l hsimple.root
TProfile Apr 12 17:27 2022 hprof;1 "Profile of pz versus px"
TH1F Apr 12 17:27 2022 hpx;1 "This is the px distribution"
TH2F Apr 12 17:27 2022 hpxpy;1 "py vs px"
TNtuple Apr 12 17:27 2022 ntuple;1 "Demo ntuple"
Supposing you have a TTree named “mytree” (like “ntuple” above), you could open the file directly when opening ROOT and then do mytree->Scan() to see all columns and data:
The first part was very usefull thanks. I can now see the objects inside my file, but i cant use the second code for reading, I think its because I just have directory files.
So can you understand from this information how many columns of data do I have?
I would like to check, if possible the dimension of the data stored on my file, but im having trouble with that.