53 int length = ntohl ( d[1] );
65 if (length > dlength )
return 0;
67 short *
s = (
short *) &d[2];
74 v = ntohs ( s[pos++]);
78 v = ntohs ( s[pos++]);
82 v = ntohs ( s[pos++]);
104 for ( i = 0; i<
n_tdcs; i++)
107 tsh[
i].
TDC = ntohs ( s[pos++]) -1;
112 int old_trigger_number = -1;
117 short spillheaderlength = ntohs ( s[pos]);
118 short tdcindex = ntohs ( s[pos+1]) - 1;
119 if ( tdcindex >= MAXNROFTDCS )
121 cout << __LINE__ <<
" " << __FILE__
122 <<
" wrong TDC index " << tdcindex <<
" pos= " << pos << endl;
135 v = ntohs ( s[pos +2] ) -1;
140 cout << __LINE__ <<
" " << __FILE__
141 <<
" wrong Trigger number " << v <<
" pos= " << pos << endl;
148 if ( spillheaderlength > 8 && tdcindex < MAXNROFTDCS )
164 if ( v != old_trigger_number )
166 old_trigger_number =
v;
194 memset ( te->
td, 0, MAXNROFTDCS *
sizeof(
TDCData) );
201 te->
td[tdcindex].
words = spillheaderlength;
202 te->
td[tdcindex].
TDC = tdcindex;
222 for ( i = 0; i < te->
td[tdcindex].
words -8; i++)
229 short h = ntohs ( s[xpos+i]);
230 th->
wire = ( h >> 10) & 0x3f;
234 pos += spillheaderlength-1;
254 if ( strcmp(what,
"NTDCS") == 0 )
259 else if ( strcmp(what,
"TRIGGERCOUNT") == 0 )
264 else if ( strcmp(what,
"SPILLCOUNTER") == 0 )
269 else if ( strcmp(what,
"TDCSTATUSBITS") == 0 )
274 else if ( strcmp(what,
"LINKSTATUSBITS") == 0 )
279 else if ( strcmp(what,
"MONTH") == 0 )
284 else if ( strcmp(what,
"DAY") == 0 )
289 else if ( strcmp(what,
"YEAR") == 0 )
294 else if ( strcmp(what,
"HOUR") == 0 )
299 else if ( strcmp(what,
"MINUTE") == 0 )
304 else if ( strcmp(what,
"SECOND") == 0 )
317 if ( trigger < 0 || (
unsigned int ) trigger >=
TDCEventVector.size())
return 0;
318 if ( tdc < 0 || tdc >=
n_tdcs)
return 0;
319 if ( index < 0 || index >=
TDCEventVector[trigger]->td[tdc].hits)
return 0;
327 if ( trigger < 0 || (
unsigned int )trigger >=
TDCEventVector.size())
return 0;
328 if ( tdc < 0 || tdc >=
n_tdcs)
return 0;
331 if ( strcmp(what,
"HITS") == 0 )
335 cout << __LINE__ <<
" " << __FILE__ <<
" wrong trigger " << trigger <<
" max " <<
TDCEventVector.size() << endl;
341 else if ( strcmp(what,
"TDC") == 0 )
352 if ( trigger < 0 || (
unsigned int )trigger >=
TDCEventVector.size())
return 0;
353 if ( tdc < 0 || tdc >=
n_tdcs)
return 0;
354 if ( index < 0 || index >=
TDCEventVector[trigger]->td[tdc].hits)
return 0;
357 if ( strcmp(what,
"WIRE") == 0 )
359 return iValue(trigger, tdc, index);
362 else if ( strcmp(what,
"TIMESTAMP") == 0 )
382 os <<
" Date " <<
iValue(0,
"MONTH")
384 <<
"/20" <<
iValue(0,
"YEAR")
385 <<
" " <<
iValue(0,
"HOUR")
386 <<
":" <<
iValue(0,
"MINUTE")
387 <<
":" <<
iValue(0,
"SECOND") << endl;
389 os <<
" Spill Counter " <<
iValue(0,
"SPILLCOUNTER") << endl;
393 os <<
" Trigger Count " << tc << endl;
394 os <<
" TDC Status Bits " << hex <<
iValue(0,
"TDCSTATUSBITS") << dec << endl;
395 os <<
" Link Status bits " << hex <<
iValue(0,
"LINKSTATUSBITS") << dec << endl;
397 for ( k = 0; k <
tc; k++)
401 <<
" trg# tdc hit wire timestamp" << endl;
403 for ( l = 0; l <
iValue(0,
"NTDCS"); l++)
405 int hits =
iValue ( k, l,
"HITS");
408 int tdc =
iValue(k,l,
"TDC");
410 for ( j = 0; j < hits; j++)
412 os <<
" " << setw(6) << k
413 << setw(8) << tdc << setw(8) << j
414 << setw (8) <<
iValue(k,l,j)
415 << setw(8) <<
iValue(k,l,j,
"TIMESTAMP") << endl;
438 for ( l = 0; l <
n_tdcs; l++)