TWIST MOFIA MANUAL

Source Code Organization

The source code for MOFIA 2.2 is in the directory
~username/mofia/2.2/source. Several subdirectories reside in it: main,
mainf90, dummy, include, modules, photo, and user. The subdirectory
main contains the MOFIA "mainframe" code (adapted from E787); this is
the part that was not changed and is still in FORTRAN 77 format. Code
in this directory has the extension .F and is compiled with the f90
compiler as FORTRAN 90 fixed format code. The subdirectory mainf90
contains the TWIST main analysis code. This subdirectory will also
contain other software packages once they are developed and tested. In
contrast, code that is still under development and testing, as well as
utility code that is regularly modified by many users will reside in
the user subdirectory. The code in the mainf90 and user subdirectories
carries the extension .f90 and is therefore compiled with the f90
compiler as FORTRAN 90 free format code. The photo subdirectory
includes the code needed for the ROOT package (event display) which is
written in C++. The photo directory also contains some FORTRAN
subroutines to provide the link between the MOFIA FORTRAN code and the
event display C++ code. The include subdirectory includes all the
include files, common blocks, parameter files, and interface
blocks. For convenience, the environment variables MOFIA_SOURCE,
MOFIA_DUMMY, MOFIA_MAIN, MOFIA_MAINf90, MOFIA_PHOTO and MOFIA_USER are
set to point to the source directory and its subdirectories. For
example, the command

cd $MOFIA_USER

puts the user in the directory .../source/user

When a module is compiled, the compilation process goes through two
steps: first a file with extension .mod is created and then the .o
file is created. The .mod file resides in the modules
subdirectory. These .mod files are needed when other modules that USE
them are compiled to enforce type checking on all procedure
calls. Finally, the subdirectory dummy contains "dummy" modules and
subroutines. These modules serve two purposes. First, for purposes of
testing (or convenience) a certain part of the code might not be
required. This is achieved by calling the equivalent dummy subroutine
to replace the actual package. Second, the use of dummy modules
provides a way to simplify the compiling and linking process when
interdependencies between modules in different subdirectories are
present. The dummy subdirectory also contains dummy subroutines for
user specific code such as my_begin_run, my_end_run, my_init,
etc. When the user needs to modify these subroutines, they should be
copied to the user subdirectory, modified, and added explicitly to the
Makefile (in the user subdirectory). The compiler will first look for
these files in the user subdirectory, if the specified files are not
present, the compiler will find the .o files in .../lib/libdummy.a and
link with them instead.