I would like to use my own function to specify a cut in TTree::Draw(). I read that only TFormula objects are allowed in TCut objects. But, I also read that one might have to compile this new TFormula, but I can’t figure out what the first parameter in TFormula::Compile(const char* expression = “”) is. … I don’t even know if I have to do this or not – no documentation as far as I can see.
But, all ROOT says in return is:
*ERROR 30 :
Bad numerical expression : “uwf(size)”
I looked up error #30: it’s indeed “bad numerical expression” – not very helpful!
BTW: The documentation for TFormula (root.cern.ch/root/html/TFormula.html) is very confusing. It would be nice if someone who speaks English could rewrite this, please?
Thanks for the reply, but this doesn’t work for my purpose. In my case “size” is a leaf on a branch on a tree, just like “width”. I want to use the evaluated expression in a
TTree::Draw(“width”, uwc)
where
TCut uwc = “A Function of a leaf in the tree that I am drawing”
How do people deal with this? Using TTree::Draw is 10x faster than looping over all events in the tree, so I was hoping to be able to do it the fast&easy way.