[ROOT] fitting with a member function

From: Dr. John Krane (jkrane@netzero.com)
Date: Tue Jul 22 2003 - 16:05:32 MEST


Hi,

I'm trying to use weighted histograms to fit a distribution.  Because I 
want to be able to change the histos that I'm using as components, I 
made a little class that holds an array of TH1F.  A member function 
provides the weighted sum of these histograms, with the weights being 
the fit parameters and the interface being as required by TF1.  So I 
tried to make a TF1 for use with the ->Fit method, like this:

   cerr<< "Assign the histos that contribute to fit"<<endl;
   func_fit fclass;
   fclass.add_param(d1or);   //first histo
   fclass.add_param(d1crl);  //second histo...etc.

   TF1 *fitFcn = new
      TF1("fitFcn",fclass.func_val,-600.,-1.,fclass.get_nparam());

Well the compiler within ROOT doesn't like that, so I tried making a 
pointer-to-member-function and giving that to root, but I didn't get 
anywhere.  Does anybody know how to provide a member-function to TF1?  I 
think my class solution is quite clean for what I'd like to do, but I 
need to get around this barrier...

	- John



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET