Re: class inherited from TClonesArray

From: Jan Hartmann <hartmann_at_hiskp.uni-bonn.de>
Date: Tue, 26 Jan 2010 19:14:45 +0100


Hi,

thanks for the quick replies.
I need a container class for particles, which for example provides functions to do do some combinatorics to reconstruct mother particles. I just thought inheriting from TClonesArray would be an easy way do do this, but I guess I will have to do it some other way, either by forwarding some TClonesArray member functions as Philippe suggested or by putting the additional functions I need into a completely different class.

Cheers,
Jan

Am Dienstag, 26. Januar 2010 schrieb Philippe Canal:
> Hi Jan,
>
> Inheriting from TClonesArray is not supported. Instead you will need to
> embedded a TClonesArray
> into your class (as a data member) and 'forward' part or all the
> TClonesArray to your class (via
> inline member function for example).
>
> Cheers,
> Philippe.
>
> PS. Out of curiosity what is the 'additional member function' you are
> interested in adding?
>
> On 1/26/10 11:38 AM, Jan Hartmann wrote:
> > Hi,
> >
> > I am trying to write a class which is basically a TClonesArray with some
> > additional public member functions. Unfortunately, if I create a branch
> > containing an object of this class, it is not split. If I use
> > TClonesArray instead, a subbranch for each member is created. Is there
> > any way to get that behavior with my own class (inherited from
> > TClonesArray)?
> > I have attached a minimal version of my class and a macro
> > (my_clonesarray.C) that shows the different behavior.
> >
> > Thanks in advance for any help,
> > Jan
Received on Tue Jan 26 2010 - 19:14:59 CET

This archive was generated by hypermail 2.2.0 : Thu Jan 28 2010 - 11:50:02 CET