
                  Mn_Fit Code and Installation Instructions
                  _________________________________________


   The following is kept mainly for historical interest and applies to Mn_Fit
versions up to 4/07.35. Information and installation instructions for version
v5_00 onwards can be found in the top-level Mn_Fit directory in the file
INSTALL.

   Below I describe how and where the Mn_Fit code is stored and how to set
up Mn_Fit for your instititute. You should also have enough information so
that you can compile and link any version of Mn_Fit and make changes and test
them out if you wish. I assume that you have CMZ installed at your institute
and I recommend that you have version 1.44/20 or later.

   With the release of Mn_Fit version 4.01 I provide an installation
script for all machines, which means that I can shorten the
documentation considerably. You should be able to copy the
installation script to the top-level Mn_Fit directory and run it.

   Please  let  me  know of  any   corrections,    improvements etc.  to the
installation system.

   On both VMS and Unix machines the fortran code is split into many
files. I therefore think that it is not practicable to distribute the
fortran code anymore. Instead I will make the libraries available and
then you can link with them.

   Below I describe in a bit more detail how and where the Mn_Fit
code is stored and what flags are used.

   All the code, files etc. needed to run Mn_Fit are stored in 4 CMZ
files. You make the kumac's and other files you need to link and run
Mn_Fit from the CMZ file mn_util.cmz. There are 3 types of flags that
control the making of the kumac's etc.:

Operating system: VMS, UNIX
Computer:         VAX, ALPHA, APOLLO, DECS, HPUX, IBMAIX, IBMRT, SGI, SUN,
                  SOLARIS, LINUX
Site/Experiment:  L3, BONN, BONNCIP, ZEUS, CLEO, ALEPH, FNAL, CMU,
                  CERNAFS, DESYAFS
Extra options:    @GCC, @CERNLIB, @CERNNEW, @CERNOLD, NAG, IMSL
                  L3_DSP, ZEUS_DSP
Development:      @DEV, @DBG

   Before making any kumac's or other files from the mn_util.cmz you
must ensure that these flags are set as you need them. Once you have
done this once and made a cmzlogon.kumac, then each time you start CMZ
up in the future they should be set properly.
e.g. For VXL3J0 I do:       SEL VMS VAX L3 @DEV     for my test versions
     For CLEO librarian do: SEL VMS VAX CLEO
     For L3 HP's I do:      SEL UNIX HPUX CERNAFS

  The @CERNLIB option assumes that you have the cernlib command
available for defining the CERN libraries. @CERNNEW assumes the same,
but the new version of the libraries will be used, @CERNOLD for the
old versions.

   You should always start CMZ from the directory containing the CMZ files
and the kumac's. In addition, except when starting completely from scratch
as in 1) below, you should always make sure the Mn_Fit logicals or links
are defined before you start up CMZ.

   You should normally only have to modify the mn_fit_logical.com
(VMS) or the environment variable MN_FIT (Unix) file and perhaps the
SEQuence //mn_util/cdes/mn_logic for your system.  In addition you
should check that the other sequences, such as the default graphics
package and the experiment name are defined correctly in
//mn_util/cdes. All other files and code should be installation
independent.  If you find that you have to change anything, please let
me know and I will try to incorporate it automatically.

1) Starting from scratch:

   Set your default directory to the Mn_Fit top-level directory. Copy
   the relevant install script and run it.
   If the necessary sub-directories do not exist they will be created.


   a) The cmz files are made if they do not exist.
     make mn_fit
     make mn_util
     make typscn

   b) Select your options and make the kumac's:
     You are asked for your experiment name. If you give one this
     fixes the directories for mn_fit.com, mn_fit_logical.com etc.

     If you do not give an experiment name on VMS machines then the
     logical mn_fit_com must be defined before running Mn_Fit.

     On unix machines the environment varibale Mn_Fit must be defined
     (unless it is /usr/local/bin).

