47 int length = ntohl ( d[1] );
60 if (length > dlength )
return 0;
62 unsigned short *
s = (
unsigned short *) &d[1];
65 for ( i = 0; i <
length; i++)
82 s = (
unsigned short *) &d[1];
129 for ( i = 0; i<
n_tdcs; i++)
148 int old_trigger_number = -1;
155 int EventWordCount = s[
pos];
158 short tdcindex = s[pos+1] - 1;
160 if ( tdcindex >= MAXNROFTDCS )
162 cout << __LINE__ <<
" " << __FILE__
163 <<
" wrong TDC index " << tdcindex <<
" pos= " << pos-1 << endl;
168 int SpillTriggerCount = s[pos+3]<<16;
169 SpillTriggerCount += s[pos+4] -1;
173 cout << __LINE__ <<
" " << __FILE__
174 <<
" wrong Trigger number " << SpillTriggerCount <<
" pos= " << pos << endl;
180 if ( SpillTriggerCount != old_trigger_number )
182 old_trigger_number = SpillTriggerCount;
210 memset ( te->
td, 0, MAXNROFTDCS *
sizeof(
TDCData) );
217 te->
td[tdcindex].
words = EventWordCount;
218 te->
td[tdcindex].
TDC = tdcindex;
238 for ( i = 0; i < te->
td[tdcindex].
words -9; i++)
246 th->
wire = ( h >> 10) & 0x3f;
250 pos += EventWordCount;
262 if ( strcmp(what,
"NTDCS") == 0 )
267 else if ( strcmp(what,
"TRIGGERCOUNT") == 0 )
272 else if ( strcmp(what,
"SPILLCOUNTER") == 0 )
277 else if ( strcmp(what,
"TDCSTATUSBITS") == 0 )
282 else if ( strcmp(what,
"LINKSTATUSBITS") == 0 )
287 else if ( strcmp(what,
"MONTH") == 0 )
292 else if ( strcmp(what,
"DAY") == 0 )
297 else if ( strcmp(what,
"YEAR") == 0 )
302 else if ( strcmp(what,
"HOUR") == 0 )
307 else if ( strcmp(what,
"MINUTE") == 0 )
312 else if ( strcmp(what,
"SECOND") == 0 )
325 if ( trigger < 0 || (
unsigned int ) trigger >=
TDCEventVector.size())
return 0;
326 if ( tdc < 0 || tdc >=
n_tdcs)
return 0;
327 if ( index < 0 || index >=
TDCEventVector[trigger]->td[tdc].hits)
return 0;
335 if ( trigger < 0 || (
unsigned int )trigger >=
TDCEventVector.size())
return 0;
336 if ( tdc < 0 || tdc >=
n_tdcs)
return 0;
339 if ( strcmp(what,
"HITS") == 0 )
343 cout << __LINE__ <<
" " << __FILE__ <<
" wrong trigger " << trigger <<
" max " <<
TDCEventVector.size() << endl;
349 else if ( strcmp(what,
"TDC") == 0 )
360 if ( trigger < 0 || (
unsigned int )trigger >=
TDCEventVector.size())
return 0;
361 if ( tdc < 0 || tdc >=
n_tdcs)
return 0;
362 if ( index < 0 || index >=
TDCEventVector[trigger]->td[tdc].hits)
return 0;
365 if ( strcmp(what,
"WIRE") == 0 )
367 return iValue(trigger, tdc, index);
370 else if ( strcmp(what,
"TIMESTAMP") == 0 )
388 os <<
" Date " <<
iValue(0,
"MONTH")
390 <<
"/20" <<
iValue(0,
"YEAR")
391 <<
" " <<
iValue(0,
"HOUR")
392 <<
":" <<
iValue(0,
"MINUTE")
393 <<
":" <<
iValue(0,
"SECOND") << endl;
395 os <<
" Spill Counter " <<
iValue(0,
"SPILLCOUNTER") << endl;
399 os <<
" Trigger Count " << tc << endl;
400 os <<
" TDC Status Bits " << hex <<
iValue(0,
"TDCSTATUSBITS") << dec << endl;
401 os <<
" Link Status bits " << hex <<
iValue(0,
"LINKSTATUSBITS") << dec << endl;
403 for ( k = 0; k <
tc; k++)
407 <<
" trg# tdc hit wire timestamp" << endl;
409 for ( l = 0; l <
iValue(0,
"NTDCS"); l++)
411 int hits =
iValue ( k, l,
"HITS");
414 int tdc =
iValue(k,l,
"TDC");
416 for ( j = 0; j < hits; j++)
418 os <<
" " << setw(6) << k
419 << setw(8) << tdc << setw(8) << j
420 << setw (8) <<
iValue(k,l,j)
421 << setw(8) <<
iValue(k,l,j,
"TIMESTAMP") << endl;