Reset a class object saved in a tree when calling GetEntry

Let’s say I have saved a float number triggerTime and a class TEvent into a tree. When I read an event from the tree using tree->GetEntry(ievt), the content of triggerTime is overwritten by the new value. Some members in TEvent should be recalculated or at least be reset to their initial value when a new entry is read from the disk. This can be done if I call event->Reset() manually before tree->GetEntry(ievt). If the user forget to do it, he is in trouble. Is there a way to automize this? Shall I costomize TEvent::Streamer?

Thanks, Jing

I’m not sure but I think the “default” automatically generated streamer will always call the “default constructor” of your class (unfortunately I don’t remember if it will be called for every event or just for the very first one, sorry).
So, try to add a call to “Reset” in the “default constructor” of your class and maybe it will be fine.
See: ROOT User’s Guide - Chapter 15. Adding a Class - The Default Constructor