Missing clearing of TStore during event loop
We currently do not clear the T(Active)Store at a central place in our event loops. This can have nasty consequences when recording entire containers to TEvent or SgTEvent (yes, this makes an important difference...) as these containers would not be cleared and can be re-retrieved in the next event!
Behavior if TEvent::record/retrieve is used: the newly created containers are not cleared unless one explicitly records a new instance. So, if one writes code that tries to re-use an already created container (e.g. from another channel) using TEvent::transientContains
and TEvent::retrieve
then one would actually retrieve a container from a previous event!
Behavior with SgTEvent: upon trying to record the container for the second event one receives an error that one tries to overwrite an existing one (so somehow it must become non-transient upon switching the event and/or copying it to the output?).
In any case, TEvent::record should be avoided, it seems that even things like xAOD::TActiveStore::store()->clear()
have no effect there. If a SgTEvent is used (which explicitly sends things to the (active)Store then inserting the clearing line in the MCASV results in what seems like the desired behavior.
Tagging @bwinter @jhinze : you guys may have thus far gotten away without running into this nastiness, but should likely be aware