Re: [ROOT] Get parameters from pol1 fit to ProfileX

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Mar 26 2002 - 15:22:48 MET


Karl,

It looks like you have a forward declaration of TF1.
You should have
#include "TF1.h"

Rene Brun

K. Hauschild wrote:
> 
> Hi,
> 
> I am having trouble getting the parameters of a "pol1"
> fit to a profile when compiling.
> 
> Version   3.03/02, under solaris 5.9, solarisCC5
> 
> void FitAsym() {
>   :
>   //read in data
>   TFile *f1 = new TFile("ScanB/PsaSum.root");
>   sprintf(name, "%d/Asym_Thi_S%d_%d",egamma[gamma],i,rad);
>   TH2S *hasym = (TH2S*) f1->Get(name);
> 
>   //check data, make some constraints....fill new histo
>   TH2S *asym = new TH2S(name,name,nbinsx,minx,maxx,nbinsy,miny,maxy);
>   :
>   :
>   TProfile *profx = new TProfile("profx","profx",nbinsx,minx,maxx);
> 
>   //Determine x-profile and fit <thi> = a + b.x for modified data
>   profx = (TProfile *) asym->ProfileX();
> 
>   //Fit linear poly to profile
>   profx->Fit("pol1","IM","",min,max);
> 
>   //get the fit......PROBLEMS here....
>   TF1 *myfit = (TF1*) profx->GetFunction("pol1");
>   Double_t p0 = myfit->GetParameter(0);            <=== compiler complains
>   Double_t p1 = myfit->GetParameter(1);            <=== compiler complains
> 
>   //use these parameters to start real fit.....
>   :
>   :
> }
> 
> 
> The errors are :
> "FitAsym.cxx", line 202: Error: The type "TF1" is incomplete.
> "FitAsym.cxx", line 203: Error: The type "TF1" is incomplete.
> 
> Cheers,
> 
> Karl
> 
> ==========================================================================
> 
> CEA Saclay, DAPNIA/SPhN                Phone  : (33) 01 69 08 7553
> Bat 703 - l'Orme des Merisiers         Fax    : (33) 01 69 08 7584
> F-91191 Gif-sur-Yvette                 E-mail :  khauschild@cea.fr
> France                                           karl_hauschild@yahoo.co.uk
>                                        WWW: http://www-dapnia.cea.fr/Sphn



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:47 MET