[ROOT] TF1 peoblem (?)

From: kmakonyi@nist.gov
Date: Thu Jul 25 2002 - 03:06:21 MEST


Dear ROOTrs,

According to the documentation the TF1 has constructor like this:

TF1 TF1(const char* name, 
        const char* formula, 
        Double_t xmin = 0, 
        Double_t xmax = 1)

I made a little program:

-----------------------------------------------------------------

Double_t Voigt(Double_t* x, Double_t* par){
  Double_t arg = 0;
  if(par[2])
    arg = (x[0] - par[1]) / par[2];
  Double_t Gaus = TMath::Exp( -0.5 * arg * arg );
  Double_t Lorentz = 1 / ( 1 + arg * arg );
  return par[0] * ( par[3] * Gaus + ( 1- par[3] ) * Lorentz );
}

main(){


  TF1* f1 = new TF1("f1", Voigt, 100, 200, 4);
  TF1* f2 = new TF1("f2", "Voigt", 100, 200, 4);
  
}

---------------------------------------------------------

Run it with CINT I get an error:
"Function:f2 cannot be compiled"

Why cannot be compiled the "f2", and why can be the "f1"?
In the header the dclaration said, that the "formula" have to be "const char*".
In the "f2" the formula is "const char*", but the in the "f1" it is not! (?)
In the tutorial the "multifit" can use the "gaus" function like this, but is 
doesn't work with my funcion.
I would have to use the "TF1" that the "formula" comes from an TString.

ROOT 3.03/03, CINT5.15.35, win2k
Thanks,
  Karoly



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:01 MET