Re: Problem with TClonesArray and TTree after removing an element

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Fri, 27 Jun 2008 08:12:17 +0200


Sebastian,

Yes, when writing a TClonesArray in split mode in a Tree, the system expects no holes, in particular when the branch addresses have already been computed without holes , as in your case.

Rene Brun

Sebastian Uhl wrote:
> Dear ROOT users,
>
> I have a problem when using TClonesArray in combination with TTrees.
>
> I start by creating the tree and array, and create a branch holding the
> array. I then start filling the array and the tree and everything works
> fine until I remove an element (not the last one!) from the array.
> If I try to fill the tree afterwards the program/script fails with a
> segmentation violation.
> If I call the Compress method after the removal and then try to fill the
> tree, it works without problems.
>
> Writing the array to a TFile does btw. not cause any trouble.
>
> I am using ROOT v5.18/00 on an i368 Linux PC. I execute the attached
> script with
> root -q -l TClonesArrayError.C+
>
> I guess this would be the relevant part of the backtrace:
> #0 0xb6ce3d07 in TStreamerInfo::WriteBufferAux<char**> ()
> from .../root_v5.18.00.gcc412/lib/libRIO.so.5.18
> #1 0xb6cde750 in TStreamerInfo::WriteBufferClones ()
> from .../root_v5.18.00.gcc412/lib/libRIO.so.5.18
> #2 0xb6a03bb1 in TBranchElement::FillLeaves ()
> from .../root_v5.18.00.gcc412/lib/libTree.so.5.18
> #3 0xb69f9ef2 in TBranch::Fill ()
> from .../root_v5.18.00.gcc412/lib/libTree.so.5.18
> #4 0xb6a02d22 in TBranchElement::Fill ()
> from .../root_v5.18.00.gcc412/lib/libTree.so.5.18
> #5 0xb6a02bfc in TBranchElement::Fill ()
> from .../root_v5.18.00.gcc412/lib/libTree.so.5.18
> #6 0xb6a3b382 in TTree::Fill ()
> from .../root_v5.18.00.gcc412/lib/libTree.so.5.18
>
> Is this a general problem or am I doing anything wrong? Would calling the
> Compress method be a sufficient solution or do I have to expect
> side-effects?
>
> Thanks for your help, kind regards,
> Sebastian
Received on Fri Jun 27 2008 - 08:12:41 CEST

This archive was generated by hypermail 2.2.0 : Fri Jun 27 2008 - 23:50:01 CEST