Module interface definition files

Module interface definition (.mid) files replace the tep_am.for file of TAS1. A .mid file is processed with tas_genF to produce some Fortran source which gets compiled and linked into a TAS executable program. The .mid file determines what tables and analysis modules are included in the program.

There are two levels of usage for .mid files. The first is for specifying an individual analysis module and the other is for specifying what analysis modules are included in an executable program.

Single analysis module .mid file

Since there must be a strict agreement between a .mid file specification and the analysis module code that gets called according to this specification, it is important that the .mid file is kept consisten with the Fortran (or C) source code. This is facilitated by putting the specification for individual analysis modules in their own .mid files, one for each analysis module. An example of a single analysis module .mid file is (for trk):
# mid file for EOS trk routine
#
table_lib trk
table_lib hit
table_lib cam
table_lib dts


module trk trk_main

module_table trk hits update 1
module_table trk evnt read 2
module_table trk camac read 3
module_table trk trk_sw read 4
module_table trk trks write 5
module_table trk tpc_sum write 6
module_table trk vertex_list write 7
module_table trk v0_sw read 8
module_table trk v0 read 9

The table_lib keyword lines specify that the trk analysis module will need tables from the trk, hit, cam and dts libraries.

The module keyword line gives the name of the analysis module (trk) and the actual function name of the routine to call for this module (trk_main).

The module_table keyword lines specify that the trk module will have a set of individual tables passed to it with some read/write/update mode and the order that these tables will appear in the argument list in trk_main.

The corresponding Fortran code in trk_main associated with this .mid file is


        INTEGER FUNCTION TRK_MAIN(HITS_H,HITS,
     +                            EVNT_H,EVNT,
     +                            CAMAC_H,CAMAC,
     +                            TRK_SW_H,TRK_SW,
     +                            TRKS_H,TRKS,
     +                            TPC_SUM_H,TPC_SUM,
     +                            VERTEX_H,VERTEX,
     +                            V0_SW_H,V0_SW,
     +                            V0_H,V0)
*
**   Input tables:         HITS                                               **
**                         EVNT                                               **
**                         CAMAC                                              **
**                         TRK_SW                                             **
**                         V0_SW                                              **
**                                                                            **
**   Output tables:        TRKS                                               **
**                         TPC_SUM                                            **
**                         VERTEX_LIST                                        **
**                         V0                                                 **
**                                                                            *
	IMPLICIT NONE
C INFORMIX table structures
#include "tas_user_codes.inc"
#include "tas_structures.inc"
#include "hit_hits_pars.inc"
#include "hit_hits_st.inc"
#include "tas_evnt_pars.inc"
#include "tas_evnt_st.inc"
#include "cam_camac_pars.inc"
#include "cam_camac_st.inc"
#include "trk_trk_sw_pars.inc"
#include "trk_trk_sw_st.inc"
#include "trk_trks_pars.inc"
#include "trk_trks_st.inc"
#include "trk_tpc_sum_pars.inc"
#include "trk_tpc_sum_st.inc"
#include "trk_vertex_list_pars.inc"
#include "trk_vertex_list_st.inc"
#include "trk_v0_sw_pars.inc"
#include "trk_v0_sw_st.inc"
#include "trk_v0_pars.inc"
#include "trk_v0_st.inc"
        RECORD / table_head_st / hits_h
        RECORD / hits_row_st   / hits(*)
        RECORD / table_head_st / evnt_h
        RECORD / evnt_row_st   / evnt
        RECORD / table_head_st / camac_h
        RECORD / camac_row_st  / camac
        RECORD / table_head_st / trk_sw_h
        RECORD / trk_sw_row_st / trk_sw
        RECORD / table_head_st / trks_h
        RECORD / trks_row_st   / trks(*)
        RECORD / table_head_st  / tpc_sum_h
        RECORD / tpc_sum_row_st / tpc_sum
        RECORD / table_head_st      / vertex_h
        RECORD / vertex_list_row_st / vertex(*)
        RECORD / table_head_st  / v0_sw_h
        RECORD / v0_sw_row_st   / v0_sw
        RECORD / table_head_st  / v0_h
        RECORD / v0_row_st      / v0(*)

You should spend a little time looking at the correspondence between the .mid file and the Fortran source. In particular, you should notice that the order of the tables in the argument list is determined by the last parameter on the module_table keyword line in the .mid file. Also you should note that a single table yields two arguments, one for the table header descriptor structure and the second for the rows of table data.

Executable program .mid file

Given the set of individual analysis module .mid files that you want to include in order to build an executable program, you only need to specify which analysis modules (but not the details of those modules) to use for building an executable. An example of this is
#include "/home/sseos/u3/eostpc/eos_lib/eos/cam/src/cam.mid"
#include "/home/sseos/u3/eostpc/eos_lib/eos/hit/src/hit.mid"
#include "/home/sseos/u3/eostpc/eos_lib/eos/trk/src/trk.mid"

This specifies that the cam (camac decode), hit (hit finder) and trk (track finder) analysis modules should be included in the program, and that they will be called in the order listed in this file.
dlolson@lbl.gov

Back to TAS2 Intro