ROOT Version: ROOT 6.26/06
I have a TObject which I need to make sortable for TClonesArray with a variable parameters (maybe “ascending via property A,” or “descending via property B”, etc…) As
TObject::Compare(const TObject*) and
TObject::IsEqual(const TObject) are the functions to overload, and don’t allow for additional parameters, I decided to just add a single pointer (
void*) to the object members. Then I can set that to point to a helper class which can be configured by the desired sorting parameters, and called by the overloaded
The streamer doesn’t seem to know what to do with the pointer. When the object is read out, I get a message like
Error in <TStreamerInfo::Build>: Jetv2, discarding: void* _sort_ptr, no [dimension].
I don’t particularly mind, in the sense that I only want to use the pointers associated with each TObject when the TClonesArray is already read out from the TTree, and then set the pointer in each object, do the sorting, and maybe put the TClonesArray into another TTree (at which point, I don’t mind if the pointers get lost again – they only matter for the duration of the sorting). However, I appear to be getting intermittent errors, and I am afraid I may sometimes corrupt reading the TObjects…
What should I do?