# Problem on reading files

**URL:** <https://root-forum.cern.ch/t/problem-on-reading-files/51629>\
**Category:** Newbie\
**Tags:** tree, python, root\
**Created:** [September 20, 2022, 9:16pm UTC](https://root-forum.cern.ch/t/problem-on-reading-files/51629 "2022-09-20T21:16:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreM](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@AndreM](https://root-forum.cern.ch/u/AndreM)\
**Post date:** [September 20, 2022, 9:16pm UTC](https://root-forum.cern.ch/t/problem-on-reading-files/51629/1 "2022-09-20T21:16:00Z")

</div>

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.

![4](https://root-forum.cern.ch/uploads/default/original/3X/1/4/142dc4300f27c073037ac6c9d38fc63416e74cc2.png)

This time i want also to analyse the data from a .root file but that data is organized inside in folders for some reason.

![5](https://root-forum.cern.ch/uploads/default/original/3X/7/5/75766b9601fa81637aa1b153430cacc6bc2108ea.png)

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:

 ![3](https://root-forum.cern.ch/uploads/default/original/3X/8/d/8d77f697cc706a03e40e533dd355607c3e44ed01.png)

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 🙂

Best regards,  
Andre Miranda

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [September 21, 2022, 5:34am UTC](https://root-forum.cern.ch/t/problem-on-reading-files/51629/2 "2022-09-21T05:34:50Z")

</div>

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):

```auto
 rootls -l yourfile.root

```

to see what they are, e.g.

```auto
  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():

```auto
import ROOT
f = ROOT.TFile("hsimple.root","read")
h = f.Get("hpx")
h.Draw()

```

and so on.

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [September 22, 2022, 4:38pm UTC](https://root-forum.cern.ch/t/problem-on-reading-files/51629/3 "2022-09-22T16:38:18Z")

</div>

When there are directories, you can usually access those objects as:  
“directory/Rnamexxx” with slashes.

---

<div class="post-metadata">

**Author:** ![AndreM](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@AndreM](https://root-forum.cern.ch/u/AndreM)\
**Post date:** [September 23, 2022, 8:59am UTC](https://root-forum.cern.ch/t/problem-on-reading-files/51629/4 "2022-09-23T08:59:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AndreM](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/b19c9b/32.png) [@AndreM](https://root-forum.cern.ch/u/AndreM)\
**Post date:** [September 23, 2022, 9:00am UTC](https://root-forum.cern.ch/t/problem-on-reading-files/51629/5 "2022-09-23T09:00:33Z")

</div>

Hello @ferhue i dont think i understand what you meant. Your sugestion is for me to do this navigation inside of ROOT?

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [September 23, 2022, 10:20am UTC](https://root-forum.cern.ch/t/problem-on-reading-files/51629/6 "2022-09-23T10:20:38Z")

</div>

> [@dastudillo](#):
>
> `f.Get("hpx")`

I meant that instead of using f.Get(“hpx”) you can use f.Get(“mySubdir/hpx”) if that histogram is inside a particular subfolder.
