Hello, How can I use the TMinuit class with the FCN function being a member-function of a class? I've got a class CGeometry { .... public: void CalcChiSq(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t); TMinuit Minuit; Fit(void); // calling the Minuit routines ... } The member function CalcChiSq uses data in the class to calculate the chi-squared for the present set of parameters. I set the FCN with the statement: Minuit.SetFCN(CalcChiSq); When I try to compile I get the following error messages: CC: "geofix.cpp", line 1089: error: address of bound function (try using `CGeometry::*' for pointer type and `&CGeometry::CalcChiSq' for address) (133) CC: "geofix.cpp", line 1089: error: bad argument 1 type for TMinuit::SetFCN(): void (CGeometry::*)(Int_t&, Double_t*, Double_t&, Double_t*, Int_t) ( void (*)(Int_t&, Double_t*, Double_t&, Double_t*, Int_t) expected) (1264) When I change the SetFCN statement to: Minuit.SetFCN(&CGeometry::CalcChiSq); Then the compiler gives only the second error message: CC: "geofix.cpp", line 1089: error: bad argument 1 type for TMinuit::SetFCN(): void (CGeometry::*)(Int_t&, Double_t*, Double_t&, Double_t*, Int_t) ( void (*)(Int_t&, Double_t*, Double_t&, Double_t*, Int_t) expected) (1264) How can I work around this problem? Thanks. Martin.
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:18 MET