17enum { OFFSET_LENGTH = 0, OFFSET_HEADER = 1, OFFSET_TRIGNR = 2, OFFSET_RUNNR = 3, OFFSET_ROIS = 4};
19 EXP_MASK = 0xFFC00000,
21 RUNNO_MASK = 0x003FFF00,
23 SUBRUNNO_MASK = 0x000000FF
35 gettimeofday(&tb, NULL);
36 tp = localtime(&tb.tv_sec);
37 sprintf(buf,
"%02d:%02d:%02d.%03d ",
38 tp->tm_hour, tp->tm_min, tp->tm_sec, (
int)(tb.tv_usec / 1000));
45int main(
int ,
char** )
47 vector<unsigned int> buf(400000);
48 int infn = fileno(stdin);
49 printf(
"infn = %d\n", infn);
53 int is = read(infn, &buf[0], 4);
54 int nw = ntohl(buf[0]);
56 is = read(infn, &buf[1], (nw - 1) * 4);
65 int exp = (ntohl(buf[ OFFSET_RUNNR ]) & EXP_MASK) >> EXP_SHIFT;
66 int run = (ntohl(buf[ OFFSET_RUNNR ]) & RUNNO_MASK) >> RUNNO_SHIFT;
67 int evt = ntohl(buf[ OFFSET_TRIGNR ]);
70 printf(
"%s Nrec: %d ; Nw: %d ; Exp: %d, Run: %d, Evt: %d\n",
71 timestamp(), nrec, nw, exp, run, evt);