31 if (status || olength<=0 )
return NULL;
35 for (i =0; i<olength; i++) *k++ = temp[i];
43 COUT<<
"Failed to fill data structure"<<std::endl;
84 COUT<<
"Failed to fill data structure"<<std::endl;
88 if (!strcmp(what,
"HEADER"))
94 else if (!strcmp(what,
"EVNUMBER"))
99 else if (!strcmp(what,
"MODEBIT"))
104 else if (!strcmp(what,
"CLOCK"))
109 else if (!strcmp(what,
"SCALER"))
128 COUT<<
"Failed to fill data structure"<<std::endl;
131 if (!strcmp(what,
"CLOCK"))
136 destination[i]=
sgl1p[i/4].clock[i%4];
138 else if (!strcmp(what,
"SCALER"))
143 destination[i]=
sgl1p[i/4].scaler[i%4];
145 else if (!strcmp(what,
"HEADER"))
150 destination[i]=
sgl1p[i].header;
152 else if (!strcmp(what,
"EVNUMBER"))
157 destination[i]=
sgl1p[i].ev_number;
159 else if (!strcmp(what,
"MODEBIT"))
164 destination[i]=
sgl1p[i].modebit;
181 os<<
"Failed to fill sgl1p. Exit"<<std::endl;
185 for(m=0;m<54;m++) os<<
"=";
187 os <<
"GL1P data packet: ";
188 os <<
"Detected " << std::dec <<
nGL1Pboards <<
" GL1-1P boards in the data packet." <<std::endl;
190 for(m=0;m<54;m++) os<<
"-";
192 os <<std::dec<<
"GL1P["<<i<<
"] header word = 0x" << std::hex <<
SETW(4) << (
unsigned int)
sgl1p[i].header << std::endl;
193 os <<std::dec<<
"Event = " <<
SETW(4)<<(
unsigned int)
sgl1p[i].ev_number<<std::endl;
194 os <<
"Modebit = 0x" << std::hex <<
SETW(3) <<
sgl1p[i].
modebit << std::endl;
195 os <<
"Beam Cross. Counters: ";
197 os <<std::dec<<
SETW(12)<<(
unsigned int)
sgl1p[i].clock[j];
204 for(m=0;m<54;m++) os<<
"-";
216 os << std::endl << std::dec <<
SETW(5) << j <<
" | ";
219 os << std::hex <<
SETW(8) << k[j++] <<
" ";
220 if (j>=dlength)
break;
222 if (j>=dlength)
break;
225 for(m=0;m<54;m++) os<<
"=";
226 os << std::dec << std::endl;
232 int sclk[]={1,0,3,2};
247 COUT<<
"can't allocate memory for GL1P_DATA structure "<<std::endl;
260 unsigned int j,
idx, idy;
261 unsigned char bclock;
266 sgl1p[i].
header = (
unsigned char)((buf[idx]>>8)&0xFF);
268 sgl1p[i].
modebit = (
unsigned short)((buf[idx]>>16)&0x1FF);
272 bclock = (
unsigned char)((buf[idx+1]>>idy)&0x7F);
273 sgl1p[i].
clock[sclk[j]] =(bclock&0xF) + ((bclock>>4)&0x7)*15;
274 sgl1p[i].
scaler[j] = ((buf[idx+2+j]&0xFFFF)<<16) + ((buf[idx+2+j]>>16)&0xFFFF);