next up previous index
Next: Running Minuit in Fortran-callable Up: How to Use Minuit Previous: The Function FCN.   Index

Subsections

Running Minuit in Data-driven Mode.

Minuit can be run in two different modes: Data-driven mode means that the user drives Minuit with data, either typed interactively from a terminal or from a data file in batch; and Fortran-callable mode means that Minuit is driven directly from Fortran subroutine calls, without data. To some extent, the two modes may also be mixed. This section describes the first mode, and is valid for both interactive and batch running. The differences between interactive and batch are described in a separate subsection below. In data-driven mode, the user must supply, in addition to the subroutine FCN, a main program which includes the following statements (the statements in upper case are required, those given in lower case are optional):

Example of main program when using Minuit in data driven mode

      EXTERNAL FCN
      external futil
      call mintio(ird,iwr,isav)
      CALL MINUIT(FCN,futil)

The name of FCN may be chosen freely, and is communicated to Minuit as its first argument. FUTIL is the generic name of a function or subroutine which the user may optionally call from FCN, and if he does call such a routine, he must declare it external and communicate its name to Minuit as well. If FUTIL is not used, then the second argument may be put equal to 0, and need not be declared EXTERNAL; if FUTIL is declared EXTERNAL, it must be supplied in the loading process.

CALL MINTIO (IREAD,IWRITE,ISAVE)


Action: The purpose of MINTIO is to communicate to Minuit the I/O units.

Input parameters
IREAD
Fortran unit number for reading (default 5).
IWRITE
Fortran unit number for writing (default 6).
Isave
Fortran unit number for saving (default 7).

If the default values are acceptable, then it is not necessary to call MINTIO. It is the user's responsibility that the I/O units are properly opened for the appropriate operations.

Note

In data-driven mode, that is with CALL MINUIT, you should not call MNINIT, since Minuit takes care of all initialization. To change unit numbers, call MINTIO before calling MINUIT. In order that control returns to the user program after CALL MINUIT, the last command in the corresponding Data Block should be RETURN. If the last command is EXIT or STOP, then Minuit will execute a Fortran STOP, and if the last command is END, Minuit will read a new Data Block from the current input unit.

Data to drive Minuit

In data-driven mode, either interactively or in batch, Minuit reads the following data provided by the user:

Any or all of the above data read by Minuit can reside on one or more different files, and Minuit can be instructed to switch to reading a different file with the SET INPUT command. Optionally, the title record may be preceeded by a record beginning with the characters SET TITLE, and the parameter definitions may be preceeded by a record beginning with the characters PARAMETERS. It is in fact recommended always to include these optional records when preparing a data file, since the file can then be read at any time (not just at the beginning of a Minuit run) and will always be interpreted correctly by Minuit.

Example of a typical Minuit data set

SET TITLE
Fit to time distribution of K decays, Expt NA94
PARAMETERS
1 'Real(X)'  0.  .1
2 'Imag(X)'  0.  .1
5 'Delta M'  .535   .01
10 'K Short LT'  .892
11 'K Long LT'   518.3
 
fix 5
migrad
set print 0
minos
restore
migrad
minos
fix 5
set param  5   0.535
mncontour 1 2
stop

Batch and interactive running.

In its initialization phase, Minuit attempts to determine whether or not it is running interactively, by calling the logical function INTRAC, a routine in the CERN Program Library which can be provided for all commonly used computers. For our purposes, we define ``running interactively'' as meaning that input is coming from a terminal under the control of an intelligent being, able to make decisions based on the output he receives at the terminal. It is not always easy for INTRAC to know whether this is the case, so, depending on your operating system, Minuit can be fooled in certain cases. When this happens, the user can always override the beliefs of INTRAC with the commands SET BATch and SET INTeractive. The command SHOw INTeractive informs the user of the current mode. According to whether or not it believes it is running interactively, Minuit behaves differently in the following ways:

When an interactive user requests Minuit to read further input from an external file (the SET INPut command), then further input is considered to be temporarily in batch mode, until input reverts to the primary input stream.


next up previous index
Next: Running Minuit in Fortran-callable Up: How to Use Minuit Previous: The Function FCN.   Index
Back to CERN | IT | ASD | CERN Program Library Home
MG (last mod. 1998-08-19)