[ROOT] R__unzip error

From: Ed Oltman (eoltman@imago.com)
Date: Tue Mar 05 2002 - 18:24:33 MET


Hello,
  I encounter the following error when reading a (user) object derived from
TObject from a root
file:

		R__unzip: error in header
		[ the header words checked are 0,9,0 instead of 67,83,8]

My object CAnalysis contains a pointer to TNtuple - I modified
CAnalysis::Streamer() (see below)
to save the TNtuple when the object is saved and restore the pointer when
the object is read in.
Note: the above error only occurs when the TNtuple is large (I have not
characterized the exact
size which triggers the problem - 10's of MB does not cause a proble, 100's
of MB does  I have 1GB
of ram)

Here's the modification of the CAnalysis::Streamer() for OUTPUT (
CAnalysis::Streamer was
never called on input - the R__unzip error occured in TKey::ReadObj() before
the streamer is
called - fNtCorr is a pointer to TNtuple member variable

			.
			.
			.
      R__b << (TObject*)fVoltProf;
      R__b << (TObject*)fTofMap;
      R__b.SetByteCount(R__c, kTRUE);
	if (fNtCorr)
		{
			TNtuple *pNcopy = new TNtuple("ntCorr",fPchTitle,kNTCORR);
			for(int i=0;i<fNtCorr->GetEntries();i++)
			{
				fNtCorr->GetEntry(i);
				Float_t *args = fNtCorr->GetArgs();
				pNcopy->Fill(args);
			}
		}
		gDirectory->Write();
	}

Note1: fNtCorr is MEMORY RESIDENT - that is, when it is created, the current
directory is
not writable. [this is the only way I know how to make an ntuple memory
resident]

Note2: I can succesfully read the the ntuple from the root file:
   TFile *f = new TFile("save.root");
   TNtuple *pNtup = (TNtuple *)f->Get("ntCorr");  //ok

I just can't read CAnalysis

   CAnalysis *pAn = (CAnalysis *)f->Get("CAnalysis") // R__unzip error in
header


I am using 3.02/07 for Win32, my code compiled win VC++ version 6

Any help would be greatly appreciated...

Ed



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:44 MET