Re: [ROOT] Problem with custom streamer with root versions >= 3.03

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jan 21 2003 - 22:04:12 MET


Ruben,

This is the normal behaviour. Your original file is wrong. So, the 
automatic algorithm correctly reports the mismatch and is able
to skip to the next record.

Rene Brun

On Tue, 21 
Jan 2003, Ruben Shahoian wrote:

> Dear Rene,
> thank you, and sorry for buggy example. But now, when I forbid
> writing of fPermIndx,
> Int_t* fPermIndx; //! Permutations index array for LU decomposition
> and increased the counter in the ClassDef,
> when I am reading our old data (written with previous version of the
> class), 
> I get an error message even with root.3.02:
> Error in <TBuffer::CheckByteCount>: object of class NaCovMatrix read too many bytes
> Warning in <TBuffer::CheckByteCount>: NaCovMatrix::Streamer() not in sync with data on file, fix Streamer()
> 
> Are there limitations on the automatic schema evaluation with custom
> streamers? As I understand, with new version of the class, the existing
> record for fPermIndx (written by previous version) should be simply
> neglected.
> 
> Best regards,
> 	Ruben
> 
> On Tue, 21 Jan 2003, Rene Brun wrote:
> 
> > Hi Ruben,
> > 
> > It took me sometime to investigate your problem.
> > You have far too many compilation errors when running with gcc3.2.
> > 
> > Anyhow, I found your problem. In your class, you have a data member;
> >   Int_t* fPermIndx; //[fSize] Permutations index array for LU decomposition
> > 
> > in your constructor, you set fSize, but forget to create the array fPermIndx.
> > This array should have the length fSize.
> > 
> > Rene Brun
> > 
> > Ruben Shahoyan wrote:
> > > 
> > > Hello,
> > > I have a class with custom streamer, which works fine for root 3.02 and
> > > lower but produces an error during the reading with all higher root
> > > versions:
> > > 
> > > Error in <TBuffer::CheckByteCount>: object of class NaCovMatrix read too
> > > many bytes: 107 instead of 95
> > > Warning in <TBuffer::CheckByteCount>: NaCovMatrix::Streamer() not in sync
> > > with data on file, fix Streamer()
> > > 
> > > The relevant parts of the class definition are
> > > 
> > > typedef Float_t MElem_t;     // Type of matrix elements
> > > 
> > > class NaCovMatrix : public TObject {
> > >   protected:
> > >   Int_t     fSize;   //   Size of the matrix
> > >   Int_t     fSize2;  //   Number of elements (size^2)
> > >   MElem_t*  fElements; //[fSize2] Elements
> > >   MElem_t** fIndex;    //!  Pointers on rows
> > > 
> > > };
> > > 
> > > The streamer looks like:
> > > 
> > > void NaCovMatrix::Streamer(TBuffer &R__b)
> > > {
> > >   // Stream an object of class NaMatrix.
> > >    if (R__b.IsReading()) {
> > >       NaCovMatrix::Class()->ReadBuffer(R__b, this);
> > >       fIndex = new MElem_t*[fSize];
> > >       MElem_t* pnt=&fElements[0];
> > >       for (Int_t i=0;i<fSize;i++,pnt+=fSize) fIndex[i] = pnt;
> > >    } else {
> > >       NaCovMatrix::Class()->WriteBuffer(R__b, this);
> > >    }
> > > }
> > > 
> > > Does anybody have idea what could be the reason?
> > > I attach the small script testM compiling and running an example
> > > producing an error with root 3.03, 3,04 and 3.05 but working with 3.02
> > > 
> > > Best regards,
> > >         Ruben
> > > 
> > >   --------------------------------------------------------------------------------
> > >                      Name: testMat.tar.gz
> > >    testMat.tar.gz    Type: Unix Tape Archive (application/x-tar)
> > >                  Encoding: BASE64
> > 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET