Hi Topher,
The issue is that TTree::Branch expect the address of a pointer to an
object.
In your example:
TClonesArray ccaa("CCABit", 24*24); // maximum capacity is 24*24
....
tree->Branch("CCABitArray", &ccaa); // !!GIVES ME A SEGMENTATION
VIOLATION!!
You are passing the address of an object.
One way to correct the problem is:
TClonesArray *ccaa = new TClonesArray("CCABit", 24*24); // maximum
capacity is 24*24
....
tree->Branch("CCABitArray", &ccaa); // !!GIVES ME A SEGMENTATION
VIOLATION!!
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Topher Cawlfield
Sent: Wednesday, April 09, 2003 10:19 AM
To: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] seg. violation in TTree::Branch
Oh, no! Here it is.
I'll also post it on the web in case that helps...
http://www.lns.cornell.edu/~topher/simpleTree.tar.gz
Thanks for your help with the HTML documentation. I'll look into the
pointer initialization issue, but I don't think that's the problem. My
class that I'm storing in the list has no pointers, and I haven't even
created any instances by the time TTree::Branch is called. Maybe that's
the problem, but I don't see how.
- Topher
Rene Brun wrote:
> Hi Topher,
>
> You forgot to attach your tar file.
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET