Reading ExRoot/Delphes files with TTreeReader

Hi,

I want to read Delphes files with a TTreeReader. For this I initialize a tree reader with

Then I try to access the branches with something like

But so far without success.
How can I read ExRoot/Delphes files with TTreeReader?

Best,
Jan

Hi Jan,

I have no idea of the structure of the TTrees generated by Delphes.
On the other hand, you can always generate the TTreeReader based code necessary to read an arbitrary ROOT file with TTree::MakeSelector (root.cern.ch/doc/master/classTT … 43434cbcb4)

Cheers,
Danilo

Hi Danilo,

I have already tried to use the TSelector, but it returns only a huge plain list of all members of all classes saved in the root file. Additionally all member functions of the original classes are missing.
It is considerably more convenient when I can work with collections of the original classes.
I was under the impression that this is possible with the TTreeReader, but I might be wrong.

Best,
Jan

Hi,

I was messing up the TTreeReader iterator.
Using TTreeReaderArray(tree_reader, “delphes_class_name”) works well.

Thank you
Jan

Hi Jan,

I marked the thread solved.
Just a little comment about your previous post: you are right. The MakeSelector utility generates code from the TStreamerInfos present in the file, i.e. the way in which objects are persisted. This information of course does not include anything about the methods of the original classes. Having the libraries available is, as you note, a huge advantage.

Cheers,
Danilo