How to save vector<TVector3> in a tree?

I want to save a TVector3 from one root file to a new root file. I want to store the TVector3 information event wise.
But don’t have any method to do this. Suggestions are requested.

Hi,

do you have multiple TVector3 per event? If yes, you can save the TVector3 in a std::vector<TVector3>. Using Case E in the TTree documentation shows how to save it to a tree.
If it’s only a single TVector3 per event, you can save it using Case B in the documentation.

However, is there a particular reason why you want to copy the information? A friend tree could be what you are looking for:
https://root.cern.ch/doc/master/classTTree.html#a011d362261b694ee7dd780bad21f030b

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.