2) Setting up Mn_Fit when you have the CMZ files:

   Make sure the Mn_Fit logicals or links are defined properly for you e.g.:
     DO MN_FIT_LOGICAL        (CLEO Vax)
     source mn_fit_logical    (logged in as brock on L3 Apollos)
   Note that these files look to see if a logical mn_fit_dir or the
   environment variable MN_FIT exist. If so they do nothing.
   Therefore if you have changed anything you MUST
   deass mn_fit_dir (VMS) or unset MN_FIT (Unix) before running them.
   If you want to use a test area for example, then you should do
   setenv MN_FIT test_area instead of mn_fit_logical. You can also set
   MN_FIT in .cshrc for example to point to the correct area.

   Set your default directory to the mn_fit_cmz area and startup cmz.
   Note that cmzlogon.kumac (mn_macro#mn_alias) defines various aliases
   for the standard directories (a_mn_fit_dir etc.). The cmzlogon executes an
   alias/list which list the defined aliases for you.

   a) Remake the kumac's if necessary:
        exec mn_macro#makekumac

   b) Check the mn_logic SEQuence to see that it is correct for your selections:
        cd //mn_util/cdes
        read mn_logic

      To look at the SEQuences/CDE's with your selections you can do:
        seq .
        seq //mn_util/cdes
        seq -e
        exec mn_macro#mn_seq      (to get back the standard cde's)

      Check that you have the graphics package selected that you want:
        sel     (Usually HIGZ X11 on all machines or
                         HIGZ GKS GKSGRAL on L3 Vaxes)

      Check whether the IMSL flag is turned on (IMSL routines are available
      on CLEO Vaxes) if you have IMSL and whether the NAGLIB flag is
      turned on if you have Naglib.

      If you change //mn_util/cdes/mn_logic you should either exit and restart
      CMZ or give the command:
        exec mn_macro#mn_seq
      before proceeding.

   c) Make/remake any of the other files needed:
      This can be done by giving the command:
        exec mn_macro#makefiles

      You will then be asked if you want to make the files to link Mn_fit,
      run Mn_Fit, help files, test files and test histograms. You can make
      the help, demonstration, test and histogram files separately as
      indicated in iii), iv), v) and vi) below.
      Note that you should not make the help files or the test histograms until
      an up-to-date Mn_Fit library has been made.

      i) Make the files to link Mn_Fit:
         exec mn_macro#makelink

         Note that the link files now have the default graphics package and
         the way to access CERN libraries built in. These are steered by
         the select options in CMZ. I probably to not have all institutes
         and options properly built into here yet. Please let me know of
         any corrections or additions.

      ii) Make/remake the file to run Mn_Fit if necessary:
          exec mn_macro#makerun

         Provided SEQuence mn_logic is correct for your institute you
         should not have to modify this file. It should also not
         change very often, so once you have made it once, it should
         only need to be updated rarely.

      iii) Make the help files:
           exec mn_macro#makehelp

         If you are in VMS, both simulated VMS Help and real VMS Help
         libraries are made. On other machines only simulated VMS Help is made.
         This macro needs the typscn library which is made when you link
         Mn_Fit.

      iv) Make the demonstration files:
           exec mn_macro#makedemo

      v)  Make the test files:
           exec mn_macro#maketest

      vi) Make the histograms used for testing:
           exec mn_macro#makehist

          Note that you should not run this until an up-to-date Mn_Fit library
          has been made.


