how to create a fit inside my own class?

From: Stephen Pate <pate_at_nmsu.edu>
Date: Mon, 16 May 2011 21:09:14 +0200


Dear Rooters

        I want to create a class, with the following characteristics:

(1) reads in private data at the time the class object is instantiated
(2) has a member function that will calculate a chi-squared comparing that data to a model
(3) has another member function that will perform a fit using the member chi-squared function, calling on minuit/migrad to do so

I would like to use the interpreter, not compiled code, at least in the beginning while I am developing my process.

(1) and (2) are standard things to do, but in trying to do (3) I run into the problem that the address of the member chi-squared function cannot be passed to the "SetFCN" or "SetFunction" call because it "is not defined in current scope". I can call from one member function to another, no problem, but I can't pass the address of the member chi-squared function to the fitter interface.

        All of the code works as long as I don't try to wrap it all into a class; it is only when placed inside a class that the call to "SetFCN" or "SetFunction" does not work.

        There are many fitting interfaces in ROOT. I have tried to do this using TVirtualFitter; I also tried a combination of ROOT::Math::Minimizer, ROOT::Math::Factory, and ROOT::Math::Functor; both methods were successful until placed inside a class. It occurs to me that I have simply not tried the right interface yet, or that I need to do something additional to be able to get the address of the member function. I hope someone can help me to do this.

        I am using ROOT 5.28/00c on a MacBook Pro 10.6.7, i.e. everything is up-to-date.

	thanks,
		Steve Pate
Received on Mon May 16 2011 - 21:09:25 CEST

This archive was generated by hypermail 2.2.0 : Tue May 17 2011 - 11:50:01 CEST