but what happens when the current file is changed during the event loop? Do I need to manually update userInfoObj to the user info object of the new file or can this operation be automated?
Thanks.
Yes, you need to reload the object for each file/tree. This can be ‘somewhat’ automated by adding a callback object to the TTree via TChain/TTree::SetNotify and having that callback object override the Notify member function (which will be called by the TChain at each file transition).