-
Notifications
You must be signed in to change notification settings - Fork 54
support for object branches #3
Comments
Probably possible but would be lots and lots of work and I guess it will be really slow. |
OK, I'll put it on my "dream list". If you are willing to pay the price of including object info, then I still think it could be very useful, especially if only taking the hit once when converting a tree into HDF5 to play with your data in PyTables. |
The new refactor allow for this kind of stuff. See the converters array in _librootnumpy.pyx. But you will need to know inner working of how root dump object to get it to work. |
Putting a note here about internal working of root object dump.
So for now it is possible to dump object but only for SINGLE fields, FIXED field and some Varied field. Vector will work transparently. |
Hey all, So the idea of object-level information in the file is now going to be succeeded by xAODs which handles all of this work. https://svnweb.cern.ch/trac/atlasoff/browser/Event/xAOD An example is a Tau Jet object: https://svnweb.cern.ch/trac/atlasoff/browser/Event/xAOD/xAODTau/trunk/Root/TauJet_v1.cxx Now they did include backwards-compatibility, so there is a way to dump an xAOD as an n-tuple. Going the other way is supposed to be hard; but I'm still starting to jump into this new data format. So I don't know a whole lot about actually using it in practice. |
xAOD is an ATLAS-specific format. The idea here it to be able to take a TTree containing branches of ROOT objects (or even user-defined objects) and providing a mechanism to convert the objects (instead of skipping them) into variable/fixed-length array representations in the numpy array. Like the example above, if I have TLorentzVectors and I care about the Eta() and Pt() of these objects, then there should be a way in tree2array to automatically grab these fields from the objects in these branches and generate the fields in the output record array. |
Fields that are expressions involving objects are now supported as of 4.0.1 ref #184. So I'm closing this. |
Say you have some branches of objects, like TLorentzVectors, and you want to include something about them in the output array. What if you could pass in a dictionary of [class name] -> [list of functions] and for every branch encountered of type [class name], N=len([list of functions]) columns in the output array would be included and filled with the output of each function called on the object. For example you could pass in a function pt() for TLorentzVectors that would return the transverse momentum:
and a column with the name of the original object branch suffixed with _pt would be filled with the output of that function. Do you think this would be difficult to implement?
The text was updated successfully, but these errors were encountered: