AIDA GELINA BRIKEN nToF CRIB ISOLDE CIRCE nTOFCapture DESPEC DTAS EDI_PSA 179Ta CARME StellarModelling DCF K40
  AIDA  ELOG logo
Entry  Wed Feb 24 14:53:41 2016, PJCS, First data with two streams merged from one FEE64 R1_0.gz
    Reply  Wed Feb 24 16:13:24 2016, PJCS, First data with two streams merged from one FEE64 
    Reply  Thu Feb 25 12:47:43 2016, PJCS, First data with two streams merged from one FEE64 analyser.f
       Reply  Wed Mar 2 11:59:48 2016, PJCS, First data with two streams merged from one FEE64 
Message ID: 165     Entry time: Thu Feb 25 12:47:43 2016     In reply to: 162     Reply to this: 166
Author: PJCS 
Subject: First data with two streams merged from one FEE64 
My GREAT data analyser program reports that the 'fail' bit is set ?

$ ./a.exe v R1_0 | more
 *** GREAT format 3.2.0 analyser - TD - May 2014
  verbose
 ***   SYNC100 timestamp: block:     1 ptr:     7 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C088000A0
 ***   SYNC100 timestamp: block:     1 ptr:     9 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C088400A0
 ***   SYNC100 timestamp: block:     1 ptr:    11 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C088800A0
 ***   SYNC100 timestamp: block:     1 ptr:    13 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C088C00A0
 ***   SYNC100 timestamp: block:     1 ptr:    15 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C089000A0
 ***   SYNC100 timestamp: block:     1 ptr:    17 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C089400A0
 ***   SYNC100 timestamp: block:     1 ptr:    19 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C089800A0
 ***   SYNC100 timestamp: block:     1 ptr:    21 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C089C00A0
 ***   SYNC100 timestamp: block:     1 ptr:    23 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08A000A0
 ***   SYNC100 timestamp: block:     1 ptr:    25 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08A400A0
 ***   SYNC100 timestamp: block:     1 ptr:    27 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08A800A0
 ***   SYNC100 timestamp: block:     1 ptr:    29 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08AC00A0
 ***   SYNC100 timestamp: block:     1 ptr:    31 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08B000A0
 ***   SYNC100 timestamp: block:     1 ptr:    33 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08B400A0
 ***   SYNC100 timestamp: block:     1 ptr:    35 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08B800A0
 ***   SYNC100 timestamp: block:     1 ptr:    37 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08BC00A0
 ***   SYNC100 timestamp: block:     1 ptr:    39 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08C000A0
 ***   SYNC100 timestamp: block:     1 ptr:    41 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08C400A0
 ***   SYNC100 timestamp: block:     1 ptr:    43 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08C800A0
 ***   SYNC100 timestamp: block:     1 ptr:    45 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08CC00A0
 ***   SYNC100 timestamp: block:     1 ptr:    47 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08D000A0
 ***   SYNC100 timestamp: block:     1 ptr:    49 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08D400A0
 ***   SYNC100 timestamp: block:     1 ptr:    51 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08D800A0
 ***   SYNC100 timestamp: block:     1 ptr:    53 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08DC00A0
 ***   SYNC100 timestamp: block:     1 ptr:    55 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08E000A0
 ***   SYNC100 timestamp: block:     1 ptr:    57 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08E400A0
 ***   SYNC100 timestamp: block:     1 ptr:    59 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08E800A0
 ***   SYNC100 timestamp: block:     1 ptr:    61 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08EC00A0
 ***   SYNC100 timestamp: block:     1 ptr:    63 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08F000A0
 ***   SYNC100 timestamp: block:     1 ptr:    65 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08F400A0
 ***   SYNC100 timestamp: block:     1 ptr:    67 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08F800A0
 ***   SYNC100 timestamp: block:     1 ptr:    69 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C08FC00A0
 ***   SYNC100 timestamp: block:     1 ptr:    71 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C090000A0
 ***   SYNC100 timestamp: block:     1 ptr:    73 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C090400A0
 ***   SYNC100 timestamp: block:     1 ptr:    75 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C090800A0
 ***   SYNC100 timestamp: block:     1 ptr:    77 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C090C00A0
 ***   SYNC100 timestamp: block:     1 ptr:    79 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C091000A0
 ***   SYNC100 timestamp: block:     1 ptr:    81 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C091400A0
 ***   SYNC100 timestamp: block:     1 ptr:    83 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C091800A0
 ***   SYNC100 timestamp: block:     1 ptr:    85 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C091C00A0
 ***   SYNC100 timestamp: block:     1 ptr:    87 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C092000A0
 ***   SYNC100 timestamp: block:     1 ptr:    89 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C092400A0
 ***   SYNC100 timestamp: block:     1 ptr:    91 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C092800A0
 ***   SYNC100 timestamp: block:     1 ptr:    93 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C092C00A0
 ***   SYNC100 timestamp: block:     1 ptr:    95 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C093000A0
 ***   SYNC100 timestamp: block:     1 ptr:    97 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C093400A0
 ***   SYNC100 timestamp: block:     1 ptr:    99 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C093800A0
 ***   SYNC100 timestamp: block:     1 ptr:   101 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C093C00A0
 ***   SYNC100 timestamp: block:     1 ptr:   103 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C094000A0
 ***   SYNC100 timestamp: block:     1 ptr:   105 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C094400A0
 ***   SYNC100 timestamp: block:     1 ptr:   107 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C094800A0
 ***   SYNC100 timestamp: block:     1 ptr:   109 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C094C00A0
 ***   SYNC100 timestamp: block:     1 ptr:   111 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C095000A0
 ***   SYNC100 timestamp: block:     1 ptr:   113 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C095400A0
 ***   SYNC100 timestamp: block:     1 ptr:   115 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C095800A0
 ***   SYNC100 timestamp: block:     1 ptr:   117 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C095C00A0
 ***   SYNC100 timestamp: block:     1 ptr:   119 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C096000A0
 ***   SYNC100 timestamp: block:     1 ptr:   121 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C096400A0
 ***   SYNC100 timestamp: block:     1 ptr:   123 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C096800A0
 ***   SYNC100 timestamp: block:     1 ptr:   125 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C096C00A0
 ***   SYNC100 timestamp: block:     1 ptr:   127 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C097000A0
 ***   SYNC100 timestamp: block:     1 ptr:   129 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C097400A0
 ***   SYNC100 timestamp: block:     1 ptr:   131 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C097800A0
 ***   SYNC100 timestamp: block:     1 ptr:   133 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C097C00A0
 ***   SYNC100 timestamp: block:     1 ptr:   135 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C098000A0
 ***   SYNC100 timestamp: block:     1 ptr:   137 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C098400A0
 ***   SYNC100 timestamp: block:     1 ptr:   139 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C098800A0
 ***   SYNC100 timestamp: block:     1 ptr:   141 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C098C00A0
 ***   SYNC100 timestamp: block:     1 ptr:   143 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C099000A0
 ***   SYNC100 timestamp: block:     1 ptr:   145 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C099400A0
 ***   SYNC100 timestamp: block:     1 ptr:   147 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C099800A0
 ***   SYNC100 timestamp: block:     1 ptr:   149 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C099C00A0
 ***   SYNC100 timestamp: block:     1 ptr:   151 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09A000A0
 ***   SYNC100 timestamp: block:     1 ptr:   153 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09A400A0
 ***   SYNC100 timestamp: block:     1 ptr:   155 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09A800A0
 ***   SYNC100 timestamp: block:     1 ptr:   157 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09AC00A0
 ***   SYNC100 timestamp: block:     1 ptr:   159 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09B000A0
 ***   SYNC100 timestamp: block:     1 ptr:   161 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09B400A0
 ***   SYNC100 timestamp: block:     1 ptr:   163 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09B800A0
 ***   SYNC100 timestamp: block:     1 ptr:   165 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09BC00A0
 ***   SYNC100 timestamp: block:     1 ptr:   167 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09C000A0
 ***   SYNC100 timestamp: block:     1 ptr:   169 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09C400A0
 ***   SYNC100 timestamp: block:     1 ptr:   171 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09C800A0
 ***   SYNC100 timestamp: block:     1 ptr:   173 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09CC00A0
 ***   SYNC100 timestamp: block:     1 ptr:   175 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09D000A0
 ***   SYNC100 timestamp: block:     1 ptr:   177 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09D400A0
 ***   SYNC100 timestamp: block:     1 ptr:   179 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09D800A0
 ***   SYNC100 timestamp: block:     1 ptr:   181 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09DC00A0
 ***   SYNC100 timestamp: block:     1 ptr:   183 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09E000A0
 ***   SYNC100 timestamp: block:     1 ptr:   185 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09E400A0
 ***   SYNC100 timestamp: block:     1 ptr:   187 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09E800A0
 ***   SYNC100 timestamp: block:     1 ptr:   189 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09EC00A0
 ***   SYNC100 timestamp: block:     1 ptr:   191 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09F000A0
 ***   SYNC100 timestamp: block:     1 ptr:   193 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09F400A0
 ***   SYNC100 timestamp: block:     1 ptr:   195 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09F800A0
 ***   SYNC100 timestamp: block:     1 ptr:   197 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C09FC00A0
 ***   SYNC100 timestamp: block:     1 ptr:   199 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C0A0000A0
 ***   SYNC100 timestamp: block:     1 ptr:   201 data: 0x824000C0 module:  2 information type:  4 information 
field: 0x000000C0 ts: 0x000C0A0400A0
 ***            ADC data: block:     1 ptr:   203 data: 0xD08FFFFF module:  2 fail: 0 range: 1 id:   143 
channel: 15 adc: 65535  ts: 0x000C0A0411AE

 ***   SYNC100 timestamp: block:     3 ptr:  1071 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C7000A0
 *** ERROR: fail bit set: block:     3 ptr:  1073 data:E09F0730
 ***            ADC data: block:     3 ptr:  1073 data: 0xE09F0730 module:  2 fail: 1 range: 0 id:   159 
channel: 31 adc:  1840  ts: 0x000D0C71DC7E
 ***   SYNC100 timestamp: block:     3 ptr:  1075 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C7400A0
 ***   SYNC100 timestamp: block:     3 ptr:  1077 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C7800A0
 ***   SYNC100 timestamp: block:     3 ptr:  1079 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C7C00A0
 ***   SYNC100 timestamp: block:     3 ptr:  1081 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C8000A0
 *** ERROR: fail bit set: block:     3 ptr:  1083 data:E09F0678
 ***            ADC data: block:     3 ptr:  1083 data: 0xE09F0678 module:  2 fail: 1 range: 0 id:   159 
channel: 31 adc:  1656  ts: 0x000D0C811EB8
 ***   SYNC100 timestamp: block:     3 ptr:  1085 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C8400A0
 ***   SYNC100 timestamp: block:     3 ptr:  1087 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C8800A0
 ***   SYNC100 timestamp: block:     3 ptr:  1089 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C8C00A0
 ***   SYNC100 timestamp: block:     3 ptr:  1091 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C9000A0
 *** ERROR: fail bit set: block:     3 ptr:  1093 data:E09F06BC
 ***            ADC data: block:     3 ptr:  1093 data: 0xE09F06BC module:  2 fail: 1 range: 0 id:   159 
