How to navigate a root file and find what I want

I am very new to ROOT. I have a root file which was produced by Corrywrreckan weighting above 200 MB, where I expect to find some kind of list of Track objects . When I open the file with the TBrowser I find this:

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_?


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

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

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

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.


1 Like

Thanks for your answer. I am trying to iterate over these tracks. I watched a tutorial which I am following. I wrote this in root_script.c:

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

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?

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.