But this solution does not work if I want to use the info stored in UserInfo to make a selection. For instance, the data member Averages (returned by GetAverages) is not recognized inside Draw, even if I can access it in the interactive shell:
root[56] emh->Averages
(unsigned short)256
root[57] emh->Draw(“1”,“emh->Averages==256”)
Error in TTreeFormula::Compile: Bad numerical expression : “emh.Averages”
(Long64_t)(-1)
Then, can I answer the question in the original message “Can the variables inside the GetUserInfo object be used at all inside Draw???” with a “no”
I see that we need then always the workaround of evaluating the value of the variable before the actual Draw.
Therefore I will not be able to plot:
tree->Draw(“Energy:emh->Averages”)
and then, I would say that in general one can not use literally in tree::Draw the variables stored inside UserInfo. Therefore, if you need to plot/make selections in these variables, it is best to store them as leaves of a branch, despite the fact that they may not change inside the file (but they can change between different files, so one can see that change when chaining files).