I have a TDirectory (for example the gDirectory), which includes other TDirectories with some objects in them (for example histograms). It looks like this:
TDirectory* rootDir = gDirectory; TDirectory* oneBelowDir = rootDir->mkdir("histograms"); oneBelowDir->cd(); Directory* testDir = oneBelowDir->mkdir("sub_directory"); testDir->cd(); TH1F th1("test1", "title", 10, 0, 5); rootDir->cd();
Now I want to stream this directory structure (either the full gDirectory or at least the oneBelowDir). I tried streaming the directory itself or the list of it, but always end up with
Warning in <TMessage::WriteObjectAny>: since TROOT has no public constructor which can be called without argument, objects of this class can not be read with the current library. You will need to add a default constructor before attempting to read it. Warning in <TStreamerInfo::Build>: atomic_flag: base class __atomic_flag_base has no streamer or dictionary it will not be saved
and a segfault when reading. Here is my streaming code:
TMessage message(kMESS_OBJECT); message.WriteObject(rootDir->GetList());
TList* rootDir = (TList*)(message.ReadObject(message.GetClass()));
I am happy for any suggestions!