Reading from trees and transient data members

Dear ROOTers,

I have trees with clone arrays of objects containg transient data members. I noticed that such a transient data member is always filled with its content from the last entry of the tree when reading the next tree entry. This means one cannot set a particular default value via the default ctor. Is this a wanted feature? How can I changed it?

The problem I have is that inside this class I want to be notified whenever a new entry is read from the tree. My idea was to use a transient data member for this.

Any advice will be gladly appreciated.
Oliver

Hi Oliver,

Your Tree has probably been created in split mode. In this case,
there is no call to the class constructor when reading your entries.

You can always test via tree.GetReadEntry() and store the return value
in your transient member.

Rene

Hello René,

[quote=“brun”]
You can always test via tree.GetReadEntry() and store the return value
in your transient member.
Rene[/quote]
I 've been thinking about this already. The problem is that the code shell be implemented in a method of a class being part of the tree. Thus I don’t have a handle to the tree and cannot call TTree:GetReadEntry() directly. At the moment I’m looking for a way to grab the pointer of the (parent) tree whom the object belongs to.

Thanks anyway,
Oliver

Hi,

If I understood you correctly, the closest thing in ROOT itself would be the global variable gTree. It would be better for your infrastructure to provide a well define interface to the tree you reading.

Philippe.