Belle II Software
release-08-00-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
readrb.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
#include <string>
9
10
#include <stdio.h>
11
#include <stdlib.h>
12
#include <unistd.h>
13
14
#include "framework/pcore/RingBuffer.h"
15
#include "framework/pcore/EvtMessage.h"
16
17
#define RBUFSIZE 100000000
18
#define MAXEVTSIZE 400000000
19
20
using namespace
Belle2
;
21
using namespace
std;
22
23
int
main
(
int
argc,
char
** argv)
24
{
25
if
(argc < 3) {
26
printf(
"file2rb : rbufname sleeptime(us)\n"
);
27
exit(-1);
28
}
29
30
RingBuffer
* rbuf =
new
RingBuffer
(argv[1]);
31
char
* evbuf =
new
char
[MAXEVTSIZE];
32
33
int
sltime = atoi(argv[2]);
34
35
int
nevt = 0;
36
for
(;;) {
37
// Get a record from ringbuf
38
int
size;
39
while
((size = rbuf->
remq
((
int
*)evbuf)) == 0) {
40
// printf ( "Rx : evtbuf is not available yet....\n" );
41
// usleep(100);
42
usleep(20);
43
}
44
if
(size < 0) exit(-1);
45
EvtMessage
* msg =
new
EvtMessage
(evbuf);
46
if
(msg->
type
() == MSG_TERMINATE) {
47
printf(
"EoF found. Exitting.....\n"
);
48
}
49
nevt++;
50
if
(nevt % 1000 == 0) printf(
"readrb : event = %d (size=%d)\n"
, nevt, *((
int
*)evbuf));
51
usleep(sltime);
52
}
53
}
54
55
56
57
Belle2::EvtMessage
Class to manage streamed object.
Definition:
EvtMessage.h:59
Belle2::EvtMessage::type
ERecordType type() const
Get record type.
Definition:
EvtMessage.cc:114
Belle2::RingBuffer
Class to manage a Ring Buffer placed in an IPC shared memory.
Definition:
RingBuffer.h:39
Belle2::RingBuffer::remq
int remq(int *buf)
Pick up a buffer from the RingBuffer.
Definition:
RingBuffer.cc:308
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:17
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:91
daq
rfarm
event
tools
readrb.cc
Generated on Fri Aug 9 2024 00:50:16 for Belle II Software by
1.9.1