I can get a Gaussian random number using
TMath::ErfInverse(rand()/0x3fffffff-1) Three problems:
Still, this is good enough for my immediate needs (dividing by 0.707 to get sigma right).
Tom Roberts
Tom Roberts wrote:
> Questions on TTreeFormula:
>
> 1) 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).
>
> 2) Is it possible for me to define new functions? If so, how?
>
> 3) 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.
>
> 4) 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 - 23:41:42 CET
This archive was generated by hypermail 2.2.0 : Tue Mar 25 2008 - 11:50:01 CET