Making TFileMerger Compatible Classes

Hi,

Classes that are not compiled (via ACLiC or via rootcint + compiler) are not support in I/O (and thus not by the TFileMerger).

[quote]Inheriting from TKey and setting fClassName stores the class name properly. [/quote]Unless you have a very unusual use case, your object should NOT inherit from TKey.

The way things works is that you stored on object via:

mydirectory->WriteObject(objptr,"name");which streams your object into a memory buffer, create a TKey with the right information (name,classname) and write the 2 in the file.
while mydirectory->GetObject("name",objptr);will do the reverse.

I.e. you should not have to deal directly with the TKey.

To add support for merging your object via TFileMerge instead you need to implement either:virtual Long64_t Merge(TCollection *list);or virtual Long64_t Merge(TCollection* list, TFileMergeInfo *info);See TH1::Merge and TTree::Merge for example.

Cheers,
Philippe.