Providing a user defined function from C++ code for a fit

First let me apologize for the probably simple question, however being new to ROOT I still encounter difficulties.

I have written C++ code to solve a set of differential equations and afterwards convolute the data with a Gaussian. Now there are some parameters in my differential equation which I would like to fit such that the deviation of this simulated data from my experimental results gets minimzed (e.g. chi^2 method).
It seems appropriate to me to use the TH1::Fit method. However, how can I implement my C++ code so that I can provide this function to ROOT as the function to fit?

I already tried to use the CINT, but his did not work up to now; I suspect the reason is that I am using GSL-Libraries in my C++ which are not recognized by CINT.

Any kind of help is welcome, thanks!!

Tilman

see an example in the tutorial FittingDemo.C
At the top of your code, have
extern C (your gsl function prototype)

then in an interactive ROOT session, do

root > gSystem->Load("libgsl"); //with the right path for the gsl lib root > .L myFittingDemo.C+ root > myFittingDemo()
Rene

I have included all libraries (libgsl, libgslcblas, libm) but when loading my source code (.L rateroot.cpp) root breaks down. The GSL-Headers should be OK and I have checked their path. See beginning of error below.

Tilman

Error: Unexpected EOF G__fgetstream():2 /usr/include/gsl/gsl_sys.h:63:
Advice: You may need to use +P or -p option
Error: extern"C"{__BEGIN_DECLSdoublegsl_log1p(constdoublex)
doublegsl_expm1(constdoublex)doublegsl_hypot(constdoublex,constdoubley)
doublegsl_acosh(constdoublex)doublegsl_asinh(constdoublex)
doublegsl_atanh(constdoublex)intgsl_isnan(constdoublex)intgsl_isinf(constdoublex)
intgsl_finite(constdoublex)doublegsl_nan(void)doublegsl_posinf(void)doublegsl_neginf
(void)doublegsl_fdiv(constdoublex,constdoubley)doublegsl_coerce_double
(constdoublex)floatgsl_coerce_float(constfloatx)longdoublegsl_coerce_long_double
(constlongdoublex)doublegsl_ldexp(constdoublex,constinte)doublegsl_frexp
(constdoublex,int*e)intgsl_fcmp(constdoublex1,constdoublex2,constdoubleepsilon)
__END_DECLS
[…]

Hi,

You may have to hide the gsl include and code from cint.
The easiest might be;

void myFittintDemo();
#ifndef __CINT__
#include "gsl.h"
void myFittingDemo() {
..
}
#endif

Cheers,
Philippe