TTree::Draw, weight with a function?

Hi all,

I want to make histograms with TTree::Draw and weight the entries by a function of a variable in the tree. Something like the following example.

mytree->Draw(“zenith_angle>>hZenith”, “my_function(energy)”)

I currently have the “my_function” simply as a TGraph, but I could try to make a TF1 or some other thing. Mostly, I wanted to know if this is even possible, or have I finally reached the limit of the powers of TTree::Draw()! Which, by the way has been pretty awesome so far.

If you have any hints that I’m just missing the docs or with a clever trick let me know. If I come up with something I’ll update.

Thanks,

Elliott

You can do it with a myfunction (C style) already in memory)

mytree->Draw("zenith_angle>>hZenith", "my_function(energy)") or

mytree->Draw("zenith_angle>>hZenith", "my_function.C(energy)")
Rene

Thanks. I didn’t know that.

Elliott