Hello Philippe,
2009/10/19 Philippe Canal <pcanal_at_fnal.gov>:
> 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))
>
I agree this is what you usually see in the code. I always assumed the reason for doing this is that it isn't clear how many instances exist so I thought if I do know then there is no need to call GetNdata() but then things started going wrong ;))
Thanks,
Tim
> 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
>>
>
-- http://tim.jottit.com/Received on Mon Oct 19 2009 - 18:24:57 CEST
This archive was generated by hypermail 2.2.0 : Mon Oct 19 2009 - 23:50:02 CEST