In theory, you can use http://root.cern.ch/root/html524/TGenericTable.html
Together with http://root.cern.ch/root/html524/TTableSorter.html you can get the STL map functionality.
However ,TTable is restricted. It can use the C-basic types only.
I.e. you can not get
map<int_t,TString>
you can get
map<Int_t, char[20])
On the other hands, I think the modern ROOT version can write NON-TObjects too.
> Is there any better way then to create a TObject-derived class that
> wraps Int_t?
I can not say whether it is "better for you". but one can overload and provide the custom TObject::Streamer method and this way serialize any kind of class.
Valeri Fine
From: owner-roottalk_at_root.cern.ch on behalf of Rene Brun
Sent: Mon 8/10/2009 3:13 AM
To: Ronen Abravanel
Cc: roottalk_at_root.cern.ch
Subject: Re: [ROOT] Using numbers inside root collection.
You can write any non-TObject to a ROOT file, STL collection or ROOT
class like TArray.
For example, you can create a TArrayI object and write it to a file with:
root [0] TFile f("junk.root","recreate") root [1] TArrayI a[5] root [2] a[0]=0 root [3] a[1]=1 root [4] a[2]=2 root [5] a[3]=3 root [6] a[4]=4 root [7] f.WriteObjectAny(&a,"TArrayI","a")
For more details, read chapter about I/O in the Users Guide.
Rene Brun
Ronen Abravanel wrote:
> Hello,
>
>
> I want to use collection that use numbers (for example, like STL's
> map<Int_t,TString>...)
>
>
> Is there any better way then to create a TObject-derived class that
> wraps Int_t?
>
> (And the same thing about writing Integers into a root file.. Is there
> other way to write numbers to a root file other then wrap them by an
> object?)
>
>
> Thanks,
>
> Ronen.
>
Received on Mon Aug 10 2009 - 16:33:09 CEST
This archive was generated by hypermail 2.2.0 : Mon Aug 10 2009 - 17:50:02 CEST