channel: 31 adc:  1724  ts: 0x000D0C9060F0
 ***   SYNC100 timestamp: block:     3 ptr:  1095 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C9400A0
 ***   SYNC100 timestamp: block:     3 ptr:  1097 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C9800A0
 ***   SYNC100 timestamp: block:     3 ptr:  1099 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0C9C00A0
 *** ERROR: fail bit set: block:     3 ptr:  1101 data:E09F0703
 ***            ADC data: block:     3 ptr:  1101 data: 0xE09F0703 module:  2 fail: 1 range: 0 id:   159 
channel: 31 adc:  1795  ts: 0x000D0C9FA328
 ***   SYNC100 timestamp: block:     3 ptr:  1103 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0CA000A0
 ***   SYNC100 timestamp: block:     3 ptr:  1105 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0CA400A0
 ***   SYNC100 timestamp: block:     3 ptr:  1107 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0CA800A0
 ***   SYNC100 timestamp: block:     3 ptr:  1109 data: 0x824000D0 module:  2 information type:  4 information 
field: 0x000000D0 ts: 0x000D0CAC00A0
 *** ERROR: fail bit set: block:     3 ptr:  1111 data:E09F0749


                   blocks:         14
          ADC data format:      21180 (      86.8 Hz)
        Other data format:      93060 (     381.5 Hz)
 Sample trace data format:          0 (       0.0 Hz)
         Undefined format:          0 (       0.0 Hz)
   Other data format type:      PAUSE:          0 (       0.0 Hz)
                               RESUME:          0 (       0.0 Hz)
                              SYNC100:      93060 (     381.5 Hz)
                           FEE64 disc:          0 (       0.0 Hz)
                             MBS info:          0 (       0.0 Hz)
                           Other info:          0 (       0.0 Hz)

   ADC data range bit set:       1239 (       5.1 Hz)

                Timewarps:        ADC:          0 (       0.0 Hz)
                                PAUSE:          0 (       0.0 Hz)
                               RESUME:          0 (       0.0 Hz)
                              SYNC100:          0 (       0.0 Hz)
                           FEE64 disc:          0 (       0.0 Hz)
                             MBS info:          0 (       0.0 Hz)
                            Undefined:          0 (       0.0 Hz)
                         Sample trace:          0 (       0.0 Hz)

 Timestamp elapsed time:      243.950 s

 *** Program elapsed time:    0.719s (   19.478 blocks/s,   1.217 Mb/s)
