ClassDef() Increases class size?

From: Maurik Holtrop (maurik.holtrop@unh.edu)
Date: Thu May 20 1999 - 20:47:23 MEST


Hello Root,

I seem to be running into a problem with ClassDef (and ClassImp) increasing
the size of my class's storage area by about 4 bytes. I am *not* deriving
from TObject, so the extra bytes are not from there.
Is there a way around this which will still give me all the nice features
(streamer, showmember etc) of ROOT but keep my class the exact same size as
the data members I defined?

The reason that the extra bytes are a problem is because I am setting
pointers into an already existing array with data (which is created by a
FORTRAN package called BOS), in order to read it's contends. The extra bytes
causes the next pointer to be 4 bytes off.

    Maurik


---------------------------------------------------------------------------------

Sample code:

The following code will have a "sizeof()" of 56 instead of the expected 52:

class TPARTData  {
 public:
  Int_t     pid;                     /*   particle id
(GEANT)                              */
  Float_t   x;                       /*   vector3_t vert; Vertex position
{x,y,z}          */
  Float_t   y;                       /*
y                                                */
  Float_t   z;                       /*
z                                                */
  Float_t   e;                       /*   vector4_t p;
Energy                              */
  Float_t   px;                      /*   momentum
{x,y,z}                                 */
  Float_t   py;                      /*
py                                              */
  Float_t   pz;                      /*
pz                                               */
  Float_t   q;                       /*
charge                                           */
  Int_t     trkid;                   /*   index to TBID bank, counting from
1              */
  Float_t   qpid;                    /*   quality factor for the
pid                       */
  Float_t   qtrk;                    /*   quality factor for the
trk                       */
  Int_t     flags;                   /*   set of flags defining track (ie,
BEAM)           */

  ClassDef(TPARTData,1)

};






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