Problem with TClonesArray and TTree after removing an element

From: Sebastian Uhl <suhl_at_e18.physik.tu-muenchen.de>
Date: Thu, 26 Jun 2008 21:40:56 +0200


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 Thu Jun 26 2008 - 21:41:01 CEST

This archive was generated by hypermail 2.2.0 : Fri Jun 27 2008 - 11:50:02 CEST