[ROOT] About fit with my function

From: babintsev@mx.ihep.su
Date: Tue Feb 20 2001 - 14:00:52 MET


      babintsev@mx.ihep.su, 20-FEB-2001

 Hello rooters.

Some times ago I asked about strange behaviour of the ROOT
for the script from tutorials: (Alpha server 8200 (4 cpu), OSF1)
(Root  Version   2.25/03)

root [0] .L fitexample.C
root [1] fitexample()

 *** Break *** floating point exception
Root > Function fitf() busy flag cleared
Function fitexample() busy flag cleared

AT the same time  the script works at Linux.
Using iteration I found the place where the system is stopped
(commented in the script below).

 Please, your comments.

/_____________________macro fitexample.C___________________________
Double_t fitf(Double_t *x, Double_t *par)
{
  Double_t arg = 0;
  //.....!!! this operator does not work at OSF1, but works at Linux !!!!
  //  if (par[2]) arg = (x[0] - par[1])/par[2];
  Float_t pp= par[2]; if (pp) 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--------------

                                   Volodja Babintsev



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET