Hi. I'm trying to use TMinuit and am having problems with the casting of my minimization function for SetFCN(). A snippet of my code is: void (*pf)(Int_t&, Double_t*, Double_t&, Double_t*, Int_t); pf = MinusLogLikelihood; gMinuit->SetFCN(pf); MinusLogLikelihood is a member function of the class DataSet which contains the fitting routine from which this code comes. My compiler (KAI KCC 3.3e) complains KCC -g +K0 -O0 --no_exceptions -fPIC -I/usr/products/root/v2_00_13b/include -c DataSet.cc -o DataSet.o "DataSet.cc", line 67: error: a value of type "void (DataSet::*)(Int_t &, Double_t *, Double_t &, Double_t *, Int_t)" cannot be assigned to an entity of type "void (*)(Int_t &, Double_t *, Double_t &, Double_t *, Int_t)" pf = MinusLogLikelihood; ^ If I make MinusLogLikelihood a regular function not belonging to any class, these statements compile fine, but then MinusLogLikelihood no longer has any access to the data in my DataSet object. Even if I provided public access functions, it still wouldn't know which DataSet object to use. The example in the tutorial relies upon the data to be fit being global. Can this be avoided? Does anyone have experience using TMinuit from within the context of a class structure with data belonging to objects? I also tried using SetFCN(void *) and the compiler was similarly unhappy about my casting. Thanks. Stephen
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:40 MET