Belle II Software
release-08-01-10
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
x
z
Typedefs
a
b
c
d
e
g
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
e
f
g
n
p
s
v
z
Enumerator
c
d
f
p
t
u
v
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
Typedefs
Macros
dump_sendheader.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
#include <stdlib.h>
12
#include <time.h>
13
#include <sys/time.h>
14
#include <vector>
15
16
enum
{
17
POS_NWORDS = 0,
18
POS_HDR_NWORDS = 1,
19
POS_NUM_EVE_NUM_NODES = 2,
20
POS_EXP_RUN_NUM = 3,
21
POS_EVE_NUM = 4,
22
POS_NODE_ID = 5
23
};
24
25
26
using namespace
std;
27
28
char
* timestamp()
29
{
30
struct
timeval tb;
31
struct
tm* tp;
32
static
char
buf[256];
33
// struct tm result;
34
gettimeofday(&tb, NULL);
35
tp = localtime(&tb.tv_sec);
36
sprintf(buf,
"%02d:%02d:%02d.%03d "
,
37
tp->tm_hour, tp->tm_min, tp->tm_sec, (
int
)(tb.tv_usec / 1000));
38
// printf ( " buf = %s\n", buf );
39
return
buf;
40
}
41
42
43
44
int
main
()
45
{
46
vector<unsigned int> buf(4000000);
47
int
infn = fileno(stdin);
48
printf(
"infn = %d\n"
, infn);
49
50
int
nrec = 0;
51
for
(;;) {
52
int
is = read(infn, &buf[0], 4);
53
// int nw = ntohl(buf[0]);
54
int
nw = buf[0];
55
if
(is <= 0)
break
;
56
printf(
"nw = %d (%8.8x)\n"
, nw, nw);
57
is = read(infn, &buf[1], (nw - 1) * 4);
58
if
(is <= 0) {
59
perror(
"Error to read input"
);
60
exit(-1);
61
}
62
printf(
"buf[0] =%8.8x, buf[1] = %8.8x, buf[nw-1] = %8.8x\n"
,
63
buf[0], buf[1], buf[nw - 1]);
64
// if ( abs(nw)> 1000 ) continue;
65
// for ( int j=0;j<8; j++ ) {
66
// printf ( "%8.8x ", buf[j] );
67
// }
68
// printf ( "\n" );
69
// printf ( "nw = %d, 1st = %d, 2nd = %d, 3rd = %d\n",
70
// ntohl(buf[5]), ntohl(buf[6]), ntohl(buf[7]), ntohl(buf[8]) );
71
// int exp = (ntohl(buf[ OFFSET_RUNNR ]) & EXP_MASK) >> EXP_SHIFT;
72
// int run = (ntohl(buf[ OFFSET_RUNNR ]) & RUNNO_MASK) >> RUNNO_SHIFT;
73
// int evt = ntohl(buf[ OFFSET_TRIGNR ]);
74
// int rois = ntohl(buf[ OFFSET_ROIS] );
75
76
// printf("%s Nrec: %d ; Nw: %d ; Exp: %d, Run: %d, Evt: %d\n",
77
// timestamp(), nrec, nw, exp, run, evt );
78
nrec++;
79
80
}
81
82
}
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:91
daq
rfarm
event
tools
dump_sendheader.cc
Generated on Mon Sep 23 2024 14:01:15 for Belle II Software by
1.9.1