Good evening everyone, sorry to bother but i have a question regarding reading ROOT files. Im trying to perform some analysis and help was already provided here so i was able to analyse data from a given file. It was a .root file and its format included the usually system for data storage in ROOT: a tree and inside many branches.
This time i want also to analyse the data from a .root file but that data is organized inside in folders for some reason.
I get this files from a acquisition software so i thought they were all be the same but that doesn’t happen. When i run my code i get the following error:
Because im trying to access this columns in the same way i acess a file with a tree and branch system in place.
Can someone help me solve my problem? Maybe there is a way to read the data on this kind of arrangement or i can somehow use TTree to organize the folders. I have a limited knowledge of ROOT so i welcom all the help i can get
From your TBrowser image it seems that those “_R_Time…” objects are histograms, not trees or “variables”. You can do this on the terminal (outside ROOT):
rootls -l yourfile.root
to see what they are, e.g.
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"
You can get them with file.Get():
import ROOT
f = ROOT.TFile("hsimple.root","read")
h = f.Get("hpx")
h.Draw()
Hello @dastudillo, im trying to implement your sugestion but im just able to get 0D arrays. Some of this collumns are supose to have columns of data so i was wondering is your sugestion is capable of storing those values in a array for instance.