You are here

Reading a TTree with the TTreeReader


This example shows how to read a complex TTree with the TTreeReader. A ROOT file is opened and a TTreeReader initialised with the name of the TTree we want to study and the pointer to the file. Then a TTreeReaderValue is created, templated with the type of the tree branch we want to access: tracks. After these preliminary operations, we just need to iterate on the events in the tree and on the tracks in the track collection we are reading.