Re: [ROOT] Broken Link on TMinuit.html

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sun Jul 28 2002 - 22:34:02 MEST


Hi,

The function called by Minuit must be a static function. It cannot be
a class member function. From the static function, you can call
a class member function using a global object pointer.

Rene Brun


On Sat, 27 Jul 2002 kmakonyi@nist.gov wrote:

> Dear All,
> 
> Is there any trick to take a "user defined function" to a member of a class?
> I've tried the follow and it didn't work.
> The error message:
> "Symbol A is not defined in current scope".
> 
> 
> class probe{
>  public:
>   probe::probe();
>   probe::~probe();
>   Double_t Voigt(Double_t* x, Double_t* par);
> };
> 
> Double_t probe::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(){
>   probe A;
>   TF1* f1 = new TF1("f1", A.Voigt, 100, 200, 4); 
> }
> 



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