after succeeded to write my class deriving from TObject to a file, i found another issue to solve.
(One solution opens a more complicated problem, often ).
I have to hadd many files and of course by default my user class is not handled.
Looking into hadd.cxx i saw that i can implement a Merge(TCollections*) method to sum my class over multiple files. Can you kindly point me to an example to understand “how” i have to implement it ?
see examples in TH1::Merge, TEfficiency::Merge, TProfile::Merge, TPolyLine::Merge, TTree::Merge.
thanks! I implemented them but i still get the hadd error
Cannot merge object type, …
Do i need to do something before calling hadd ? Like loading lib dictionary ?
Did you create a rootmap file for your class(es)? if not, hadd cannot dynamically link your shared lib.
An alternative for you is to use the class TFileMerger that provides the same functionality as hadd.
i tried with TFileMerger compiling a small C++ code linking my class dictionary.
When i run it, it merges histograms but just copies my class without calling my Merge method.
Am i missing something?
What is the signature of your Merge function? Can you provide a small example reproducing the problem?