Re: Nested vectors and TTree::MakeProxy

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Fri, 19 Nov 2010 13:32:08 -0600


Hi Philip,

> 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.

The latter sounds like an over-sight. I will look into it.

> because I'm [deliberately] misusing the proxy class. I'll figure it
> out.

Out of curiosity, how do you misuse it?

Cheers,
Philippe.

On 11/19/10 1:18 PM, Philip Rodrigues wrote:
> 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:32:13 CET

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