Re: TReeFormulae and GetNdata

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Mon, 19 Oct 2009 11:16:28 -0500


Hi Tim,

Yes the call to GetNdata is required as it sets up the tracking of the variable dimensions.
And actually the _expected_ use pattern is something like:

    nvalues = form.GetNdata()
    for n in xrange(nvalues):

        print "%i %i %.2f %.2f %.2f"%(n_events, n, evt.jetfoo[n], evt.jetfoo[n]/evt.njet, form.EvalInstance(n))

Cheers,
Philippe.

Tim Head wrote:
> Hello,
>
> I am curious why uncommenting line 33 in the attached script makes the
> tree formula work as expected.
>
> Notice that in event 2 njet is three and that jetfoo[2]/njet should
> come out as 2.17 but the formula calculates 0.
>
> From the brief documentation on GetNdata() I expected that all it does
> is tell me how many instances are available. It seems to have some
> other side effect though.
>
> What is the right way to get a formula to play nice? It seems like a
> hack to call GetNdata() just to get it to work.
>
> I have root 5.20 on linux.
>
> Tim
>
Received on Mon Oct 19 2009 - 18:16:51 CEST

This archive was generated by hypermail 2.2.0 : Mon Oct 19 2009 - 23:50:02 CEST