I am trying to use uproot to do some basic selection from a Delphes .root output file. Delphes's c++ code examples are looping over events and accessing reconstructed BranchElements, which have methods to access the branch elements belonging to various classes.
e.g. The root file contains a <TBranchElement b'Jet' at 0x7fb36526b3c8>
that (in c++) Delphes example code can use to get object=jet->Constituents.At(i)
in a "for" loop and then if this object
is a object->IsA() == Tower::Class
then one calls object->P4()
to get the 4momentum.
So, whereas using uproot one could only separately get the two values, in Delphes examples one uses the Jet class to get access to the Tower class (from which the Jet was reconstructed) using a method.
The information I see is:
Jet_size (no streamer) asdtype('>i4')
Jet TStreamerInfo asdtype('>i4')
Jet.fUniqueID TStreamerBasicType asjagged(asdtype('>u4'))
.
.
.
Jet.Constituents TStreamerInfo asgenobj(SimpleArray(TRefArray))
<TBranchElement b'Jet' at 0x7fb3657825f8>
<TBranchElement b'Jet.Constituents' at 0x7fb47840cba8>
For uproot, if one loads the TBranchElement as an array, then there's only access to the array elements in Jet.Constituents[i]
, which are lists of numbers.
How would I be able to load Jet.Constituents
in a way that refers to the Tower.PT
(or eta,phi etc.) values that it contains?