Belle II Software
development
rawrb2sockr.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 <signal.h>
11
12
#include "daq/rfarm/event/RawRevRb2Sock.h"
13
14
using namespace
Belle2
;
15
using namespace
std
;
16
17
static
RawRevRb2Sock
* s_body = NULL;
18
19
void
sigint_handler(
int
/*signum*/
)
20
{
21
printf(
"rawrb2sockr : aborted\n"
);
22
delete
s_body;
23
exit(-1);
24
}
25
26
27
int
main(
int
argc,
char
** argv)
28
{
29
// Retrieve RingBuffer name[1], port number[2], Shmname[3], and id[4]
30
if
(argc < 5) {
31
printf(
"syntax : rb2sock rbufname port\n"
);
32
exit(-1);
33
}
34
35
signal(SIGINT, sigint_handler);
36
signal(SIGTERM, sigint_handler);
37
38
string
a1(argv[1]);
39
int
a2 = atoi(argv[2]);
40
string
a3(argv[3]);
41
int
a4 = atoi(argv[4]);
42
43
RawRevRb2Sock
* rs =
new
RawRevRb2Sock
(a1, a2, a3, a4);
44
// RawRevRb2Sock rs(a1, a2, a3, a4);
45
s_body = rs;
46
47
int
nevt = 0;
48
for
(;;) {
49
// int stat = rs.SendEvent();
50
int
stat = rs->
SendEvent
();
51
// printf ( "rb2sock : sending %d\n", stat );
52
if
(stat <= 0) {
53
printf(
"rb2sock : error in sending event. The event is lost. Reconnecting....\n"
);
54
// rs.Reconnect();
55
rs->
Reconnect
();
56
printf(
"rb2sock : reconnected.\n"
);
57
}
58
nevt++;
59
if
(nevt % 5000 == 0) {
60
printf(
"rawrb2sockr : evt = %d\n"
, nevt);
61
}
62
}
63
exit(0);
64
}
65
66
67
Belle2::RawRevRb2Sock
Definition:
RawRevRb2Sock.h:35
Belle2::RawRevRb2Sock::SendEvent
int SendEvent(void)
Event function.
Definition:
RawRevRb2Sock.cc:31
Belle2::RawRevRb2Sock::Reconnect
int Reconnect(void)
Reconnect.
Definition:
RawRevRb2Sock.cc:47
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:17
std
STL namespace.
daq
rfarm
event
tools
rawrb2sockr.cc
Generated on Fri Nov 8 2024 02:35:26 for Belle II Software by
1.9.6