Re: TTrees in TMapfiles

Rene Brun (Rene.Brun@cern.ch)
Wed, 24 Jun 1998 17:30:58 +0200


Norbert Danneberg wrote:
>
> Hi Experts,
>
> is it possible to store TTree objects in TMapFiles? I looked at the
> example hprod.C and tried to implement a similar program for TTrees.
> When I start the program mfile->Update () results in a segmentation
> violation.
>

Hi Norbert,
You should be able to use TTrees with shared memory (TMapFile).
However, your TTree cannot be associated to a file. It must be
completely in memory. To create a TTree in memory, you can do:
solution 1
==========
gROOT->cd();
TTree *T = new TTree(......

solution 2
==========
TTree *T = new TTree(...
T->SetDirectory(0);

When you will invoke mfile->Update, a copy of the existing TTree
with all its branches/leaves/buffers/etc will be serialized
into the shared memory area.

For further info, see the class TMapFile.
For additional help, see directly with Fons.Rademakers@cern.ch

Rene Brun