Re: [ROOT] function can not be compiled

From: Wen Mei (meiwen@lnf.infn.it)
Date: Tue Jun 06 2000 - 15:27:17 MEST


Hi Deng,

----- Original Message ----- 
From: Huaizhang Deng <deng@bnl.gov>
To: <roottalk@pcroot.cern.ch>
Sent: Monday, June 05, 2000 7:55 PM
Subject: [ROOT] function can not be compiled


> I wrote the following program.
> 
> Double_t RatioFunc(Double_t *t, Double_t *par) {
>   Double_t R;
>   R=par[0]*cos(2*3.14159265*0.0002291*(1-par[1]*1.0e-6)*t[0]+par[2])+par[3];
>   return R;
> }
> 
> TF1* RatioFit(TH1F* h, Float_t t_start, Float_t t_end) {
> 
>   TF1 *RatioFit=new TF1("RatioFit", RatioFunc, 0, 700000, 4);
> 
>   RatioFit->SetParNames("A", "R", "'f#", "offset");
>   RatioFit->SetRange(t_start, t_end);
>   RatioFit->SetParameters(0.4, 120, 0, 0);
> 
>   h->Fit("RatioFit", "R");
>   return RatioFit;
> }
> 
> Then I tried to do
> 
> int i;
> TF1* fit;
> for(i=0; i<5; i++) fit=RatioFit(hist, t, 400000.);
                                           |
                                           |---> why there is one more '0' than the following ? If "overflow" is not the reason. The initialization of 'fit' could be another possibility. I am not a root expert but I had similar problem with (char *) handle on AIX machine. Hope it can help you.
    Cheers                                                Wen Mei  
> 
> After the first fit, which is o.k., it complain "Function:RatioFit cannot be
> compiled".
> However, the following program works well.
> 
> int i;
> TF* fit;
> fit=RatioFit(h, t, 40000);
> for(i=1; i<5; i++) fit=RatioFit(hist, t, 40000);
> 
> I wonder why those two programs make difference.
> 
> Huaizhang Deng
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:27 MET