Dear rooters,
I am trying to write and then reading an object to (from) a file. The object is an instance of a class I have created which inherits from TObject. The class is very simple:
class AliTOFCalib: public TObject
{
public:
AliTOFCalib() {fPads= new AliTOFCalParam[npad];}
virtual ~AliTOFCalib(){delete[] fPads;}
void Browse(TBrowser *b)
{
char name[10];
for(Int_t i=0; i<18; ++i) {
snprintf(name,sizeof(name),"Sector %2.2d\0",i); b->Add(new AliTOFCalSector1(&fPads[i*npad/18]),name);}
private:
// AliTOFCalParam fPads[npad];
AliTOFCalParam * fPads;
ClassDef(AliTOFCalib,1)
};
where AliTOFCalSector1 is a class I have written, similar to this one. I write it on a file:
AliTOFCalib *tc = new AliTOFCalib();
TFile * file = new TFile("prova.root","recreate");
tc->Write("tc");
file->Close();
and then when trying to read it
AliTOFCalib *cal1 = new AliTOFCalib(); TFile *file1 = new TFile("prova.root","read"); file1->GetObject("prova",cal1);
I get:
I do not know, perhaps I do not write anything, since when I dump the file I get (the underlined line is the suspicious one...):
file1->Dump()
==> Dumping object at: 0x09f4f9c8, name=prova.root, class=TFile
fSumBuffer 0 Sum of buffer sizes of objects written so far fSum2Buffer 0 Sum of squares of buffer sizes of objects written so far _*fBytesWrite 0 Number of bytes written to this file*_ fBytesRead 1176 Number of bytes read from this file fBEGIN 100 First used byte in file fEND 874 Last used byte in file fSeekFree 820 Location on disk of freesegments structure
could you help me?
Thank you a lot.
Cheers,
Chiara Received on Sun Nov 20 2005 - 14:19:24 MET
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET