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!!


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()

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.


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)


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() {