Belle II Software  release-06-01-15
rf_eventprocessor.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 //#define DESY
10 
11 #include "daq/rfarm/manager/RFEventProcessor.h"
12 #include "daq/rfarm/manager/RFNSM.h"
13 
14 #include <unistd.h>
15 
16 #include <csignal>
17 #include <cstring>
18 
19 using namespace std;
20 using namespace Belle2;
21 
22 static RFEventProcessor* evproc = NULL;
23 
24 extern "C" void sighandler(int sig)
25 {
26  printf("SIGTERM handler here\n");
27  evproc->cleanup();
28 }
29 
30 int main(int argc, char** argv)
31 {
32  RFConf conf(argv[1]);
33 
34  // RFEventProcessor* evproc = new RFEventProcessor(argv[1]);
35  evproc = new RFEventProcessor(argv[1]);
36 
37  char nodename[256];
38  strcpy(nodename, "evp_");
39 #ifndef DESY
40  gethostname(&nodename[4], sizeof(nodename));
41 #else
42  // Special treatment for DESY test nodes!!
43  char hostnamebuf[256];
44  gethostname(hostnamebuf, sizeof(hostnamebuf));
45  strcat(&nodename[4], &hostnamebuf[6]);
46  int lend = strlen(nodename);
47  nodename[lend + 1] = (char)0;
48  nodename[lend] = nodename[lend - 1];
49  strncpy(&nodename[lend - 1], "0", 1);
50  printf("DESY node name = %s\n", nodename);
51  // End of DESY special treatment
52 #endif
53 
54  signal(SIGINT, sighandler);
55  signal(SIGTERM, sighandler);
56 
57  RFNSM nsm(nodename, evproc);
58  nsm.AllocMem(conf.getconf("system", "nsmdata"));
59  evproc->SetNodeInfo(nsm.GetNodeInfo());
60 
61  evproc->server();
62 
63 }
Abstract base class for different kinds of events.
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:75