RE: [ROOT] CORRECTION!! R__unzip error

From: Philippe Canal (pcanal@fnal.gov)
Date: Thu Mar 07 2002 - 00:08:14 MET


Hi,

I originally said:

> Currently the maximum size for a buffer to be compressed is 16Mb.
> In practice this means no single object can use more than that.

However, this is NOT correct.  The current ROOT I/O implementation has
already taken in consideration the limitation of the compression algorithm
and can INDEED save object of any size in one shot. (well they still have to
fit in a physical file (limitation for now 2Gb)).

My apologies for the confusion

Cheers,
Philippe.

PS. The 16Mb number is just the maximum chunk size in which the
compression algorithm can compress.

PPS. Ed's problem is in its attempt to provoke the saving
of an external object from within a Streamer

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Philippe Canal
Sent: Tuesday, March 05, 2002 6:55 PM
To: Ed Oltman; Roottalk@Pcroot. Cern. Ch
Subject: RE: [ROOT] R__unzip error


Hi Ed,

Currently the maximum size for a buffer to be compressed is 16Mb.
In practice this means no single object can use more than that.

If I am guessing correctly, your intend is to be able to 
analyze the ntuple in memory (since you have enough) space and
then write it in one zip on the file.

> when it is created, the current directory is not writable. 
> [this is the only way I know how to make an ntuple memory resident]

the following:
	mytree = new TTree(...); (or TNtuple)
	mytree->SetDirectory(0);
will have the same effect.

> Note2: I can succesfully read the the ntuple from the root file:

Since your ntuple is already properly saved on the file, I recommend
to not save it a second time inside your CAnalysis object (is that
really what you doing or am I missing something).

Also, If you wish to have a convenient 'pointer' to the TNtuple from
within the saved CAnalysis, you should consider using a TRef (i.e.
the CAnalysis object contains a TRef that reference the TNtuple).

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Ed Oltman
Sent: Tuesday, March 05, 2002 11:25 AM
To: Roottalk@Pcroot. Cern. Ch
Subject: [ROOT] R__unzip error


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