Re: [ROOT] combining functions

From: Rene Brun (brun@pcbrun.cern.ch)
Date: Sun Jun 13 2004 - 07:43:44 MEST


See the documentation of classes TF1 and TFormula:
http://root.cern.ch/root/htmldoc/TF1.html
http://root.cern.ch/root/htmldoc/TFormula.html

In particular in TF1 the following paragraph:
  TF1 objects can reference other TF1 objects (thanks John Odonnell)
  of type A or B defined above.This excludes CINT interpreted functions
  and compiled functions.
  However, there is a restriction. A function cannot reference a basic
  function if the basic function is a polynomial polN.

You can find a list of expressions/codes accepted in the basic functions 
at:
http://root.cern.ch/root/htmldoc/TFormula.html#TFormula:Analyze

Rene Brun

On 
Sat, 12 Jun 2004, 
Stilianos Kesisoglou wrote:

> Hi,
> 
> 	I've encountered a problem when I was trying to combine two TF1
> functions,
> and I am not sure if this is my mistake or is not implemented on ROOT yet.
> 
> 	If I define:
> 
> 	TF1 *bf = new TF1("bf","[0]+[1]*exp([2]*x)");
> 	TF1 *sf = new TF1("sf","[0]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])");
> 
> 	and then:
> 
> 	TF1 *tf = new TF1("tf","bf+sf");
> 
> 	I get what I expect (i.e a function wich is the sum of the other
> ones).
> 	But if the one of the two is a user made function it fails, for
> example
> I want to use an asymmetric Gaussian for the signal:
> 
> 	Double_t SkewGauss(Double_t *x, Double_t *pars)
> 	{
> 		here follows the definition of the function
> 	}
> 
> 	then the following fails:
> 
> 	TF1 *bf = new TF1("bf","[0]+[1]*exp([2]*x)");
> 	TF1 *sf = new TF1("sf",SkewGauss,4);
> 
> 	and then:
> 
> 	TF1 *tf = new TF1("tf","bf+sf");
> 
> 	Is there anyway to do the above? Is there a canned SkewGauss
> function?
> (that would solve the problem). 
> 
> Stelios.
> 
> P.S 	Is there any list of the canned functions that ROOT knows? I was
> looking some
> 	examples when I saw that ROOT knows about the "xygaus" which I
> didn't knew.
> 	Is there anywhere a list of all known functions?
> 
> 
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET