RE: Writing TObjArray in a file

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Fri, 28 Oct 2005 10:28:01 -0500


Hi Chiara,  

To write a ROOT collection as a single object in a TDirectory use:

    UCdata.Write(TObject::kSingleKey);

> Morevoer, the elements are described as AliESDtracks and not
AliTOFUncalibs!

In you example I see UnCalib instead of AliTOFUncalibs ... and I see the following error:

    #pragma link C++ UnCalib+;
should be

    #pragma link C++ class UnCalib+;

Cheers,
Philippe.


From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Chiara Zampolli
Sent: Friday, October 28, 2005 9:06 AM
To: roottalk_at_pcroot.cern.ch
Subject: [ROOT] Writing TObjArray in a file

Dear rooters,  

    I am trying to write a TObjArray in a root file. The TObjArray UCdata I create (see attached file, a very naïve example of what I am doing) is made up of AliTOFUncalib data, which inherit from the AliESDtrack class (an AliRoot class which, in turn, inherits from the TObject class). After writing UCdata in the file, when I try to list the content of the file (file->ls();), what I get is the list of all the elements of the TObjArray instead of the TObjArray itself. Morevoer, the elements are described as AliESDtracks and not AliTOFUncalibs! Perhaps this is exactly the way it should be, but since I would need then to retrieve from the file the whole TObjArray, this doesn’t seem the right way to follow (also because there will be few thousands of elements in the TObjArray to be retrieved). In other words, how can I write on a file a TObjArray and then retrieve it as a whole? (I think that then, for each element, the method At() will be ok….).  

    Thank you for your help.

    Cheers,

       Chiara Received on Fri Oct 28 2005 - 17:28:45 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET