[ROOT] Re: [ROOTDEV] how to run TMINUIT from a stand alone c++ class?

From: Christian Hansen (christian.hansen@cern.ch)
Date: Sun Jul 11 2004 - 21:58:22 MEST

On Fri, 9 Jul 2004, Rene Brun wrote:

Hi Rene,

I've found an email from you on the ROOT TALK DIGEST's 
search engine suggesting a solution to my 'fcn' problem;

Here you suggest to declare 'fcn', externt and give an object 
of that class, where 'fcn' is a member, to TMinuit. 
This is how I understood it and this is how I have done it in 
my latest version of my MinuitTest;

I've made a new class FcnClass(.C/.h) with only one public
member function, 'fcn', and in the header file of MinuitTest
I've made the externed declaration of this function;

extern void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);

And in the source code of MinuitTest the line 
now does work!!! But then when I try to set an object
of the FcnClass to minuit
	FcnClass* anObjectOfFcnClass;           
the compiler complains:
	MinuitTest.C:20: no matching function for call to 
	/home/hansen/ROOT/include/TVirtualFitter.h:87: candidates are: 
	virtual void TVirtualFitter::SetObjectFit(TObject*)

Could you tell me how I've missunderstood this email 
of yours and how I should change in my test code
(attached) so that it goes through compilation?


> Hi Christian,
> see example in  $ROOTSYS/test/minexam.cxx
> Rene Brun
> On Fri, 9 Jul 2004, Christian 
> Hansen wrote:
> > 
> > Dear Rooters,
> > 
> > I'm trying to call TMinuit from a c++ class in a similar way
> > that I've used TMinuit in a program called directly from 
> > ROOT, but now I do not  know how to define the 'fcn' 
> > function in order for TMinuit to recognice it with the 
> > 	SetFCN(fcn)
> > I've tried many different ways (attached is a small example)
> > but my code does not want to compile. Could anyone help me how 
> > to change this so that the attached code goes through the compilation?
> > 
> > Thanks!!!
> > 

/ Christian Hansen
Box 535            Office: +46-(0)18-471 32 57
S-751 21 Uppsala   Office: 82104
Mobile    : +46-(0)708-887617
Home Page : http://welcome.to/Christian_Hansen

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