Re: put class elements in a tree

From: Suvayu Ali <fatkasuvayu_at_gmail.com>
Date: Mon, 25 Jan 2010 11:18:38 -0800


Hi,

On Monday 25 January 2010 03:34 AM, Massimiliano Chiorboli wrote:
> Hi All,
> I have a problem in storing an array of classes into a tree using tree->Branch() method.
> I declare and appropriately fill an array of Classes (created by me) of kind e.g. "Particle"
>
> Particle myPartcle[N_PART];
>
> Is it possible and, if so, what is the correct syntax for creating a branch containing the myParticle array?
> I tried with:
>
> tree->Branch("particle", myParticle, 32000, 99);
>
> but this stores into the tree only the first element of the array.
> Thanks.

Have you tried looking into TClonesArray[1]? Take a look at $ROOTSYS/tutorials/tree/tcl.C

[1]http://root.cern.ch/root/html/TClonesArray.html

-- 
Suvayu

Open source is the future. It sets us free.
Received on Mon Jan 25 2010 - 20:18:46 CET

This archive was generated by hypermail 2.2.0 : Mon Jan 25 2010 - 23:50:02 CET