Re: [ROOT] how to save a single variable?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Aug 12 2000 - 17:58:27 MEST


Aihong,
The solution with the least overhead is:
  TObject integer;
  integer.SetUniqueID(my_integer);
  integer.Write("some8identifier");

Instead of a simple TObject, you can also use a TNamed object to which
you can give a name and a title.

You can use objects like TVector, TVectorD to save an array
of numbers (floats, doubles)

Rene Brun

On Sat, 12 Aug 2000, Aihong Tang wrote:

> Hi, 
> 
> What I am trying to do is quite simple: Save an integer or float(and their
> name) in a root file and read it back by name. Since an number itself is
> not an object, I have to embedd it into an object so that I can save it.
> I am sure that there are a lot of work around.
> 
> But my question is: is there a dedicated class for this purppose? (like
> TNumber::TNumber(char* name, char* title, Int_t/Float_t number). )
> 
> Thanks!
> 
> Aihong
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET