Re: Nested vectors and TTree::MakeProxy

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Fri, 19 Nov 2010 14:03:58 -0600


Hi Philip,

> I wanted to have the looping over events done in my code, rather than by the
> framework, so I use the proxy class (say, Proxy) directly in my own loop,
....
> It has the disadvantage that I have to deal with initializing the proxy
> myself

A proxy is a TSelector and follows the same rules, you can see the 'proper' setup and looping at:

    See <http://root.cern.ch/root/html/src/TTreePlayer.cxx.html#U39qBD>

> I wanted to have the looping over events done in my code, rather than by the
> framework, so I use the proxy class (say, Proxy) directly in my own loop,

What is the advantage in your case? One disadvantage is that you then preclude the use of your selector/proxy in PROOF.

Cheers,
Philippe.

On 11/19/10 1:54 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.
>> The latter sounds like an over-sight. I will look into it.
>
> Well, it's defined, but it returns TObject& instead of B&, which is
> understandable I guess.
>
>>> because I'm [deliberately] misusing the proxy class. I'll figure it
>>> out.
>> Out of curiosity, how do you misuse it?
> I wanted to have the looping over events done in my code, rather than by the
> framework, so I use the proxy class (say, Proxy) directly in my own loop,
> like:
>
> TChain ch("chainName");
> ch.Add(some files);
> Proxy* p=new Proxy(t);
> p->Init(&ch);
> for(int i=0; i<ch.GetEntries(); ++i){
> p->Process(i);
> [ Access members of p ]
> }
>
> It has the disadvantage that I have to deal with initializing the proxy
> myself, and there are some more complications with setting the correct tree
> from the TChain (so the code as I wrote it above doesn't actually work for
> chains with more than one file).
>
> I understand if you don't want to support this method of using the proxy class
> (although I'll say I find it quite convenient), but if you are interested, I'll
> try to collect my notes and provide some useful feedback.
>
> Regards,
> Philip
Received on Fri Nov 19 2010 - 21:04:03 CET

This archive was generated by hypermail 2.2.0 : Mon Nov 22 2010 - 11:50:01 CET