FIT.KUMAC Documentation
1. General description
The PAW macro FIT.KUMAC is an easy
interface to fit several functions to a histogram. The general syntax for
calling FIT is as follows:
with
-
HID
number of an histogram to be fitted. Optionally, a fit range may be
specified analogously to HISTO/PLOT. Note that INTEGER
values correspond to channel numbers, while REAL values correspond
to the abscissa.
-
FCT_EXPR
is a function expression, analogously to HISTO/FIT. Valid functions
presently are:
-
G for Gauss distribution
-
BW for Breit-Wigner distribution
-
Pn for polynomial of order n
-
LBG for a polynomial background model of leading
order
These functions may be summed up in arbitrary order. Functions preceded
by an ampersand '&', are marked as background functions
and drawn separately in the histogram after the fit.
-
BG_FST
activates (1) or deactivates (0) a fit of the specified background functions
before fitting the whole function.
-
PAR1 ... PARn
is the optional list of the start values for the fit parameters. A valid
expression is one of the following:
| 1 |
<value> |
an integer or real value as explicit initialization for a single parameter |
| 2 |
<value>F |
as (1), but the parameter is fixed during the fit |
| 3 |
<value>(low:up) |
as (1), but the parameter is bounded to the interval [low;up] |
| 4 |
! |
a parameter's value of the last iteration is taken as the start value
for the next iteration (default). NB : This is only the case, if the function
expression was not changed since last fit. |
| 5 |
F |
as (4), but the parameter is fixed during the fit |
| 6 |
(low:up) |
as(4), but the parameter is bounded to the interval [low;up] |
2. Background functions
As mentioned in (1), background functions may be specified by precedence
of an '&'. This is advantageous in some cases:
-
in addition to the total function, the background function is drawn in
the histogram after the fit. This can be helpful in deciding, whether the
model of the background is adequate.
-
the histogram 999999 is filled with the background function and
is available for further operations.
-
histogram 999998 contains the difference of original and background
histograms and is in the case of 'good' fit the signal. Thus, the intensity
of a signal can be derived without integrating any explicit distribution
(this is helpful in case of asymmetric signals)
3. Technical details
The package consists of two files:
FIT.KUMAC is
a KUIP-macro which contains the directives to PAW. FUNCTION_FIT_HISTOGRAM.FOR
is a FORTRAN file, in which the functions are implemented. Both
communicate via the COMIS interface, using common blocks and vectors.
The FORTRAN routine uses several vectors declared in FIT.KUMAC:
-
VECTOR PARAMETER_VEC(100)
is the vector containing the fitted parameters, visible to the user. Internally,
the vector PARAM_VEC(100) is used and passed to the routine via
the COMMON-block /PAWPAR/.
-
VECTOR PARAM_FUNCTION_VEC(20) passes
integer values as function codes. Those are defined as global macros in
PAW (CONST_BREITWIGNER etc.) as well as constants in
the FORTRAN Routine (MY_CONST_BREITWIGNER etc.)
-
VECTOR PARAM_FUNCTION_DIMENSION_VEC(20) passes
the dimension of the functions, which are defined only in FIT.KUMAC.
-
VECTOR PARAM_USE_FCT(20) passes
0 or 1 for every function.
-
For each Function. Correspondingly its value is or
is not added to the return value of FUNCTION_FIT_HISTOGRAM.FOR.
Thus, the function value of the background function can be fitted or plotted
separately.
All mentioned vectors remain in memory to be available
after the fit. That way, a function may be iteratively fitted to an histogram,
or an arbitrary combination of the fitted functions can be drawn:
PAW> FUNCTION/PLOT FUNCTION_FIT_HISTOGRAM.FOR
<low> <up>
Some examples
for the beginning