title: Cern ROOT - How to read contents from a TTree root file into array
body: <p>I am trying to read data in from a Cern ROOT TTree file. I have not used root before and I am struggling a bit with this. I am familiar with C++, so can sort the array side of things, but I have been through several tutorial pages online and haven't got anywhere.</p>
  
  <p>How do I read data from a TTree file? I assume it would be done by iterating over the tree's nodes (again, I'm not exactly sure how the file is organized?) inside a for loop?</p>
  
  <p>Here is an example of the sort of reference I have been trying to follow.</p>
  
  <p><a href="https://root.cern.ch/drupal/content/using-macro-read-ttree" rel="nofollow">https://root.cern.ch/drupal/content/using-macro-read-ttree</a></p>
  
  <p>As I understand it this is a generic question, but TTree's are not generic? (Since they could contain different variable names, I think?)</p>
  
  <p>So, further information, which I think is important is:</p>
  
  <p>By opening the root object browser <code>TBrowser b</code> - and browsing to the '.root' file, (and double clicking it) I can see that there are 12 variables in the file. For example, one is called 'mass', 'charge', etc...</p>
  
  <p>Hope that's enough info? If not I can provide more.</p>