Yeah, that’s exactly the example in the PR labeled as tfv1. It’s not the formula which should have a fixed index, but the underlying branch itself being used as part of the TTreeFormula. Whenever the branch has a not-known in advance size, one needs to call GetNdata first, independently on the “multiplicity” of the formula (Ndata=1 in your case, or N if you use trk[]
).
Since the future direction is to use RDataFrame rather than TTreeFormula, plus fixing this would require a big rework, and there is a clear workaround that is gonna be documented if the PR gets merged, I’d say this qualifies as a “won’t fix bug/feature”.
1 Like
You have to call GetNdata() first, even though the formula will always have an Ndata == 1. Does this qualify as a bug?
This is not a bug. If the TTreeFormula
contains anything variable size, you must check GetNData()
as there might 0, 1 or more answer. Even when you fix the index, the collection might be too small to fulfill it. TTreeFormula::GetMultiplicity
tells you (indirectly) whether you need to call GetNData
or not for a given formula.
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.