problem writing TArrayF

From: Beatriz Fuentes Arenaz (beatriz@fpddux.usc.es)
Date: Mon Oct 18 1999 - 22:05:56 MEST


Hello root gurus,

We have found a problem when writing more than one TArrayF pointer into a
buffer. For example, we can write a Test (see code below) object into a
file, but when reading it back we get the following error message:

	 Error in <TBuffer::ReadClass>: illegal class tag=55 (0<tag<=3),
I/O buffer corrupted

 *** Break *** segmentation violation


The error does not appear if one of the TArrayF pointers is not
persistent, or if we use the Streamer function in the code below. This
Streamer function only differs from the one automatically generated by
rootcint in the use of the TArrayF::Streamer instead of the >>
and << operators. 

This problem did not appear in ROOT version 2.21/08. Have you got insight
what the problem is? 


Thanks in advance,


			Manuel Sanchez Garcia
			Beatriz Fuentes Arenaz



# ifndef TEST_H
# define TEST_H

# include "TObject.h"
# include "TArrayF.h"

class Test : public TObject{

private:

  Short_t nSectors, nModules;        // number of sectors and modules in
setup
    TArrayF *resolution;             // plane resolution in cm
    TArrayF *efficiency;             // efficiency of chamber (in %)
public:
    Test(void);
    ~Test(void);

ClassDef(Test,1)
};


# endif



# include "test.h"
# include <iostream.h>

ClassImp(Test)


  Test :: Test(void){

  nSectors = 6;
  nModules = 4;

  efficiency = new TArrayF(nSectors*nModules);
  resolution = new TArrayF(nSectors*nModules);

}


Test :: ~Test(void){

  if (resolution) delete resolution;
  if (efficiency) delete efficiency;
}


#if 0

void Test::Streamer(TBuffer &R__b)
{
   // Stream an object of class HMdcsDigiPar.

   if (R__b.IsReading()) {
      Version_t R__v = R__b.ReadVersion(); if (R__v) { }
      TObject::Streamer(R__b);
      R__b >> nSectors;
      R__b >> nModules;
      resolution->Streamer(R__b);
      efficiency->Streamer(R__b);
   } else {
      R__b.WriteVersion(Test::IsA());
      TObject::Streamer(R__b);
      R__b << nSectors;
      R__b << nModules;
      resolution->Streamer(R__b);
      efficiency->Streamer(R__b);
   }
}
#endif






---
	Manuel Sanchez Garcia
	Beatriz Fuentes Arenaz
Org:    Departamento de Fisica de Particulas, despacho 106
	Facultad de Fisica
        Universidad de Santiago de Compostela
Mail:   E - 15706 - Santiago de Compostela     Tlf:   +34-981-563100 ext:13981 
E-Mail: manuel@fpddv1.usc.es                   Fax:   +34-981-521091
        beatriz@fpddux.usc.es



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:41 MET