27 std::map <int, FEU_decoded_data *>::iterator
it;
43 if ( strcmp(what,
"NR_FEU") == 0 )
48 if ( strcmp(what,
"FEU_ID") == 0 )
51 if ( ii >=
feu_map.size() )
return 0;
53 std::map <int, FEU_decoded_data *>::const_iterator
it =
feu_map.begin();
55 for (
int k =0;
k <
i;
k++) ++it;
68 if ( strcmp(what,
"SAMPLES") == 0 )
73 if ( strcmp(what,
"NR_DREAM") == 0 )
78 if ( strcmp(what,
"PEDSUBTRACTED") == 0 )
83 if ( strcmp(what,
"COMMONNOISE") == 0 )
88 if ( strcmp(what,
"ZEROSUPPRESSED") == 0 )
103 if ( dreamchip < 0 || dreamchip > 7)
return 0;
109 if ( strcmp(what,
"DREAM_ENABLED") == 0 )
137 int dreamchip = channel/64;
143 if ( dreamchip < 0 || dreamchip >=8 )
return 0;
144 if ( sample < 0 || sample > 254)
return 0;
146 return fd->
samples[dreamchip][ch][sample];
157 os <<
"Nr of FEUs: " << setw(4) <<
iValue(0,
"NR_FEU") <<endl;
158 for ( i = 0; i <
iValue(0,
"NR_FEU"); i++)
160 int id =
iValue(i,
"FEU_ID");
161 os <<
"FEU_ID: " << setw(4) << i << setw(4) <<
id << endl;
162 os <<
" DreamChips: " << setw(4) <<
iValue(
id,
"NR_DREAM") <<
" enabled: ";
163 for (
int dream = 0; dream < 8; dream++)
165 if (
iValue(
id, dream,
"DREAM_ENABLED") )
175 os <<
" Nr of samples: " << setw(4) <<
iValue(
id,
"SAMPLES") <<endl;
176 os <<
" Pedestal subtracted " << setw(4) <<
iValue(
id,
"PEDSUBTRACTED") <<endl;
177 os <<
" Zero suppressed " << setw(4) <<
iValue(
id,
"ZEROSUPPRESSED") <<endl;
178 os <<
" Common Noise supp. " << setw(4) <<
iValue(
id,
"COMMONNOISE") <<endl;
181 for (
int dream = 0; dream < 8; dream++)
183 if (
iValue(
id,dream,
"DREAM_ENABLED") )
185 os <<
" ---- Dream chip " << dream <<
" ---- " << endl;
206 for (
int sample = 0; sample <
iValue(
id,
"SAMPLES"); sample ++)
208 os << setw(4) << sample <<
" |";
242 int array_position = 0;
245 if ( d[
i] == 0xaabb && d[
i+1] == 0xccdd )
247 int len = ntohs(d[
i+3]) /2;
250 for (
int k = 0;
k < len;
k++)
258 int arraylength = array_position;
261 if (status) cerr << __FILE__ <<
" " << __LINE__ <<
" error status from decode_payload " << status << endl;
273 int nwpacket_index = 0;
277 int dream_data_length = 0;
285 int old_eventid = -1;
290 while ( nwpacket_index + 4 < size)
293 feu_index = nwpacket_index;
296 while ( d[feu_index] == 0 ) feu_index++;
300 if ( (d[index] & 0x7000) == 0x6000)
302 feu_id = d[
index] & 0xff;
315 memset (fd->
samples, 0, 8*64*255*
sizeof(
int) );
316 memset (fd->
cellids, 0, 8*64*
sizeof(
unsigned long long) );
330 if ( (d[index] & 0x7000) == 0x6000)
332 event_id = d[
index] & 0xfff;
333 if ( old_eventid < 0)
335 old_eventid = event_id;
339 if (old_eventid != event_id) cerr << __FILE__ <<
" " << __LINE__ <<
" feu eventid= " << event_id <<
" others " << old_eventid << endl;
344 if ( (d[index] & 0x7000) == 0x6000)
346 time_stamp = d[
index] & 0xfff;
350 if ( (d[index] & 0x7000) == 0x6000)
352 sample_id = ( d[
index]>> 3) & 0x1ff;
354 fine_tstp = ( d[
index]) & 0x7;
358 time_stamp = ( time_stamp<<3) | fine_tstp;
360 index = feu_index+4 ;
361 if ( (d[index] & 0x6000) == 0x6000 )
374 int done_with_this_feu = 0;
379 while( ( d[index] & 0x6000) != 0x6000 )
381 dream_id = ( d[
index] >> 6 ) & 0x7;
382 int channel_id = d[
index] & 0x3f;
383 int channel_value = d[index+1] & 0xfff;
390 fd->
samples[dream_id][channel_id][sample_id] = channel_value;
399 nwpacket_index = dream_index =
index;
405 while( ! done_with_this_feu)
411 if ( ( d[dream_index + 68 ] & 0x6000) == 0x4000 )
413 dream_id = (d[dream_index+3] >> 9) & 0x7;
414 int trailer_dream_id = (d[dream_index+73] >> 9) & 0x7;
417 if ( dream_id == trailer_dream_id )
419 dream_data_length = 74;
430 decode_dream( fd, &d[dream_index], dream_data_length, sample_id);
432 dream_index += dream_data_length;
438 nwpacket_index = dream_index + 2;
440 done_with_this_feu = 1;
450 unsigned long long cell_id;
451 unsigned long long trigger_id;
453 unsigned int dream_id;
456 dream_id = (d[3] >> 9) & 0x7;
458 if ( dream_id >=8)
return -1;
459 if ( sample_nr >= 254 )
return -2;
461 trigger_id = (d[0] & 0xfff) << 24;
462 trigger_id |= (d[1] & 0xfff) << 12;
463 trigger_id |= (d[2] & 0xfff);
465 cell_id = (d[70] & 0xfff) << 24;
466 cell_id |= (d[71] & 0xfff) << 12;
467 cell_id |= (d[72] & 0xfff);
470 fd->
cellids [dream_id][sample_nr] = cell_id;
473 for (
int i = 0;
i < 64;
i++)
475 fd->
samples[dream_id][
i][sample_nr] = d[4+
i] & 0xfff;