Retrieving elements from a TObjArray

From: Chiara Zampolli <Chiara.Zampolli_at_bo.infn.it>
Date: Sat, 29 Oct 2005 13:35:45 +0200


Dear rooters,  

   I have written a TObjArray made up of elements which are AliTOFUncalib class istances, each defined in this way:  

TObjArray UCdata(10);
For (Int_t i =0; i ++; i < 10) {
  UCdata[i] = new AliTOFUncalib();
  AliTOFUncalib *ciccio = (AliTOFUncalib*)UCdata.At(i);   ciccio->Set....
...
}
After writing the TObjArray in the root file with the name "array", I retrieve it with:  

TObjArray* objarray;
file->GetObject("array", "objarray");  

Now, I try to pick up each element of the array in this way:  

TFile * file = new TFile(.);
TObjArray * objarray;
file->GetObject("array",objarray);
AliTOFUncalib * element0 = (AliTOFUncalib*)objarray[0]; AliTOFUncalib * element1 = (AliTOFUncalib*)objarray[1];  

But this doesn'y work!!! There seems to be a problem with a sort of "conversion" from TObjArray type to AliTOFUncalib type.I have tried some other ways, but with no success.  

Could you help me? How can I retrieve the elements of the TObjArray which are of type AliTOFUncalib?
Thank you a lot.
Cheers,

    Chiara   Received on Sat Oct 29 2005 - 13:32:35 MEST

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