Questions on TTreeFormula:
- What functions are permitted? Specifically: are there any
random-numbers? I would specifically like GaussRan(mean,sigma).
(I want to add a measurement resolution in, but am in a place
where C++ is hard but can type an expression into a TTreeFormula).
- Is it possible for me to define new functions? If so, how?
- What is the relationship between TFormula and TTreeFormula? yes,
I know the latter inherits from the former, but what is the
relationship for evaluation? This might make (4) below moot.
- Is it possible for me to define new variables? specifically,
I would like to define something like "Ptot=sqrt(Px*Px+Py*Py+Pz*Pz)"
where Px,Py,Pz are float-s in the TTree. It should be evaluated
before the TTreeFormula is evaluated (as the formula might use Ptot).
This might be implementable as a friend, but that's complicated, and
I don't really want to create a whole new TFile for a transient
thing like this; it would also require a scan of the original
TTree to fill the friend.
4a) If it is possible to define a new function, is it possible to
define one without an argument or parens? this would let me do (4)
in C++.
If neither (4) nor (4a) is possible, I may implement (4) as a text macro
that expands defined variable names before creating the TTreeFormula.
Tom Roberts
Received on Mon Mar 24 2008 - 22:26:27 CET