fitting

From: Frank Maas (maas@kph.uni-mainz.de)
Date: Tue Jan 26 1999 - 21:39:37 MET


Hi rooters,
I'm new to root (previously working with PAW)
and find the root package really great to work with,
I got very fast first results. 
I have to ask for help,
because I could not find the solution to my problem
in the tutorials, the root how to's or the class and member
definitions...

I'm using root version 2.20/06 from 12 January 1999
under Linux (SUSE 6.0)
and I want to fit a histogram with a sum of a 
gaussian and an exponential.
I have two questions and one problem.
Here the Questions:
1) I found the predefined functions  "gaus" and "expo". Is there 
a possibility to get the "gaus+expo"?
(In paw this was "e+g").
2) Is there a fit option which actually does not 
fit anything but takes the parameter's starting
values,  computes the fcn and plots the result?
This would be helpfull whan trying to find 
good starting values for the parameters.

Now the Problem:
When fitting the histogram with 
>  TF1 *f1 = new
>TF1("f1","[0]*exp(-0.5*((x-[1])/[2])*((x-[1])/[2]))+[3]*exp(x/[4])",70.,160.);
>  f1->SetParName(0,"gau amplitude");
>  f1->SetParName(1,"gau mean");
>  f1->SetParName(2,"gau sigma");
>  f1->SetParName(3,"exp ampl");
>  f1->SetParName(4,"exp tau");
>  f1->SetParameter(0,3960.);  //initialize first parameter to 1.1
>  f1->SetParameter(1,135.);
>  f1->SetParameter(2,10.);
>  f1->SetParameter(3,330000.1);
>  f1->SetParameter(4,-20.);
>  f1->SetParLimits(0,3999.,4001.);
>  f1->SetParLimits(1,134.,136.);
>  f1->SetParLimits(2,14.,16.);
>  f1->SetParLimits(3,330000.0,330000.2);
>  f1->SetParLimits(4,-19.,-21.);
>  medusa_histo[2][2][0]->Fit("f1","RB");

I always get (independent whether I use option B or not) 
a segmentation violation:
> FCN=33185.7 FROM MIGRAD    STATUS=CONVERGED     125 CALLS         126
>TOTAL
>                     EDM=4.4665e-05    STRATEGY= 1  ERROR MATRIX
>UNCERTAINTY   0.0 per cent
>  EXT PARAMETER                                   STEP         FIRST   
>  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE 
>   1  gau amplitude   3.99900e+03   4.43637e-02   1.30790e-03
>1.75475e-02
>   2  gau mean     1.34000e+02   3.46184e-04  -4.04984e-03** at limit **
>   3  gau sigma    1.40000e+01   1.03863e-04   1.09873e-04** at limit **
>   4  exp ampl     3.30000e+05   1.59870e-01  -4.82326e-03   3.26473e-03
>   5  exp tau     -1.90000e+01     fixed    
>
> *** Break *** segmentation violation
>
Is there something obviously wrong? Is the function (or fcn)
computed in a wider range than specified in TF1,
that could explain the behavior.
 
best regards
and many thanks
Frank

+----------------------------------------------+
| Dr. Frank Maas                               |
| Institut fuer Kernphysik                     |
| A4 - collaboration                           |
| Parity Violation Experiment                  |
| Johannes-Gutenberg-Universitaet Mainz        |
| J.J.Becherweg 45                             |
| 55099 Mainz                                  |
| Germany                                      |
|-  -  -  -  -  -  -  -  -  -  -  -  -   -  -  |
| Email: maas@kph.uni-mainz.de                 |
| Phone: +49-6131-39-5807                      |
| FAX:   +49-6131-39-2964                      |
+----------------------------------------------+



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:28 MET