Hi,
This script is OK for me. I can run it line by lineBut I got the error message if running it in a script.
My macro is
oid testLinearFit(){
// after create the SimulateData.root, we would like to tets the fit
string OutFileName = DirName + "SimulatedData.root";
TFile *fin = new TFile(OutFileName.c_str());
if (!fin) {
cout << " Error opening input file" << endl;
return;
}
if(!gROOT->GetClass("TLinearFitter"))
gSystem->Load("LibTMinuit")
TLinearFitter *lf=new TLinearFitter(); // linear fitter
cout<<"lf address is " << lf <<endl;
if (!lf) { // This is where error happens
cout <<"Cannot creat a linear fitter"<<endl;
return;
}
//TNtuple *t1 = (TNtuple *) fin->Get("nt");
Float_t AgeOfBusiness;
Float_t BuildingCount;
Float_t LossRatio;
nt->SetBranchAddress("AgeOfBusiness",&AgeOfBusiness);
nt->SetBranchAddress("BuildingCount",&BuildingCount);
nt->SetBranchAddress("LossRatio",&LossRatio);
Float_t x[2];
for (Int_t i=0; i< (Int_t)nt->GetEntries();i++) {
nt->GetEntries(i);
x[0]=AgeOfBusiness;
x[1]=BuildingCount;
lf->AddPoint(x,LossRatio);
}
lf->Eval();
delete fin;
}
Thank for your helps.
regards,
gma