Re: [ROOT] TVector3 and TLorentzVector

From: George Heintzelman (georgeh@sparrowhawk.chm.bnl.gov)
Date: Mon Oct 09 2000 - 18:34:32 MEST


> 
> A month or two ago, there was some discussion of giving TVector3 and
> TLorentzVector virtual destructors.  This doesn't appear to have been done
> yet in Root 2.25.3, but I hope it will be eventually.

Yes, they do. TObject has a virtual destructor, and they derive from 
TObject. Once virtual, always virtual. The HTML documentation doesn't 
note the virtual because of the lack of the keyword in the header, but 
the compiler will know.

>I wonder whether in addition it would be possible to derive them from 
TNamed
>instead of TObject.  The TFolder class makes the ability to name things
>rather more useful.

I would argue against changing these to derive from TNamed. In fact, I 
could argue against having them derive from TObject and having any 
virtual functions at all. For data classes for which you might have 
many instances, the additional 50% overhead coming from deriving from 
TObject (sizeof(TObject) = 12, sizeof(TVector3) = 36) can already be of 
concern. TNamed has a size of 28, so now you're talking about an 
overhead of 28 bytes to store 24 bytes worth of data. The situation is 
of course even worse for TVector2 for which there are only 16 bytes 
worth of data.

IMHO adding names to a few instances of what are otherwise supposed to 
be small fast objects would be better handled by a generic Namer 
wrapper class.

George Heintzelman
gah@bnl.gov



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:35 MET