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
rb2rb.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 <string>
10
11
#include <stdio.h>
12
#include <stdlib.h>
13
#include <unistd.h>
14
15
#include "framework/pcore/RingBuffer.h"
16
#include "framework/pcore/EvtMessage.h"
17
18
#define RBUFSIZE 100000000
19
#define MAXEVTSIZE 400000000
20
21
using namespace
Belle2
;
22
using namespace
std;
23
24
int
main
(
int
argc,
char
** argv)
25
{
26
if
(argc < 3) {
27
printf(
"file2rb : inrbufname outrbufname\n"
);
28
exit(-1);
29
}
30
31
// RingBuffer* rbufin = new RingBuffer(argv[1], RBUFSIZE);
32
RingBuffer
* rbufin =
new
RingBuffer
(argv[1]);
33
// RingBuffer* rbufout = new RingBuffer(argv[2], RBUFSIZE);
34
RingBuffer
* rbufout =
new
RingBuffer
(argv[2]);
35
char
* evbuf =
new
char
[MAXEVTSIZE];
36
37
int
eof = 0;
38
while
(eof == 0) {
39
// Get a record from ringbuf
40
int
bsize;
41
while
((bsize = rbufin->
remq
((
int
*)evbuf)) == 0) {
42
// printf ( "Rx : evtbuf is not available yet....\n" );
43
// usleep(100);
44
usleep(20);
45
}
46
EvtMessage
* msg =
new
EvtMessage
(evbuf);
47
if
(msg->
type
() == MSG_TERMINATE) {
48
printf(
"EoF found. Exitting.....\n"
);
49
eof = 1;
50
}
51
52
// Put the message in ring buffer
53
for
(;;) {
54
int
irb = rbufout->
insq
((
int
*)evbuf, bsize);
55
if
(irb >= 0)
break
;
56
// usleep(100);
57
usleep(20);
58
}
59
}
60
}
61
62
63
64
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::insq
int insq(const int *buf, int size, bool checkTx=false)
Append a buffer to the RingBuffer.
Definition:
RingBuffer.cc:189
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
rb2rb.cc
Generated on Fri Aug 9 2024 00:50:16 for Belle II Software by
1.9.1