Karl Bicker
2014-09-10 14:18:04 UTC
Dear rootonauts,
I am having a peculiar problem when working with TTree::SetBranchAddress(). I attached a breaking example script, which is intended to be compiled.
The problem is the following: When I am setting a branch address with a pointer on a pointer and the latter is deleted after the branch address has been set, the reading of the TTree does not work anymore (and somehow screws up the root command line). Is there a reason for this? Why does the pointer I am handing over to SetBranchAddress (via a pointer to it) have to survive while the TTree is being read? Would it not be a simple matter just to copy it in SetBranchAddress?
Thanks in advance for your help!
Best regards,
Karl Bicker
PS: For people who have enough time on their hands to read a lengthy forum post, the background of this question is here: http://root.cern.ch/phpBB3/viewtopic.php?f=14&t=17632
I am having a peculiar problem when working with TTree::SetBranchAddress(). I attached a breaking example script, which is intended to be compiled.
The problem is the following: When I am setting a branch address with a pointer on a pointer and the latter is deleted after the branch address has been set, the reading of the TTree does not work anymore (and somehow screws up the root command line). Is there a reason for this? Why does the pointer I am handing over to SetBranchAddress (via a pointer to it) have to survive while the TTree is being read? Would it not be a simple matter just to copy it in SetBranchAddress?
Thanks in advance for your help!
Best regards,
Karl Bicker
PS: For people who have enough time on their hands to read a lengthy forum post, the background of this question is here: http://root.cern.ch/phpBB3/viewtopic.php?f=14&t=17632