How to save std::unique_ptr into TTree?

Dear ROOT experts,

In a previous forum post [1], it was mentioned that saving unique_ptrs in a TTree is possible. I tried using the example code here [2], which writes and reads a TTree using a dictionary, but it doesn’t seem to work.

@pcanal, could you please help me understand how to do this, or point me to a working example? It seems that most TTree examples have been removed…

Thank you very much!

Best regards,
Alvaro

[1] Is shared_ptr supported in class member derived from TObject? - #5 by pcanal

[2] GitHub - atolosadelgado/customTTreeExample


ROOT Version: 6.36.000
Platform: Alma9
Compiler: gcc 14

Dear Alvaro,
Thank you for your question. You even identified the corresponding expert.
I just wanted to mention that due to today’s US holiday, the reply latency may be higher.
Best,
Lukas