Daphne Tape Format Page 1 Overview 10 August 1992 1 Overview A Daphne data tape consists of a series of files separated by file marks. The last file is followed by two file marks. Each file consists of several header blocks and one or more data blocks. There is nothing special written preceding the first run on the tape: there is no volume label. When a run is started with the $ACQ command the tape processs does NOT immediately write out the header information. The tape process postpones writing header information until the first block of data is received. For a run in which no data is generated nothing will be written to tape. Each $ACQ command for which there is data begins a new file. The $STP command, if any data is written to tape, ends the file, writes a double end-of-file, and backspaces the tape so as to position the write head before the last end-of-file mark in preparation for the next run. VAX/VMS uses the ascii character code. Fields in Daphne records which are described as text or character will be in ascii. Lower case ascii is also used in some places. The IBM/370 series uses the EBCDIC character code rather than ascii. On the VAX the low order byte of a word is placed at the lowest address of the word. This is in contrast to such machines as the IBM/370 series which place the high order byte at the lowest address of the word. The VAX like the IBM/370 series represents integers using two's complement format. Each block, regardless of type, begins with a two character code, the first of which is usually alphabetic. The largest tape blocks generated by Daphne at this time are slightly less than 13 kbytes long. There will always be an even number of bytes in a tape block. NOTE It is unlikely that Daphne will ever use block sizes larger than 20 kbytes The user can force Daphne to use a smaller block size for data with the "/RECORD" qualifier of the $TAPE/OUT command. Daphne Tape Format Page 2 Example Programs 10 August 1992 2 Example Programs The Daphne developers have written a simple Fortran program which demonstrates how to read a Daphne data tape. It is a self-contained program written in Fortran-77 with symbols limited to 6 characters. The user must provide system dependent Fortran subroutines to perform tape operations and an analysis routine which is called once for each event. The program consists of the following files: DAP$DISK:[DAPHNE.EXPORT]DAPTAP.FOR DAP$DISK:[DAPHNE.EXPORT]TAPCOM.INC DAP$DISK:[DAPHNE.EXPORT]LUNCOM.INC This version of the program will run without changes under VAX/VMS. I want to emphasize that some of the routines are system dependent, however, I have tried to encapsulate each system dependent feature in a well documented subroutine. B. Crowell of Yale University has used code from the above program to convert Daphne event format tapes to Oak Ridge format tapes. The source code is in the directory DAP$DISK:[DAPHNE.EXPORT.DAPOAK] He has also written a program to convert many histogram formats to other histogram formats. The source code is in the directory DAP$DISK:[DAPHNE.EXPORT.TRAN]. Daphne Tape Format Page 3 Identifier Header Block 10 August 1992 3 Identifier Header Block A run begins with a record of type "A0" which is entirely in ascii. It identifies the tape ("Daphne Argonne National Laboratory") and gives the maximum number of bytes in any block of the file, 12288 in the example below. Ignore the statement that the shortest record is 256 bytes. It is wrong. Block number 1 (00000001), 256 (0100) bytes Read hexadecimal from right to left C 8 4 0 4E4E4F47 52412045 4E485041 44203041 A0 DAPHNE ARGONN 000000 524F4241 4C204C41 4E4F4954 414E2045 E NATIONAL LABOR 000010 49442053 43495359 48502059 524F5441 ATORY PHYSICS DI 000020 52204D55 4D495841 4D204E4F 49534956 VISION MAXIMUM R 000030 32323120 3D20455A 49532044 524F4345 ECORD SIZE = 122 000040 20202020 20202020 20202020 20203838 88 000050 45522054 53455452 4F485320 20202020 SHORTEST RE 000060 20202020 20363532 20203D20 44524F43 CORD = 256 000070 20202020 20202020 20202020 20202020 000080 20202020 20202020 20202020 20202020 000090 20202020 20202020 20202020 20202020 0000A0 20202020 20202020 20202020 20202020 0000B0 20202020 20202020 20202020 20202020 0000C0 20202020 20202020 20202020 20202020 0000D0 20202020 20202020 20202020 20202020 0000E0 20202020 20202020 20202020 20202020 0000F0 Daphne Tape Format Page 4 DAQ Header Block 10 August 1992 4 DAQ Header Block The second block of a run is the DAQ (Data Acquisition Parameters) control block with a buffer type code of "B0". The DAQ is in a format that is designed to make it easy to add new parameters or remove obsolete parameters. DAQ parameters are either 32 bit integers or character strings. DAQ parameters of type character have fixed length and are blank filled. The longest character string at the moment is the "comment" field which is 60 characters long. Following the buffer type code is a two byte filler and then a 32 bit integer giving the dimension of a 2 by N array of descriptors. In the example below there are 61 decimal (3D hexadecimal) data acquisition parameters. The array begins at byte 8 of the block. Element (1,i) is a 4 character ascii code (in lowercase!) for the name of parameter "i". Element (2,i) is a 32 bit number giving the number of bytes required to store the value of parameter "i". A table of identifier codes is at the end of this document. After the last descriptor and a 4 byte gap begins the DAQ parameters themselves in the same order as they appeared in the array of descriptors. Since all integer DAQ parameters come first they will be aligned to a multiple of 4 boundary. Character DAQ parameters follow integer parameters and are packed without regard for word alignment. Daphne Tape Format Page 5 DAQ Header Block 10 August 1992 Block number 2 (00000002), 1064 (0428) bytes Read hexadecimal from right to left C 8 4 0 00000004 76616161 0000003D 20203042 B0 =...aaav.... 000000 aaav at 1F4 -------^ -------^ -------^ ---^---^ 4 bytes "aaav" DAQ Count | ID required | for "aaav" Filler 00000004 616D6163 00000004 73667562 bufs....cama.... 000010 bufs at 1F8 00000004 646E6F63 00000004 65646F63 code....cond.... 000020 00000004 63707364 00000004 746E6F63 cont....dspc.... 000030 00000004 72636865 00000004 6C707364 dspl....ehcr.... 000040 00000004 6C736865 00000004 65726865 ehre....ehsl.... 000050 00000004 63786966 00000004 73737665 evss....fixc.... 000060 evss at 220 00000004 70747366 00000004 63746C66 fltc....fstp.... 000070 00000004 736D3168 00000004 69643168 h1di....h1ms.... 000080 00000004 736D3268 00000004 69643268 h2di....h2ms.... 000090 00000004 3268616D 00000004 3168616D mah1....mah2.... 0000A0 00000004 326D616D 00000004 316D616D mam1....mam2.... 0000B0 00000004 6D706373 00000004 6D6C6373 sclm....scpm.... 0000C0 00000004 3278616D 00000004 3178616D max1....max2.... 0000D0 00000004 7377736E 00000004 6662736E nsbf....nsws.... 0000E0 00000004 7274756F 00000004 6E656E6F onen....outr.... 0000F0 00000004 7270746F 00000004 6470746F otpd....otpr.... 000100 00000004 65666173 00000004 66626472 rdbf....safe.... 000110 00000004 646C6373 00000004 6C616373 scal....scld.... 000120 scld at 284 00000004 73706373 00000004 736C6373 scls....scps.... 000130 00000004 6D637074 00000004 61626174 taba....tpcm.... 000140 00000004 73777876 00000004 73736775 ugss....vxws.... 000150 00000004 62643277 00000004 73643177 w1ds....w2db.... 000160 00000004 73643277 00000004 63643277 w2dc....w2ds.... 000170 00000006 6D616562 000000C8 74736574 test....beam.... 000180 beam at 378 0000003C 6D6D6F63 00000004 636D6163 camc....comm<... 000190 comm at 382 00000006 72656E65 00000017 69747464 dtti....ener.... 0001A0 dtti at 3BE 00000008 746C756D 00000014 6E707865 expn....mult.... 0001B0 expn at 3D5 00000006 72646C6F 00000014 73796870 phys....oldr.... 0001C0 phys at 3DD 00000006 67726174 00000006 6E6E7572 runn....targ.... 0001D0 00000004 74726F76 00000006 73726576 vers....vort.... 0001E0 vers at 41D 00000002 00000018 00051586 00000000 ................ 0001F0 "gap" at 1F0 aaav at 1F4 0000000A 0000000E 00000050 00000064 d...P........... 000200 bufs at 1F8 00000014 00000000 00000001 00000064 d............... 000210 evss at 220 00000000 00000001 00000001 00000002 ................ 000220 00004D64 0000753C 0000465C 0000960C ....\F.. 5.2 EVS for Fixed Length Events The example below is for a an experiment with fixed length events of 6 words. Block number 3 (00000003), 1024 (0400) bytes Read hexadecimal from right to left C 8 4 0 00100001 00000006 00030016 04003142 B1.............. 000000 ---^ ---^ ---^ SOE Version ID 00000000 00000000 00000000 00000006 ................ 000010 00000000 00000000 00000000 00000000 ................ 000020 Daphne Tape Format Page 9 Event Data 10 August 1992 6 Event Data Each block of event data begins with a 20 byte header of which the first two bytes are a buffer type code of "D0". Blocks of event data can vary from 20 bytes to the maximum buffer size handled by Daphne, about 13 kbytes at the present time. A short block is common at the end of a run when event data is flushed to tape. Events never span a block boundary. Following the last event in a tape block is a word with all 16 bits set ('FFFF' hexadecimal). - Byte 0 D0_ID (2 character ascii) Two character ascii buffer type code of "D0" - Byte 2 D0_SIZE (16 bit integer) The number of bytes in this data block inclusive of the header and the event data. This should match the number of bytes read by the tape drive. The number of bytes in a Daphne data block should always be even. - Byte 4 D0_HEAD_SIZE (16 bit integer) The number of bytes in the header. For the current version of Daphne this will contain 20 (decimal). - Byte 6 D0_VERSION (16 bit integer) The version number of the header format. For the current version of Daphne this will contain 1. - Byte 8 D0_EP_ID (16 bit integer) The event processor that processed this buffer of event data. This will contain a number between 1 and 16 (decimal). - Byte 10 D0_BUF_TYPE (16 bit integer) This will always contain the value 5 for bt_tape. Daphne Tape Format Page 10 Event Data 10 August 1992 - Byte 12 D0_SEQ_NUMBER (32 bit integer) This is a sequence number generated by the event processors for each message sent to the VAX. Because of an oversight it cannot be used to check for lost or missing data buffers. However it can be used with the event processor number to identify a particular block of a file. - Byte 16 D0_CHECK_NUMBER (32 bit integer) This contains a 32 bit number chosen at random at the beginning of each run. It is intended to reduce to near zero the probability that an Event Processor that wakes up after acquisition has started can transmit stale data to be recorded onto tape. There are two formats for storing event data in the D0 data block depending on whether events are of fixed length or variable length. 6.1 Variable Length Event For variable length events each event is preceded by a control word which contains the number of words in the event, the event type, and has the most significant bit set. The count of words in the event includes the control word itself, so a 4 word event would contain a 5 in bits 13 through 4 of its control word. Control Word Format FE DCBD987654 3210 Bit Numbers XX XXXXXXXXXX XXXX -^ ---------^ ---^ sentinel word count Event type (0 to 15) bit 15 always 1 bit 14 always 0 Block number 5 (00000005), 12270 (2FEE) bytes Read hexadecimal from right to left C 8 4 0 000033CF 00050005 00010014 2FEE3044 D0./.........3.. 000000 -------^ ---^---^ ---^---^ ---^---^ sequence tape | version| size | # data | | (bytes)| | header | event size buffer processor (bytes) type ID Daphne Tape Format Page 11 Event Data 10 August 1992 003E2000 00800000 00208080 09442AF1 .*D... ...... >. 000010 ---^ -------^ control word of first check event in buffer number 8 words in event 03620080 00000020 000080C0 00000275 u....... .....b. 000020 ---^ control word of second event in buffer 12 words in event 00108080 05910000 00640219 038A039D ......d......... 000030 3rd ---^ 8 words 00108080 0289001B 002F1020 00100000 .... ./......... 000040 00108080 037F0562 00301020 00040000 .... .0.b....... 000050 00208080 0306060A 00331020 00020000 .... .3....... . 000060 00108080 00000555 00332020 01000000 .... 3.U....... 000070 00208080 02BA04EF 00361020 00040000 .... .6....... . 000080 000080C0 00000619 00402020 01000000 .... @......... 000090 01D902AA 03CA0323 025D0080 00000020 .....].#....... 0000A0 002A1020 00100000 00108080 05940000 ............ .*. 0000B0 04380200 00000004 00028090 036E001C ..n...........8. 0000C0 10200010 00000010 8080068F 03EC08DF .............. . 0000D0 01000000 00010001 80D00263 06B70042 B...c........... 0000E0 00000438 000000D1 03290372 042F0342 B./.r.).....8... 0000F0 02BE0000 00271020 00010000 00108080 ........ .'..... 000100 0266056A 00481020 00040000 00108080 ........ .H.j.f. 000110 0271051D 00471020 00040000 00108080 ........ .G...q. 000120 0320039F 03DC0080 00000020 000080C0 .... ......... . 000130 00040000 00108080 073904E0 00312020 1...9......... 002FA0 00000001 000180D0 000005AA 003C1020 .<............. 002FB0 04AC0000 04600396 02F3036A 03E90100 ....j.....`..... 002FC0 02D4047E 01000000 00010001 80D00000 ............~... 002FD0 FFFF 000004F3 00000809 02BC03C5 ................ 002FE0 ---^ Word with all bits set Daphne Tape Format Page 12 Event Data 10 August 1992 6.2 Fixed Length Events For fixed length events no control word is necessary since the length is fixed and there can only be one event type. Fixed Length Events of 6 Words Block number 4 (00000004), 12274 (2FF2) bytes Read hexadecimal from right to left C 8 4 0 00000EE6 00050002 00010014 2FF23044 D0./............ 000000 -------^ ---^---^ ---^---^ ---^---^ sequence tape | version| size | # data | | (bytes)| | header | event size buffer processor (bytes) type ID 0030028A 003401AA 00000022 CBEDE3BC ....".....4...0. 000010 ---^ -------^ first event in buffer check number 00000084 0030028C 00340354 00000022 "...T.4...0..... 000020 second event in buffer ---^ 003001AF 000000A0 003301AB 00340289 ..4...3.......0. 000030 003201AA 00340209 00000024 00360479 y.6.$.....4...2. 000040 00000082 00320351 0033028D 00000081 ......3.Q.2..... 000050 002201DA 00000014 002C047C 003401B1 ..4.|.,.......". 000060 002F01A9 0033028C 00000005 0034042B +.4.......3.../. 000070 00000009 00300183 00340248 00000044 D...H.4...0..... 000080 0033028D 00000012 0034023F 00300130 0.0.?.4.......3. 000090 Daphne Tape Format Page 13 Scaler Data Block 10 August 1992 7 Scaler Data Block Scaler information is in a block with buffer type code of "D1". When scalers are first defined space is allocated for the maximum number of scaler modules as given by the "sclm" parameter of the DAQ. In allocating space for the module space is also allocated for 32 channels, the maximum number seen in any scaler module. At present the actual number of modules in use is not stored in the header however one can infer the number of modules because the word following the last defined scaler module will contain zero. The scaler control block contains a header and is followed by space for each module description including a description of each of the channels of that module. - Byte 0 SCLDIR_ID (two character ascii) ascii "D1". - Byte 4 SCLDIR_BYTES_ENTRY (32 bit integer) Number of bytes required for the description of each scaler module. For the current version: 894 decimal. - Byte 8 SCLDIR_OFFSET (32 bit integer) Number of bytes from the beginning of the scaler control block to the first module description. For the current version: 80 decimal. - Byte 12 SCLDIR_SIZE (32 bit integer) Number of bytes occupied by the entire scaler control block. - Byte 16 SCLDIR_MAX_CHANNELS (32 bit integer) Number of channels per module. For the current version: 32 decimal. - Byte 20 SCLDIR_CHANNEL_BYTES_ENTRY (32 bit integer) Number of bytes required to describe each channel. For the current version: 28. - Byte 24 SCLDIR_CHANNEL_OFFSET (32 bit integer) The number of bytes required to describe a module and that precede the channel descriptions for that module. - Byte 28 SCLDIR_TIME (24 character ascii DD-MMM-YYYY HH:MM:SS.CC) The time at which the scaler information was written to tape. Daphne Tape Format Page 14 Scaler Data Block 10 August 1992 - Byte 52 SCLDIR_VERSION (32 bit integer) Current version is 1. - Bytes 56 through 79 are filler - Byte 80 Beginning of first module description The module header: - Byte 0 SCL_CONTROLLER (32 bit integer) This is a number used internally by Daphne to identify scaler types. - Byte 4 SCL_CRATE (32 bit The crate number in which the module is located. Crate numbers may be between 0 and 255 but are usually 1, 2, or 4. - Byte 8 SCL_SLOT (32 bit integer) The slot number of the crate in which the module sits. - Byte 12 SCL_READOUT (32 bit integer) If zero then this module is not to be read-out by the scaler read-out program. If non-zero this indicates what strategy should be used for reading the module. Thus the value depends on what model of scaler it is. - Bytes 16 through 27 are filler The description of the first channel of a module immediately follows the module header. - Byte 0 SCL_FILLED_FLG (32 bit logical) If the low order bit of this word is clear than this channel is considered inactive and is ignored by the scaler read-out program. If the bit is set then this channel of the module will be read-out periodically. - Byte 4 SCL_COUNT (32 bit integer) The number of counts recorded by this channel of the module. This is a 32 bit counter. The scaler read-out program assumes that the scalers count module 2**24 (16,777,216). When the scaler read-out program realizes that the current value of the scaler is less than the preceding value it increments the high order 8 bits of the 32 bit counts and updates only the low order 24 bits. Daphne Tape Format Page 15 Scaler Data Block 10 August 1992 - Byte 8 SCL_TITLE (12 character ascii) This is the name assigned by the user to the scaler channel. It is blank filled to 12 characters. - Bytes 12 through 27 are filler Daphne Tape Format Page 16 Scaler Data Block 10 August 1992 Block number 4 (00000004), 3776 (0EC0) bytes C 8 4 0 0000000A 00000050 0000039C 20203144 D1 ....P....... 000000 +------^ +------^ +------^ -------^ | | | buffer ID and 2 character filler | | bytes required for each module and its channels | number of bytes from start of block to first module description number of 512 byte pages allocated for the scaler control block 4A2D3033 0000001C 0000001C 00000020 ...........30-J 000010 +------^ +------^ +------^ -------^ | | | number of channels per module | | number of bytes required for each channel description | number of bytes from start of module desc to | first channel description time at which scalers were written to tape MM-DDD-YYYY HH:MM:SS.CC 38303A34 343A3830 20363839 312D4C55 UL-1986 08:44:08 000020 00000000 00000000 00000001 0034362E .64............. 000030 +------^ +------^ +------^ -------^ | | | last 3 bytes of time and one byte of filler | | version number filler filler 00000000 00000000 00000000 00000000 ................ 000040 filler filler filler filler 00000002 00000002 00000001 00000004 ................ 000050 +------^ +------^ +------^ -------^ | | | scaler type (4 is a Lecroy 4434) | | crate | slot readout type FFFFFFFF 00000000 00000000 00000000 ................ 000060 +------^ +------^ +------^ -------^ | filler filler filler first channel (channel 0) is active 20202020 20202020 3143534D 00000000 ....MSC1 000070 +------------------------^ -------^ | count is zero name of channel is "MSC1" with 12 characters blank filled 00000000 FFFFFFFF 00000000 00000000 ................ 000080 +------^ +------^ +------^ -------^ | | filler filler | second channel is active count is zero 00000000 20202020 20202020 314C4554 TEL1 .... 000090 +------- +------------------------^ | name is "TEL1" 12 characters blank filled filler 324C4554 00000000 FFFFFFFF 00000000 ............TEL2 0000A0 Daphne Tape Format Page 17 Scaler Data Block 10 August 1992 00000000 00000000 20202020 20202020 ........ 0000B0 20202020 334C4554 00000000 FFFFFFFF ........TEL3 0000C0 FFFFFFFF 00000000 00000000 20202020 ............ 0000D0 20202020 20202020 344C4554 00000000 ....TEL4 0000E0 00000000 FFFFFFFF 00000000 00000000 ................ 0000F0 00000000 20202020 20202020 3243534D MSC2 .... 000100 4E414843 00000000 FFFFFFFF 00000000 ............CHAN 000110 00000000 00000000 20202020 20202036 6 ........ 000120 Daphne Tape Format Page 18 Table of DAQ codes of General Interest 10 August 1992 8 Table of DAQ codes of General Interest aaav integer format is ddmmyy fstp logical force stop Set if $STP used the /FORCE flag to stop acquisiton otpr integer out tape record size specifies the size of buffer (in bytes) to be used by the poutput tape process scld integer scaler_delay when scalers are used gives the number of seconds to wait between reading scalers sclm integer maximum number of scaler modules defined beam character 6 beam from $INZ command comm character 60 comment from $INZ command dtti character 23 date and time of acquisition start format is dd-mmm-yyyy hh:mm:ss.cc ener character 6 energy from $INZ command evss integer event structure size (in units of 512 byte pages) expn character 20 experiment name from $INZ command phys character 20 physicist name from $INZ command runn character 6 run number from $INZ command targ character 6 target from $INZ command vers character 6 Daphne version - format is yymmdd (?) Daphne Tape Format Page 19 Table of Buffer Type Codes 10 August 1992 9 Table of Buffer Type Codes An asterisk ("*") indicates control blocks that can appear on a Daphne data tape at the present time (August '86). Code Defined By Short Description ---- ---------- ---------------------------------- A0* ETAPE.FOR First record of an event mode file A1* ETAPE.FOR First record of a dump mode file B0* DAQ.INC Data acquisition parameters B1* EVSDEFS.INC Event structure B2 W2DDEFS.INC 2-D Window directory B3 W2DDEFS.INC Window address block B4 W2DDEFS.INC Window corner block B5 SCPDIRDEF.INC Scatter plot buffers B6 CONDDEFS.INC Condition definitions B7 W1DDEFS.INC 1-D Windows B8 H1MDEFS.INC 1-D Maps B9 H2MDEFS.INC 2-D Maps BA FIXDEFS.INC User FIXed pt. constants BB FLTDEFS.INC User FLT pt. constants BC CAMDEFS.INC CAMAC module structure BD LNZDEFS.INC Linearizations directory BE LNZDEFS.INC Linearizations address block BF LNZDEFS.INC Linearizations corner block D0* D0.INC Event buffers D1* SCLDIRDEF.INC Scaler contents and definitions H1 H1DDEFS.INC 1-D Histogram, (1-Byte/channel) H2 H1DDEFS.INC 1-D Histogram, (2-Bytes/channel) H4 H1DDEFS.INC 1-D Histogram, (4-Bytes/channel) H5 H2DDEFS.INC 2-D Histogram, (1-Byte/channel) H6 H2DDEFS.INC 2-D Histogram, (2-Bytes/channel) H8 H2DDEFS.INC 2-D Histogram, (4-Bytes/channel) HA H1DIRDEFS.INC 1-D Histogram Directory HB H2DIRDEFS.INC 2-D Histogram Directory