Re: Nested vectors and TTree::MakeProxy

From: Philip Rodrigues <p.rodrigues1_at_physics.ox.ac.uk>
Date: Fri, 19 Nov 2010 14:18:49 -0500


Hi Philippe,
Ah, looking again at what I'm doing, my proxy was generated in a root session without the library containing A and B loaded, which meant that the necessary operator[] was not defined. With the relevant library loaded, I get the necessary functions. (I'm now having trouble with dictionaries, but that's probably because I'm [deliberately] misusing the proxy class. I'll figure it out.)

Thanks,
Philip

On Friday, November 19, 2010 12:58:02 pm Philippe Canal wrote:
> Hi Philip,
>
> A priori:
>
> name_of_branch.b[1].d[2];
>
> should give you the result you are looking for. How is that
> failing for you?
>
> Cheers,
> Philippe.
>
> On 11/17/10 9:21 AM, Philip Rodrigues wrote:
> > Hi roottalk,
> > I have a tree containing a class A which looks like this:
> >
> > class A : public TObject
> > {
> >
> > vector<B> b;
> > [...]
> >
> > }
> >
> > where B has a member which is a vector<double>:
> >
> > class B : public TObject
> > {
> >
> > int i;
> > vector<double> d;
> > [...]
> >
> > }
> >
> > I am trying to access A via TTree::MakeProxy. My question is, how do I
> > access a particular element of the vector d? That is, what is the proxy
> > equivalent of:
> >
> > A a;
> > a.b[1].d[2];
> >
> > I see that the equivalent of a.b[1].i is proxy.b.i[1], but how do I get
> > what I want for the member d?
> >
> > Thanks,
> > Philip
Received on Fri Nov 19 2010 - 20:18:56 CET

This archive was generated by hypermail 2.2.0 : Fri Nov 19 2010 - 23:50:02 CET