Attachment 1: analyser.f  17 kB  | Hide | Hide all
      PROGRAM GREAT

C     Read and analyse GREAT format data - version 3.20
C
C     See:
C     http://npg.dl.ac.uk/documents/edoc504/edoc504.html
C     http://npg.dl.ac.uk/DataAcq/TSformat.html

      IMPLICIT NONE
C
C     Parameter variables
C
      INTEGER block_length
      PARAMETER (block_length = 16384)
C
C     Argument variables
C
      CHARACTER*255 filename
C
      INTEGER max_data_words, nowords
C
C     Local variables
C
      CHARACTER*(block_length*4) buffer
      CHARACTER*255 arg
C
      INTEGER block_number, block_ptr, data_block(block_length), event
      INTEGER header_data(6), high_water_mark, i
      INTEGER*2 i2(2), i2_2(4)
      INTEGER i4, j4, i4_2(2), io_error, tag, items( 0:31 )
      INTEGER fail, range, channel_ident, adc_data, module
      INTEGER channel, type, information, ts28, ts48, sample_length
      INTEGER information_index, mbs_data, ch, tag_old, type_old
      integer*8 i8, ts, ts_old, iargc, first_ts, last_ts, sync_old

      REAL dt, t1, t2, secnds

      LOGICAL verbose

      EQUIVALENCE ( data_block, buffer )
      EQUIVALENCE ( i4, i2( 1 ) )
      EQUIVALENCE ( i8, i4_2(1) )

      SAVE data_block, block_ptr, block_number, event, high_water_mark

C----67---------------------------------------------------------------72------80
C     Announce program

      WRITE( 6, 9000 )

C     Initialise variables

      block_ptr = 1
      block_number = 0
      event = 0

      ts_old = 0
      tag_old = 0
      type_old = 0
      first_ts = 0
      last_ts = 0

      verbose = .FALSE.
      
      DO i = 0, 31
       items( i ) = 0
      ENDDO

C     Get input filename from command line argument

      DO i = 1, iargc()
       CALL getarg( i, arg )
       IF ( arg.EQ.'v') THEN
        verbose = .TRUE.
        write(6,*) ' verbose'
       ELSE
        filename = arg
       ENDIF
      ENDDO
      IF ( iargc().LT.1 .OR. iargc().GT.2 ) THEN
       WRITE( 6, * ) ' Usage: ./a.exe [v] <filename>'
       STOP
      ENDIF

      t1 = SECNDS( 0.0 )

C     Open file

      OPEN( 10, RECL = 4 * block_length,
     +      FILE = filename, STATUS = 'OLD', ACCESS = 'DIRECT' )

    1 CONTINUE

C     Read next block
C     Note: for FORTRAN direct I/O first block/record number is 1
C           for GREAT data format first (encoded) block/record number is 0

      block_number = block_number + 1

      READ( 10, REC = block_number, iostat=io_error, ERR=1000 ) buffer

      DO block_ptr = 7, data_block( 6 ) / 4 + 4, 2


       i4 = data_block( block_ptr )
       j4 = data_block( block_ptr + 1 )
C      IF ( block_number.EQ.1 ) THEN
C       IF ( block_ptr.LE.16 .OR. block_ptr.gt.16200 ) THEN 
C        WRITE( 6, 9500 ) block_ptr, i4, j4
C       ENDIF
C      ENDIF

       tag = AND( RSHIFT( i4, 30 ), Z'00000003' )

C      tag = 3 = ADC data format
C      tag = 2 = Other data
C      tag = 1 = Sample trace buffer format
C      tag = 0 = undefined?

