Using Daphne with the MSU/NSCL Acquisition System Page 1 1 Introduction Daphne has been modified to work with the MSU/NSCL acquisition system for both on-line and off-line (Replay) analysis. The MSU acquisition system was written by Ron Fox of the Michigan State University National Superconducting Cyclotron Laboratory (NSCL). 2 User-Function The structure of the Daphne user-function has not been changed, but the method of linking is different. There are additional entry points available for users who wish to perform special processing of the buffers generated by the MSU acquisition system. 2.1 Linking To link a user-function for use with an MSU data stream or data file: $ @DAPEXE:MSUUSERFUNC.LNK my_program link_options Example: $ @DAPEXE:MSUUSERFUNC.LNK OXYFIS /DEBUG/MAP Using Daphne with the MSU/NSCL Acquisition System Page 2 2.2 MSU Entry Points The Daphne sort program allows the user to supply routines to handle each of the following MSU buffer types: - Subroutine MSU_SCALER (MSUheader) This routine will be called for both SCALER and SCALER_PEEK records. SCALER_PEEK buffers are not recorded on tape by the standard MSU recording routines, so they are never seen during Replay. SCALER is buffer type 2 SCALER_PEEK is buffer type 3 - Subroutine MSU_START (MSUheader) Buffer type 11 is generated at the start of a run - Subroutine MSU_STOP (MSUheader) Buffer type 12 is generated at the end of a run - Subroutine MSU_PAUSE (MSUheader) Buffer type 13 is generated when an MSU PAUSE command is issued - Subroutine MSU_RESUME (MSUheader) Buffer type 14 is generated when an MSU RESUME command is issued - Subroutine MSU_LINKLOST (MSUheader) Buffer type 15 is generated when the computer loses its link to the front-end acquisition system. There is NO routine MSU_DATA (buffer type 1) at this time. All these routines are optional. If any of them is not supplied by the user then the Daphne subroutine library DAPEXE:DAPUSERFUNCLIB.OLB will supply a stub routine. 3 Structure of an MSU Buffer The MSUheader consists of sixteen 16 bit words: - *Word 1: The size of the record (in bytes) The byte count includes the header itself - *Word 2: The buffer type - Word 3: Checksum of header Using Daphne with the MSU/NSCL Acquisition System Page 3 - *Word 4: Run Number - Words 5 and 6: Buffer sequence number within a run Event data buffers are numbered independently of control data buffers - Word 7: Event count - Word 8: Number of LAM registers - Word 9: Number of generating CPU - Word 10: Number of bit registers - Word 11: Buffer structure version (Currently value is 1) - Words 12 to 16 not used An asterisk ("*") indicates a field which Daphne uses. The interpretation of information following the sixteen word header depends on the buffer type. In the near future routines will be written to provide the user-function with header and buffer type dependent information in a more convenient format. 4 Input from Disk or Tape The MSU system records data in a format which is compatible with the VAX/VMS file system. As a result, it is possible to use a routine designed for disk data files to read files whether they be on tape or disk. For data files on disk: $ DISK/IN/PROG=DAPEXE:MSUFILE RUN000005.EVT $ RDD $ DISK/IN/PROG=DAPEXE:MSUFILE RUN000006.EVT $ RDD $ DISK/IN/PROG=DAPEXE:MSUFILE RUN000007.EVT and so on For data files on tape: $ MOUNT MUA0: /OVERRIDE=IDENTIFICATION $ DISK/IN/PROG=DAPEXE:MSUFILE MUA0:RUN000005.EVT $ RDD $ DISK/IN/PROG=DAPEXE:MSUFILE MUA0:RUN000006.EVT Using Daphne with the MSU/NSCL Acquisition System Page 4 $ RDD $ DISK/IN/PROG=DAPEXE:MSUFILE MUA0:RUN000007.EVT and so on Please note the use of $RDD ("Read Data from Disk") rather than $RDT ("Read Data from Tape"). This is because the tape is written in a file structured format which allows VMS to emulate some disk operations. You can use the standard VMS commands and programs to position the tape before starting replay. 5 No Output in MSU Format Daphne can create subsets of events and save them in a data file. However, the data files will be in Daphne format, not MSU format. See the Daphne "Guide to Replay" on how to select a subset of events for a new data file. 6 Starting Replay with MSU Data Files Daphne Replay with MSU data files differs from Replay with Daphne data files in the following way: Modified $DISK/IN command: $ DISK/IN/PROG=DAPEXE:MSUFILE file_name Modified procedure for linking the user-function: $ @DAPEXE:MSUUSERFUNC.LNK my_user_function link_options Starting the sort has not changed: $ RDD Using Daphne with the MSU/NSCL Acquisition System Page 5 7 Starting Sorting with MSU Acquisition There is a special version of the Daphne VAXSORT program for use with the on-line MSU acquisition system. It is invoked by: $ ACQ/MSU Since it is easy to forget the use of the /MSU qualifier one may want to create a symbol to start acquisition. For example use the following command to redefine the symbol "ACQ": $ ACQ:==ACQ/MSU The acquisition program includes the equivalent of the MSU "CONNECT/CONSUMER" command. Once started the sorting program will look for an MSU stream with the name "DAPHNE". Because of the changes necessary to start the sorting process when running with the MSU system, a user may not receive the same error messages one would were Daphne running without the MSU system. For instance there are special error messages for problems related to starting shareable images. These will not appear when running in on-line mode with the MSU system. The method of linking an MSU user-function is identical whether used for Replay or Acquisition: $ @DAPEXE:MSUUSERFUNC.LNK my_user_function link_options To use the VAX/VMS symbolic debugger with this MSU specific version of VAXSORT, start acquisition with the following command (assuming one is using the symbol "ACQ" as defined above): $ ACQ /DEBUG For information on using the VAX/VMS symbolic debugger with a Daphne user-function see the Daphne "Guide to Replay". Using Daphne with the MSU/NSCL Acquisition System Page 6 8 Writing Your Own block-handler Routine A "block-handler" routine is a subroutine which is linked with the Daphne user-function and which is called once for each block of data before the data in that block is sorted. A user can perform operations which depend on the factors other than the event data. When processing data from non-Daphne sources, such as the MSU acquisition system, it allows one to look at the MSU specific parts of the block without having to incorporate MSU specific code into the standard user-function. Daphne provides only two trivial block-handlers. The default "NULL" block-handler is DAPTAB:NULLBLOCKHANDLER.FOR and is part of DAPEXE:DAPUSERFUNC.OLB object library. It is linked automatically with a user-function when one uses the DAPEXE:DAPUSERFUNC.LNK link command procedure (unless the user explicitly supplies one when the user-function is linked). The MSU block-handler is DAPEXE:MSUBLOCKHANDLER.OBJ and is linked with your user-function automatically when one uses the DAPEXE:MSUUSERFUNC.LNK link command procedure. The source code for both block-handlers is in DAPTAB:*BLOCKHANDLER*.FOR. A block-handler has three entry points: Using Daphne with the MSU/NSCL Acquisition System Page 7 c++ c subroutine blockHandlerInit (name) c c This routine is called before sorting begins so that c Daphne can verify that the blockHandler is compatible with c the tape or disk input routine and to allow the user to c perform any necessary initialization c c name - ouput/character*4 c identifies tape handler so VAXSORT can verify c that this routine matches the input tape/disk c routine c code must match value supplied by input tape/disk c routine or be space in order to indicate DAPHNE c-- c++ c logical*4 function blockHandler (blockNumber,buffer,dataArray) c c This routine is provided by the installation or user to provide tape c format specific processing in the sort program. For instance when c processing MSU format data it allows user supplied routines to be c called for processing scaler data. c c function value - output/logical*4 c .true. => block should be sorted c .false. => block should NOT be sorted c c blockNumber - input/integer*4 c for passing to isGoodBlock routine c c buffer - input/integer*2(*) c array pointing to buffer passed by input c tape/disk routine c includes any header provided by input c tape/disk routine c c dataArray - input/integer*2(*) c array pointing to data to be sorted c-- c++ c subroutine blockHandlerExit (VMSstatus) c c This routine is called automatically at the end of sorting c c VMSstatus - input/integer*4 c standard VMS status code c odd value => normal exit c even value => non-normal exit c-- Using Daphne with the MSU/NSCL Acquisition System Page 8 9 Relinking When MSU DAQ_LIB:DAQOBJLIB Routines Change NOTE For maintainers of the MSU acquisition system The Daphne program DAPTAB:MSUVAXSORT.EXE which receives data from the MSU acquisition system depends on the following routines which are located in DAQ_LIB:DAQOBJLIB.OLB - OPEN_STREAM - GET_BUF - MAP_TO_BUFFER - RELEASE_BUF To relink and reinstall MSUVAXSORT.EXE use the following procedure: $ SET DEFAULT DAPDIR: $ @LOGIN $ SET DEFAULT DAPTAB: $ @MSUVAXSORT.LNK "/NODEBUG/NOTRACE" $ @MSUVAXSORT.LNK "/DEBUG/EXE=MSUVAXSORTDEBUG.EXE" $ COPY MSUVAXSORT*.EXE DAPDIR:*.*;0 $ SET DEFAULT DAPDIR: $ COPY MSUVAXSORT*.EXE [DAPHNE.EXE]*.*;0 There are two version of MSUVAXSORT, one with debug symbols and one without. The version which is activated depends on whether the user selects the /DEBUG qualifier when sorting is started. Using Daphne with the MSU/NSCL Acquisition System Page 9 10 A Consumer Process to Watch Run Numbers A program is distributed with Daphne which updates the Daphne run number from the MSU run number. The program runs as a standard MSU consumer process: To start the program use the command file "DAPEXE:MSURUN.COM" $ make msurun $ ! $ ! Select start/stop buffers $ ! $ send/nosample 11,12 msurun $ term:=='f$logical("TT")' $ connect/consumer/input='term'/output='term' dapexe:msurun msurun