This is a draft which shows what has been done for MOFIA 2.0. "What's missing " comments are particularly welcome. Art
http://www.w3.org/TR/REC-html40/loose.dtd">>1 Mofia 2.0 Implementation Notes
1.1 Fortran 90 Migration Path
We have not significantly changed the code which is largely common to E787 and deals with event handling, skimming, run control and I/O assignments, CFM, and YBOS initializations. This is the code found in the main/ subdirectory. It has had many years of testing and debugging, so there is little to be gained from changing it. Procedures that are unique to E614 such as read_det_geom and begin_run have had USE statments added to give them access to the f90 procedures, and setup_geometry has been rewritten to use the new data types and moved from main/. The BLOCK DATA routine kdata.F will be used only for initialization of the common blocks filled in the main directory-it may be convenient in future to use a module instead for this purpose so that it can be loaded from a library. The namelists are also implemented in main and contain both E787 and E614-specific code. All of this code remains in fixed format with extension .FCommon blocks and parameter definitions are implemented through include directives using cpp. Many of these are required outside of main/. The include files have therefore been modified to be compatible with both fixed and free source formats by removing continuation lines and using ! to delimit comment lines. For commons extending over several lines
COMMON /common/ aaa, bbb, ccc 1 ddd,eee,fff is replaced by the equivalent COMMON /common/aaa, bbb, ccc COMMON/common/ ddd, eee, fffInterface blocks are used to enforce type checking for the external routines ie main/, ybos/, etc. The required information for each procedure (procedure name and definitions of the passed variables) are placed in files procedure.ifb in the include/ directory and included in all routines accessing this procedure. Please note the caution regarding the interface bug found on DEC alpha.
The procedures for filling the new geometry data structures and the tdc hit structures are now implemented in f90 modules in free source format. The intention is that the new code to be written for pattern recognition and tracking will be placed in modules and obtain required globals and procedures from modules. For code in modules interface blocks are not allowed and type-checking of parameters is automatic. We have used the suggested style of upper-case keywords and lower-case variables which is supported by emacs. For better readibility separate lines are used for each statement.
1.2 Module Coding Rules
We are developing a strategy aimed at data encapsulation to facilitate program reliability and debugging. The basic concept is to base modules on groupings of related data objects - the kinds of things that we would normally group into a common block. Module components would group together data-type definitions, variable definitions, variable initializations, procedures accessing these data types and data structures, and operators defined for these data types. Some of the data need be accessed only by procedures within the module, facilitating encapsulation. In some cases it will be more convenient or efficient to have procedures which operate on data defined in several different modules and pass them as global variables through use association. In this case the rule for which module to place a procedure in will be determined by the hierarchical nature of use association; if module b uses a, then a cannot use b.We've also come up with some convenient naming conventions:
When a module is compiled, two files are produced, with extensions .o and .mod. The .mod file contains the variable and procedure type definitions, and is used in the compilation stage of other use associated modules to enforce type cosistency. These files are all placed in a separate /module subdirectory, much like include files.
Contents of a typical module are (in order):
Here are some of the required mods:
The required libraries (tarred and gziped) for cernlib can be obtained by ftp from the e614 account on lin01.triumf.ca (usual password construction) in the directory e614soft_f90/triumf. The cernlib sources are in a separate file and should not be required. The other libraries will be available from CVS.
The Absoft code has been compiled using some DEC conventions rather than default Absoft ones. This is not necessary and perhaps not desireable but it works. It does require more elaborate Makefiles on GNU/Linux. These conventions are using the . f90 extension for source files with preprocessor directives (Absoft standard is .F90) and object files produced with lower case with underscore for entry names. With these conventions the source files have the same names on both platforms, and source files needed by the Absoft xfx debugger are produced.