3) Where and how the Mn_Fit code is stored:

   All code is pointed to by the logical name MN_FIT_CMZ or link $MN_FIT/cmz.

   a) Mn_Fit code proper is in the file       MN_FIT.CMZ
   b) TYPSCN code is in the file              TYPSCN.CMZ
   c) Utilties, kumac's, help file, ...       MN_UTIL.CMZ
   d) L3 online displays' code is in the file L3_DSP.CMZ
   e) Interface to L3 database is in the file DBASE.CMZ

   There is a main kumac file mn_macro.kumac and the startup kumac,
   cmzlogon.kumac. There are also kumacs, typscn.kumac
   for making typscn libraries etc.

   There are a number of flags that are used to decide which version
   of the code is obtained:

   VMS        - VMS version of the code
   UNIX       - Unix version of the code
   IBM        - IBM version of the code (not  yet implemented)
   ALPHA      - Special ALPHA stuff in addition to Unix or VMS
   APOLLO     - Special Apollo stuff in addition to UNIX
   DECS       - Special DECstation stuff in addition to UNIX
   HPUX       - Special HP stuff in addition to UNIX
   IBMAIX     - Special IBM/370 AIX stuff in addition to UNIX
   IBMRT      - Special IBM AIX RS6000 stuff in addition to UNIX
   SGI        - Special SGI stuff in addition to Unix
   SUN        - Special SUN stuff in addition to UNIX
   SOLARIS    - Special SUN SOLARIS stuff in addition to UNIX
   LINUX      - Special Linux stuff in addition to UNIX
   HIGZ       - HIGZ version of the graphics
   GKS        - GKS version of HIGZ
   GKSGRAL    - GKSGRAL implementation of GKS
   DECGKS     - DECGKS/VAXGKS implementation of GKS
   DGKS3D     - DEC GKS3D implementation of GKS
   DI3000     - DI3000 graphics interface
   X11        - X11 interface for X windows
   PLTSUB     - PLTSUB graphics interface
   MN_HLP     - Use Mn_Fit VMS Help simulation
   IMSL       - Use IMSL spline fitting and smoothing routines
   NAGLIB     - Use NAGLIB spline fitting routines

   L3DSP      - Include L3 online detector displays
   L3_DB      - Include interface to L3 database
   L3_CPC     - Make the menu driven version for L3 online
   ZEUSDSP    - Include ZEUS detector displays

   To help cope with different experiments there are additional flags for
   making help files, kumac's etc.
   @CERNLIB   - Assumes you have the cernlib command
   @CERNNEW   - Assumes you have the cernlib command, new version
   @CERNOLD   - Assumes you have the cernlib command, old version
   CERNAFS    - AFS at CERN
   DESYAFS    - AFS at DESY
   L3         - L3 experiment - only for L3 repository
   BONN       - Bonn University
   BONNCIP    - CIP Pool at Bonn
   ZEUS       - ZEUS experiment - only for non-AFS machines
   CLEO       - CLEO experiment
   ALEPH      - ALEPH experiment
   FNAL       - Fermilab
   CMU        - CMU


4) Linking Mn_Fit:

   The file usually used to link is in the directory mn_fit_dir: (VMS) or
   $MN_FIT/mgr (Unix) and is called mn_fit.lnk. To link a user version you
   should use mn_user.lnk. This executes mn_fit.lnk with the appropriate
   parameters set. There are also files mn_dsp.lnk to link the
   L3 display version of Mn_Fit which includes detector displays and an
   interface to showing quantities in the L3 database, and mn_user.lnk to link
   a user version of Mn_Fit.

   mn_fit.lnk can be run with various options which are preceded by - signs:

   -f                   Final version - by default all the code will be compiled
   -t                   Test version - by default the code will not be compiled
   -u exename filename  Make a user version with executable name "exename" and
                        including compiled file(s) "filename"
   -c                   Compile all the code - must follow -f,-t or -u
   -nc                  Do not compile all the code
   -r                   Use GNU readline (only on Unix)
   -rc                  Use GNU readline with ncurses library (only on Unix)
   -rl                  Use GNU readline from /usr/local/lib
   -rcl                 Use GNU readline with ncurses from /usr/local/lib
   -ncmz                CMZ is not available
   -l libname           Include extra libraries "libname" in the link
   -d                   Link in debug
   -nd                  Link in NODEB. User versions get linked
                        in debug by default
   -m68k                Use m68k compiler on the Apollo (Motorola nodes)
   -a88k                Use a88k compiler on the Apollo (DN10000 nodes)

   e.g. @mn_fit.lnk -t -c      to link a test version on VMS and
                               recompile everything
        mn_fit.lnk  -f         to link a final version on a Unix machine

   Final version gets the executable name mn_fit_exe:mn_fit_x.exe (VMS) and
   $MN_FIT/exe/mn_fit_x.exe (Unix). Test versions get the names mn_test_x.exe
   in the same directories. The display version gets the name mn_dsp_x.exe.
   x is a single letter indicating the graphics package (g, v, d, 3, x, p).

   Normally if you remake the Mn_Fit libraries they will be compiled with
   optimization on.
   If for any reason you want to recompile all the code in DEBUG the
   way I usually do it is to modify the macro mn_macro#fort_opt to compile
   everything in DEBUG or change the line in mn_macro#makelib from
   fort_opt to fort_deb.

   If you link a final version all the CMZ code and the kumac's are copied
   to the MN_FIT_LIB area. Therefore I recommend that this area is
   a scratch area unless you have lots of disk quota (>20K blocks on VMS).