C----67---------------------------------------------------------------72------80
C     ADC data

       IF ( tag.EQ.3 ) THEN

        items( 0 ) = items( 0 ) + 1

        fail = AND( RSHIFT( i4, 29 ), Z'00000001' )

        IF ( fail.NE.0 ) THEN

         WRITE( 6, 9600 ) block_number, block_ptr, i4

        ENDIF

        range = AND( RSHIFT( i4, 28 ), Z'00000001' )
        IF ( range.EQ.1 ) THEN
         items( 19 ) = items( 19 ) + 1
        ENDIF
        channel_ident = AND( RSHIFT( i4, 16 ), Z'00000fff' )
        module = AND( RSHIFT( channel_ident, 6 ), Z'0000003f' )
        channel = AND( channel_ident, Z'0000003f' )
        adc_data = AND( i4, Z'0000ffff' )
        ts28 = AND( data_block( block_ptr + 1 ), Z'0fffffff' )

        i8 = 0
        IF ( ts28.LT.Z'00000A0' ) THEN
         i4_2( 1 ) = ts48 + 1
        ELSE
         i4_2( 1 ) = ts48
        ENDIF
        ts = LSHIFT( i8, 28 )
        i8 = 0
        i4_2(1) = ts28
        ts = ts + i8

	IF ( ts.LT.ts_old ) THEN

	 items( 20 ) = items( 20 ) + 1

         WRITE( 6, 9710 ) block_number, block_ptr, i4, module, fail,
     +   range, channel_ident, channel, adc_data, ts, ts_old, tag_old,
     +   type_old
        ENDIF

        ts_old = ts
        tag_old = tag
        type_old = 0

        IF ( verbose ) THEN 
         WRITE( 6, 9700 ) block_number, block_ptr, i4, module, fail,
     +   range, channel_ident, channel, adc_data, ts
        ENDIF

        ch = channel + ( module - 1 ) * 64 + ( range * 2048 )

C----67---------------------------------------------------------------72------80
C     Other information

       ELSEIF( tag.EQ.2 ) THEN

        items( 1 ) = items( 1 ) + 1

        module = AND( RSHIFT( i4, 24 ), Z'0000003f' )
        type = AND( RSHIFT( i4, 20 ), Z'0000000f' )
        information = AND( i4, Z'000fffff' )
        ts28 = AND( data_block( block_ptr + 1 ), Z'0fffffff' )

        IF ( type.EQ.2 ) THEN

C----67---------------------------------------------------------------72------80
C     PAUSE timestamp

         items( 4 ) = items( 4 ) + 1

         ts48 = information

        i8 = 0
        IF ( ts28.LT.Z'00000A0' ) THEN
         i4_2( 1 ) = ts48 + 1
        ELSE
         i4_2( 1 ) = ts48
        ENDIF
        ts = LSHIFT( i8, 28 )
        i8 = 0
        i4_2(1) = ts28
        ts = ts + i8

         IF ( ts.LT.ts_old ) THEN

          items( 21 ) = items( 21 ) + 1

         ENDIF
         ts_old = ts
         type_old = type
         tag_old = tag

         IF ( verbose ) THEN 
          WRITE( 6, 9800 ) block_number, block_ptr, i4, module, type,
     +     information, ts
         ENDIF

        ELSEIF( type.EQ.3 ) THEN

C----67---------------------------------------------------------------72------80
C     RESUME timestamp

         items( 5 ) = items( 5 ) + 1

         ts48 = information

        i8 = 0
        IF ( ts28.LT.Z'00000A0' ) THEN
         i4_2( 1 ) = ts48 + 1
        ELSE
         i4_2( 1 ) = ts48
        ENDIF
        ts = LSHIFT( i8, 28 )
        i8 = 0
        i4_2(1) = ts28
        ts = ts + i8

         IF ( ts.LT.ts_old ) THEN

          items( 22 ) = items( 22 ) + 1

         ENDIF
         ts_old = ts
         type_old = type
         tag_old = tag

         IF ( verbose ) THEN 
          WRITE( 6, 9810 ) block_number, block_ptr, i4, module, type,
     +     information, ts
         ENDIF

        ELSEIF( type.EQ.4 ) THEN

C----67---------------------------------------------------------------72------80
C     SYNC100 timestamp

         items( 6 ) = items( 6 ) + 1

         ts48 = information

        i8 = 0
        IF ( ts28.LT.Z'00000A0' ) THEN
         i4_2( 1 ) = ts48 + 1
        ELSE
         i4_2( 1 ) = ts48
        ENDIF
        ts = LSHIFT( i8, 28 )
        i8 = 0
        i4_2(1) = ts28
        ts = ts + i8

         IF ( first_ts.EQ.0 ) THEN
          first_ts = ts 
C          WRITE( 6, 9920 ) first_ts
C 9920     FORMAT( ' first ts: 0x', Z16.16 )
         ENDIF
 
         IF ( ts.LT.ts_old ) THEN

          items( 23 ) = items( 23 ) + 1
 
         ENDIF
C         WRITE( 6, 9910 ) ts-sync_old
C 9910    FORMAT( ' *** SYNC100: 0x', Z16.16 ) 
C         sync_old = ts
         ts_old = ts
         type_old = type
         tag_old = tag

         IF ( verbose ) THEN 
          WRITE( 6, 9820 ) block_number, block_ptr, i4, module, type,
     +     information, ts
         ENDIF

        ELSEIF( type.EQ.6 ) THEN

... 309 more lines ...
ELOG V3.1.4-unknown