Mu2e / TrkAna

Track-based analysis TTree maker working in the art framework
Apache License 2.0
2 stars 20 forks source link

Work out how we can read the XYZVectorFs as XYZVectorFs in uproot #157

Closed AndrewEdmonds11 closed 3 months ago

AndrewEdmonds11 commented 3 months ago

At the moment, reading any XYZVectorF in uproot gives the three components (fCoordinates.fX etc.) and so we have to calculate the magnitude of the vector ourselves. It would be nice if we could read these leaves as XYZVectorFs so that we can take advantage of its member functions.

In principle this should be possible (uproot does support ROOT classes) so it just needs someone to look into

sophiemiddleton commented 3 months ago

Screenshot 2024-06-26 at 17 26 41

sophiemiddleton commented 3 months ago

this seems to be the best way to retain vector properties. It allows us to use properties defined here: https://vector.readthedocs.io/en/latest/api/vector._methods.html . We need the scikit-hep vector package to be installed in pyana to be able to use this functionality.

We will make a util to help people with this

sophiemiddleton commented 3 months ago

https://github.com/Mu2e/TrkAna/issues/176 will follow the implementation of this and other functions into a python util. I think the initial task (to figure out how to do this) is complete so I will close this issue.