# How to navigate a root file and find what I want

**URL:** <https://root-forum.cern.ch/t/how-to-navigate-a-root-file-and-find-what-i-want/56398>\
**Category:** Newbie\
**Created:** [September 18, 2023, 7:32am UTC](https://root-forum.cern.ch/t/how-to-navigate-a-root-file-and-find-what-i-want/56398 "2023-09-18T07:32:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![0101101](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/0101101/32/33873_2.png) [@0101101](https://root-forum.cern.ch/u/0101101)\
**Post date:** [September 18, 2023, 7:32am UTC](https://root-forum.cern.ch/t/how-to-navigate-a-root-file-and-find-what-i-want/56398/1 "2023-09-18T07:32:14Z")

</div>

I am very new to ROOT. I have a root file which was produced by [Corrywrreckan](https://project-corryvreckan.web.cern.ch/project-corryvreckan/) weighting above 200 MB, where I expect to find some kind of list of [`Track` objects](https://project-corryvreckan.web.cern.ch/project-corryvreckan/reference/classcorryvreckan_1_1Track.html). When I open the file with the `TBrowser` I find this:

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/8/2/823dfb26c31d71b9973f7e1f0a10bf74f8580d96.png)

Now I have some questions:

1. What is the meaning of the number after the `;` in each tree? Why are there two `Track` trees?
2. Why does the `global` leaf weight 1791 M, when the whole file weights 199 M?
3. I see several leaves end their name with `_`, is this some kind of convention meaning something?

I am trying to understand also the structure of the file. Is `Track;8` some kind of list of `global` leaves, each containing all those things? So then each `global` leaf should be associated with each track I am expecting to find in here? I noticed that when I double click on, e.g., `chi2_` it takes some seconds and then shows the plot, as if it were iterating through each `global` leaf and querying the `chi2_`?

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [September 18, 2023, 8:50am UTC](https://root-forum.cern.ch/t/how-to-navigate-a-root-file-and-find-what-i-want/56398/2 "2023-09-18T08:50:36Z")

</div>

Hi,

> [@0101101](#):
>
> What is the meaning of the number after the `;` in each tree? Why are there two `Track` trees?

It is version number of the saved object in the ROOT file.  
You should use highest number to get most recent data from your tree

> [@0101101](#):
>
> Why does the `global` leaf weight 1791 M, when the whole file weights 199 M?

That you see is total size of unpacked data for the branch.  
It can be much bigger than the zipped file size.

> [@0101101](#):
>
> I see several leaves end their name with `_`, is this some kind of convention meaning something?

It is naming convention when branch creates sub-branches or leaves. Maybe @pcanal can give more comments.

> [@0101101](#):
>
> I noticed that when I double click on, e.g., `chi2_` it takes some seconds and then shows the plot, as if it were iterating through each `global` leaf and querying the `chi2_`?

Yes, when you double click such branch, `TTree::Draw` is executed and produced result will be shown. Such action can take time, therefore in ROOT master we showing progress bar. It will be released soon as 6.30 version.

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![0101101](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/0101101/32/33873_2.png) [@0101101](https://root-forum.cern.ch/u/0101101)\
**Post date:** [September 18, 2023, 9:10am UTC](https://root-forum.cern.ch/t/how-to-navigate-a-root-file-and-find-what-i-want/56398/3 "2023-09-18T09:10:22Z")

</div>

Thanks for your answer. I am trying to iterate over these tracks. I watched [a tutorial](https://www.youtube.com/watch?v=BH5XvjRzYHQ) which I am following. I wrote this in `root_script.c`:

```auto
#include "TROOT.h"
#include "TObject.h"
#include "TFile.h"
#include "TTree.h"
#include "Track.hpp" // Corry's Track definition.

void main() {
	TFile f("corry_output/tracks.root");

	TTree* tracks;
	f.GetObject("Track", tracks);

	Track track;
	tracks->SetBranchAddress("Track", track);
}

```

and I am executing it like this `root root_script.c`. With this I get `fatal error: 'Track.hpp' file not found`. However, it is strange to me that if I run this in the ROOT interpreter itself, it works and I get an error somewhere else:

```auto
root [0] TFile f("tracks.root");
root [1] TTree* tracks; f.GetObject("Track",tracks);
root [2] #include <Track.hpp>
root [3] Track track;
ROOT_prompt_3:1:6: error: expected ';' after expression
Track track;
     ^
     ;
ROOT_prompt_3:1:7: error: use of undeclared identifier 'track'
Track track;
      ^

```

I also tried hardcoding the full path to the `Track.hpp` file in the `#include` statement, in this case it prints a lot of things and then I get some error.

How could I iterate over the tracks and get access to these objects?

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [September 18, 2023, 11:43am UTC](https://root-forum.cern.ch/t/how-to-navigate-a-root-file-and-find-what-i-want/56398/4 "2023-09-18T11:43:55Z")

</div>

> I see several leaves end their name with `_`, is this some kind of convention meaning something?

They are the names defined by CorryVreckan inside the `Track` class  
[Corryvreckan: corryvreckan::Track Class Reference](https://project-corryvreckan.web.cern.ch/project-corryvreckan/reference/classcorryvreckan_1_1Track.html#pro-attribs).
