Anton,
What is your question? problem ?
It is stated in the documentation of TTree::Branch (class case) that you
must
pass the address of the pointer and not the pointer itself.
The reason is that we authorize a construct like
Event *event = 0;
T->SetBranchAddress("event", &event);
When reading the corresponding branch via T->GetEntry(), an event
object will be automatically created and hooked at event.
Another use is when you have saved in successive files classes
derived from a base class Event and you want to process these files
in a TChain. In this case, the right object of the right class will
be automatically created at the address given by event.
Rene Brun
On Sat, 26 Feb 2000, Anton Fokin wrote:
> Hi!
>
> could you tell me why you are using &event when calling
>
> void SetBranchAddress(const char *bname, void *add)
>
> Event *event = new Event();
> T->SetBranchAddress("event", &event);
>
>
> it looks like you are setting address of pointer to the branch instead of
> address of branch (or address of pointer to the object from where read/write
> data?). Is it something with terminology? When I looked at this function for
> the very first time, I wanted to do
>
> Event event;
> T->SetBranchAddress("event", &event);
>
> I remember I've seen some related comments in one of the root
> tutorials/examples but I am not able to find it now. Hmmm... where is our
> nice documentation about root i/o? :)
>
> Best,
> Anton
>
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET