Re: Tree use sample code?

Rene Brun (Rene.Brun@cern.ch)
Mon, 24 Feb 1997 10:04:40 +0100


Reid D Rivenburgh wrote:
>
> Hi,
>
> Does anyone have any sample code that demonstrates adding a
> user-defined class to a tree and writing and reading the results
> to/from a file? I know there's an Event class sample (MainEvent.C) in
> the distribution, but I'm doing something fundamentally wrong and I
> can't see where my class is wrong while Event is right. (When I try
> to add an instance of my class, which inherits from TObject, to the
> tree using TTree's Branch() member function, I get a segmentation
> violation, and it's pretty frustrating!) The sample code could be
> very, very simple to be helpful; just something to build on. A
> skeleton, really.

Where do you get segmentation violation? (in TTree::Fill ?)
Can you process more than one event?
Can you run in no-split mode? (one single container, no branches?)

Be careful with your destructors. That's where we expect most problems
in using Trees.

I can have a look at your problem if I can get access to your
headers and implementation files.

Rene Brun