5) Running Mn_Fit:

   The file to run Mn_Fit is mn_fit.com on VMS and mn_fit on the Unix
   machines.

   You can add many qualifiers to the command to select which exe file is
   run. No qualifier will run mn_fit_exe:mn_fit_x where x is a letter
   indicating the graphics package used.

   -?     Help
   -h     Help       List the qualifiers available
   -t     Test       MN_TEST
   -dis   Display    MN_DSP
   -o     Old        MN_OLD
   -u     User       Run a user version of Mn_Fit. You must give the
                     executable name if it is not mn_user.exe
   -g     GKSGRAL    MN_FIT_G, MN_TEST_G or MN_OLD_G
   -v     DECGKS     MN_FIT_V etc.
   -de    DECGKS     MN_FIT_V etc.
   -dg    DGKS3D     MN_FIT_D etc.
   -di3   DI3000     MN_FIT_3 etc.
   -x     X11        MN_FIT_X etc.
   -n     Node       Nodename for the graphics window (X windows version)
   -t     Transport  Transport for DISPLAY - Decnet or TCPIP (VMS only)
   -p     PLTSUB     MN_FIT_P etc.
   -dbg   Run Mn_Fit in debug
   -cpc   Run CPC version of Mn_Fit (L3 Online Menu Display Version)

   e.g. @USER$DISK:[MN_FIT]MN_FIT -T -P to run the PLTSUB test version

   To run using a file you can use the form `do mn_fit filename [options]'.
   The first line of the file must be blank or contain a graphical output
   device name or number.

6) Help for Mn_Fit:

   There are 2 Ascii files in the mn_fit_help: (VMS) or $MN_FIT/help (Unix)
   directory which contain all the help: mn_fit_help.fil and minuit_help.fil.
   You make the help libraries by running the kumac: exec mn_macro#makehelp.
   On VMS this makes a VMS Help library and simulated VMS Help files.
   On Unix machines only simulated VMS Help files are made.

   To get the simulated help the select option VMS should be off or
   MN_HLP should be on.

7) Demonstration and test files for Mn_Fit:

   The demonstration files are in the directory mn_fit_help:.
   The test files for Mn_Fit sit in the directory mn_fit_test:
   These files need a set of test histograms. To make these you need to
   do the following:

   $ DO MN_FIT_LOGICAL         (or the equivalent on your machine)
   $ CMZ
   exec mn_macro#makedemo        to make the demonstration files
   exec mn_macro#maketest        to make the test files
   exec mn_macro#makehist        to make the test histograms

8) Making and Linking a Version with a Non-standard Graphics Package:

   Each computer and institute has a default graphics package defined and
   the normal mn_fit.lnk has this built in. You can use the option -g
   when you run mn_fit.lnk to specify another package:

   -g decgks
   -g pltsub etc.
