gDirectory

Dear rooters,

I have two question:

  1. Three years ago in topic
    root.cern.ch/phpBB2/viewtopic.ph … highlight=
    it was said that

Is it still true or I can add objects of any classes (also my own) to directory right now?

  1. If answer for first question is that it is possible, then I wonder what is the correct way to add object to directory and what is the difference (documentation is very pure) between:
    a) gDirectory->GetList()->Add();
    b) gDirectory->Add();

Thanks in advance

[quote]Is it still true[/quote]Yes in the sense that you can delegate ownership of your object to a TDirectory object if and only if they inherit from TObject.

However you can store in a file (via a TDirectory or TFile object) any object type (use WriteObject).

Cheers,
Philippe

Thank you for answer.
And what is a proper way for adding: gDirectory()->GetList()->Add(), or simply gDirectory->Add()?

gDirectory->Add() …

Cheers,
Philippe