hi - you may want to check if `hsimple.root' exists in the current directory.
`fitexample' assumes that it exists and tries to open it ...
best, Pasha
babintsev@mx.ihep.su wrote:
>
> babintsev@mx.ihep.su, 17-FEB-2001
>
> Hello rooters.
>
> What does it mean: I take script from tutorials (below):
> and have the following result (Root Version 2.25/03)
>
> root [1] .x fitexample.C
>
> *** Break *** floating point exception
> Root > Function fitf() busy flag cleared
> Function fitexample() busy flag cleared
>
> //_____________________macro fitexample.C___________________________
> Double_t fitf(Double_t *x, Double_t *par)
> {
> Double_t arg = 0;
> if (par[2]) arg = (x[0] - par[1])/par[2];
>
> Double_t fitval = par[0]*TMath::Exp(-0.5*arg*arg);
> return fitval;
> }
> void fitexample()
> {
> TFile *f = new TFile("hsimple.root");
>
> TH1F *hpx = (TH1F*)f->Get("hpx");
>
> TF1 *func = new TF1("fit",fitf,-3,3,3);
> func->SetParameters(500,hpx->GetMean(),hpx->GetRMS());
> func->SetParNames("Constant","Mean_value","Sigma");
> hpx->Fit("fit");
> }
> -------end of script---------------------
>
> Thanks a lot.
>
> Volodja Babintsev
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:36 MET