Functional Form of a Histograme

Dear ROOT Users

I am trying to get the functional form of a Germanium pulse from TH1::GetFuntion() method
in ROOT but some how it is not working and giving the error

TFile *f = new TFile(filename);
  TH1 *hI = (TH1*)f->Get("gated_Tr_1_1");
   TF1 *f1 = (TF1*)hI->GetFunction("func");
  cout<<f1<<endl;
  f1->Draw();  // this line giving error

It says
0
Error: illegal pointer to class object f1 0x0 2344  current.C:33:

can anyone please help me what should be done ???

Where do you expect this “func” to be coming from? How did it get associated to your histogram?
Maybe search for all occurrences of “associated function” in http://root.cern.ch/root/html/TH1.html

Thanks

The problem has been resolved.

Actually I just came to know that TH1::GetFunction() can be called after applying fitting.

Now I have used TSpline3 class for interpolation of the values and it is working well.

Thanks for your time.