Re: [ROOT] sub-branch SetAddress/GetEvent behavior question

From: Kate Scholberg (schol@mit.edu)
Date: Sat Jul 07 2001 - 03:09:53 MEST


>
> Thanks for sending me your test macro and your file.
> I have modified your macro to make it working. see below.
> Note the following:
> If you want to read one or a few subbranches, you have two possibilities:
>  1- the most efficient
>     Get a pointer to the branch(es), eg
>       TBranch *brevnt = amstree->GetBranch("Eventno");
>     Set the branch address
>       int evnt; brevnt->SetAddress(&evnt);
>     In the loop on entries, do:
>       brevnt->GetEntry(i); //this will fill evnt
>
>  2- slightly slower (example shown below)
>     Disable all branches
>     Activate the branch(es) you want to read
>     Set the branch address
>     In the loop on entries, do:
>       amstree->GetEntry(i); //only active branches will be read
>

Thanks!

The first solution works.  The second approach, although slower, is
preferable for my application, because it allows branch selection.

However I notice something strange with the second approach: your
macro only works if I do *not* load the shared library with the class
info (amsmc.sl in the files I sent).  If I load the lib, GetEntry
reads nothing for the sub-branch.

In fact, my original macro works too if I don't load the library!  (If
I don't load the library, I get various error messages when getting
the tree, and of course then cannot use the classes in the macro,
but the direct sub-branch read seems to work anyway).

Would you expect this behavior?

Kate.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:51 MET