Hello, Rooters,
I am trying to use the user defined fit-function option to fit a TH1F in
stand-alone compiled code. We are running on Linux, using ROOT version
2.25/03.
I use several ROOT classes in this code, and include the following ROOT
headers:
#include "TRandom.h"
#include "TF1.h"
#include "TH1.h"
#include "TMath.h"
I declare the TF1 pointer:
TF1 * scurvef = new TF1("scurve", fitf, -200, 200, 3);
fitf is declared and defined as follows:
Double_t fitf(Double_t*, Double_t*);
Double_t fitf(Double_t *x, Double_t *par){
double arg = 0;
if (par[2]) arg = (x[0]-par[1])/(1.414*par[2]);
double fitval = par[0]*0.5*TMath::Erfc(arg);
return fitval;
}
I have also tried making the Double_ts into doubles.
The program crashes at the instantiation of TF1 * scurvef, with a
segmentation fault.
Is there something else I need to do to use this method in compiled
code? (It runs as a ROOT macro.) An additional include file needed?
Any help would be appreciated.
Thanks!
--
Christian J.P. Flacco ~ CJFlacco@LBL.gov ~ 510.486.5451
http://www-physics.lbl.gov/~cflacco
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:47 MET