Here is my code taken from documentation:
[code]//
// Example of a program to fit non-equidistant data points
// =======================================================
//
// The fitting function fcn is a simple chisquare function
// The data consists of 5 data points (arrays x,y,z) + the errors in errorsz
// More details on the various functions or parameters for these functions
// can be obtained in an interactive ROOT session with:
// Root > TMinuit minuit = new TMinuit(10);
// Root > minuit->mnhelp("") to see the list of possible keywords
// Root > minuit->mnhelp(“SET”) explains most parameters
//Author: Rene Brun
#include
#include “TApplication.h”
#include “TMinuit.h”
#include <math.h>
Float_t x[5],y[5];
//______________________________________________________________________________
Double_t func(float x,float y,Double_t par)
{
Double_t value= par[0] std::pow((1-x), par[1]);
return value;
}
//______________________________________________________________________________
void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag) {}
//______________________________________________________________________________
void Ifit()
{
// the x values
x[0]=0.00288;
x[1]=0.1392;
x[2]=0.33216;
x[3]=0.47424;
x[4]=0.59328;
// the y values
y[0]=581709;
y[1]=76269.9;
y[2]=8442.49;
y[3]=1553.02;
y[4]=285.682;
TMinuit *gMinuit = new TMinuit(5); //initialize TMinuit with a maximum of 39 params
gMinuit->SetFCN(fcn);
Double_t arglist[10];
Int_t ierflg = 0;
arglist[0] = 1;
gMinuit->mnexcm(“SET ERR”, arglist ,1,ierflg);
// Set starting values and step sizes for parameters
static Double_t vstart[2] = {100000, 6 };
static Double_t step[2] = {10 , 0.01 };
gMinuit->mnparm(0, “a1”, vstart[0], step[0], 0,0,ierflg);
gMinuit->mnparm(1, “a2”, vstart[1], step[1], 0,0,ierflg);
// Now ready for minimization step
arglist[0] = 500;
arglist[1] = 1.;
gMinuit->mnexcm(“MIGRAD”, arglist ,2,ierflg);
// Print results
Double_t amin,edm,errdef;
Int_t nvpar,nparx,icstat;
gMinuit->mnstat(amin,edm,errdef,nvpar,nparx,icstat);
//gMinuit->mnprin(3,amin);
}
void StandaloneApplication(int argc, char** argv) {
// This is the standard “main” of C++ starting
// a ROOT application
Ifit();
}
int main(int argc, char** argv) {
TApplication app(“ROOT Application”, &argc, argv);
StandaloneApplication(app.Argc(), app.Argv());
app.Run();
return 0;
}
[/code]
I am compiling and linking through the following command:
But I am receiving the following error message:
[quote]/tmp/ccpu3zpz.o: In function Ifit()': fittingexample1.C:(.text+0xe2): undefined reference to
TMinuit::TMinuit(int)'
collect2: error: ld returned 1 exit status
[/quote]
Can anyone tell me what I am doing inconsistent?
Thanks,