Illegal pointer to class object (using GetParameter)

Hi,

I am trying to obtain, using a macro, the values of a fitted first order polynomial function, to use in further calculations.

I am encountering ‘Error: illegal pointer to class object…’

Below is posted the full error:

Error: illegal pointer to class object fitllq 0x0 1217 macro.C:27:
*** Interpreter error recovered ***

The code in my macro is as follows:

{
gROOT->ProcessLine(".L triangauss.C");
TFile *f = new TFile (“Histo.root”);
f->ls();
h_iM->Add(h_iMOsSf,h_iMOsOf,1,-1);

std::cout << endl << endl << “Fit to dilepton edge:” << endl << endl;

TF1* fitll = new TF1(“triangauss”,triangauss,0,85,4);
fitll->SetParameters(1,2,3,4);
fitll->SetLineWidth(2);
h_iM->Fit(“triangauss”,“N”);

h_iM->GetXaxis()->SetTitle(“Invariant mass”);
h_iM->GetYaxis()->SetTitle(“Events”);
h_iM->SetMarkerStyle(1);
h_iM->SetMarkerSize(0.1);
h_iM->SetLineWidth(1);

std:cout << endl << endl;

std::cout << endl << endl << “Fit to dilepton + jet edge:” << endl << endl;

h_iMOsSfllq->Fit(“pol1”,“N”,"",360,420);
TF1 *fitllq = h_iMOsSfllq->GetFunction(“pol1”);
// NEEDS FIXING///////////////////////////
Double_t llq0 = fitllq->GetParameter(p0);
Double_t llq1 = fitllq->GetParameter(p1);
/////////////////////////////////////////////////
cout << llq0 << " " << llq1 << endl;
}

I am convinced the error is in my implementation of the GetParameter part, but it just as well may be the GetFunction part.

Any help/possible solutions to this problem will be muchly appreciated.

Thanks, Tom

When using option “N” you tell the system to not store the function !

Rene