I tried the following macro:
{
gROOT->Reset();
char s[32];
THashList *l = new THashList;
for (int i = 0; i < 10; i++) {
THashList *h = new THashList;
l->Add(h);
for (int j = 0; j < 10; j++) {
sprintf(s, "aap %d", j);
h->Add(new TObjString(s));
}
}
}
is that something like what you try doing?
To store such a collection use something like:
TFile x("hash.root","recreate")
l.Write("l",TObject::kSingleKey)
and to read it do:
TFile x("hash1.root")
THashList *l = (THashList*)x.Get("l")
l->Print();
or is this not what you want?
Cheers, Fons.
Tioukov Valeri wrote:
>
> Hi rooters,
>
> I have data structure organized as following:
>
> THashList of objects type A
> where A is
> THashList of objects type B
>
> The Hash() of objects B is unic inside A but could be the same for
> B's from different A's.
>
> It worked perfectly before I tried to store and restore this staff.
>
> I note that after restoring the objects B with the same Hash() becomes
> the first stored B.
> So Hash() of any objects treated as the global one during the storing.
>
> But if I'd like to have the structure as described above and I want to
> store it. Is it possible to do in the correct way?
>
> Best regards
> Valeri
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910