Belle II Software  release-06-02-00
dump_header.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <stdio.h>
10 #include <unistd.h>
11 
12 using namespace std;
13 
14 enum {
15  POS_NWORDS = 0,
16  POS_HDR_NWORDS = 1,
17  POS_NUM_EVE_NUM_NODES = 2,
18  POS_EXP_RUN_NUM = 3,
19  POS_EVE_NUM = 4,
20  POS_NODE_ID = 5
21 };
22 
23 enum {
24  EXP_MASK = 0xFFC00000,
25  EXP_SHIFT = 22,
26  RUNNO_MASK = 0x003FFF00,
27  RUNNO_SHIFT = 8,
28  SUBRUNNO_MASK = 0x000000FF
29 };
30 
31 
32 
33 int main(int argc, char** argv)
34 {
35  unsigned int buf[400000];
36  int infn = fileno(stdin);
37  printf("infn = %d\n", infn);
38 
39  int nrec = 0;
40  for (;;) {
41  int is = read(infn, &buf[0], 4);
42  // printf ( "buf[0] = %d\n", buf[0] );
43  if (is <= 0) break;
44  is = read(infn, &buf[1], (buf[0] - 1) * 4);
45  // printf ( "nw = %d, 1st = %d, 2nd = %d, 3rd = %d\n",
46  // buf[0], buf[1], buf[2], buf[3] );
47  // printf ( "exprunnum = %8.8x, evtnum = %8.8x\n", buf[POS_EXP_RUN_NUM],
48  // buf[POS_EVE_NUM] );
49  int exp = (buf[ POS_EXP_RUN_NUM ] & EXP_MASK) >> EXP_SHIFT;
50  int run = (buf[ POS_EXP_RUN_NUM ] & RUNNO_MASK) >> RUNNO_SHIFT;
51  int evt = buf[ POS_EVE_NUM ];
52 
53  printf("Nrec:%d ; Nw:%d ; Exp:%d, Run:%d, Evt:%d\n",
54  nrec, buf[0], exp, run, evt);
55  nrec++;
56  }
57 
58 }
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:75