TTree::Draw GetW, GetV1, GetV2, GetV3, GetV4, GetVal

In the TTree::Draw method description, I find: “The content will be the last GetSelectedRows() % GetEstimate() values calculated.”
Shouldn’t it be something like: “The content will be the last min(GetSelectedRows(), GetEstimate()) values calculated.”?

HI Wile,

It is officially the modulo even-though you are right in most circumstances as when we go back to the start of the array we do not wipe the all values. I suppose we could probably extent the semantic by explicitly describing that it is (used as) a circular buffer and where the old points is. Could you propose a patch to the documentation?


So, what you say is that if the “number of values accepted by the selection expression” is accidentally equal to “fEstimate” then the user is not expected to retrieve any results (because in this case “GetSelectedRows() % GetEstimate()” is simply 0).

Note also that the “Example” line:

Root > TGraph *gr = new TGraph(ntuple->GetSelectedRows(),
is (in any case) only valid if “GetSelectedRows() <= GetEstimate()” (which is nowhere mentioned).

In the end, as these are some “circular buffers”, I propose that you simply explicitly say:

Root > TGraph *gr = new TGraph(TMath::Min(ntuple->GetSelectedRows(), ntuple->GetEstimate()),
(well, let’s forget cases when “GetSelectedRows() < 1”) and then also:
“The content will be the last min(GetSelectedRows(), GetEstimate()) values calculated.”

Another modification could be that you just stop filling there “buffers” as soon as “fEstimate” entries are accepted. In this case the user would get (at most) the first “fEstimate” entries that matched (this could possibly be a better idea than having a “circular buffer” of events).