[ROOT] Save tree with TClonesArray

From: Vu Anh Tuan (vuanh@lal.in2p3.fr)
Date: Tue Jan 21 2003 - 16:08:52 MET


Hi,

I've been looking for a while how to save an electron candidate which
contains in itself a list of associated (calorimeter) cells (you can
also think of all tracks associated with a jet). In the attachment you
can see the electron class EMS. I've removed all things irrelevent to my
problem. The main program is in WZTree.cpp, which mainly does the
following things:

- Create a root tree with a branch (EM) containing all electron
candidates
- look into a parent root file, extract and fill the above branch with
several electrons.
- For each electron, find all cells in the (electron) cluster and save
it
- Finally save the tree

Normally, if things work fine, I expect to have a branch EM which has
some electrons (number unknown), each electron has some cells (number
unknown either). Since these numbers are unknown, I use the TClonesArray
to store these objects.

The problem is that I succesfully track down all cells for each
electron and make an array of them, but then when I tried to store all
electrons to the approriate array the program broke with segmentation
fault. It fails at the step calling WZTree::loadMyTree in the main loop,
at the first time it's called.

I thought using vector class would be easier, but not quite.

May you check where the bug is. Frankly I have to say I don't understand
a lot of TClonesArray, so I believe the trouble is somehow there.

Thanks,

T.







This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET