Belle II Software  release-08-01-10
eventsampler.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 <cstring>
10 #include <string>
11 #include <vector>
12 
13 #include <stdio.h>
14 #include <stdlib.h>
15 
16 #include "daq/expreco/EventSampler.h"
17 #include "daq/rfarm/manager/RFConf.h"
18 
19 using namespace Belle2;
20 using namespace std;
21 
22 int main(int argc, char** argv)
23 {
24  // Retrieve RingBuffer name[1], port number[2], Shmname[3], and id[4]
25  if (argc < 2) {
26  printf("syntax : eventsampler configfile\n");
27  exit(-1);
28  }
29 
30  RFConf* conf = new RFConf(argv[1]);
31 
32  int nnodes = 0;
33  int maxnodes = conf->getconfi("processor", "nnodes");
34  int idbase = conf->getconfi("processor", "idbase");
35  char* hostbase = conf->getconf("processor", "ctlhostbase");
36  char* badlist = conf->getconf("processor", "badlist");
37 
38  vector<string> nodelist;
39  char hostname[512], idname[3], shmid[3];
40  for (int i = 0; i < maxnodes; i++) {
41  sprintf(idname, "%2.2d", idbase + i);
42  sprintf(shmid, "%2.2d", i);
43  if (badlist == NULL ||
44  strstr(badlist, idname) == 0) {
45  sprintf(hostname, "%s%2.2d", hostbase, idbase + i);
46  nodelist.push_back(string(hostname));
47  nnodes++;
48  }
49  }
50 
51  int port = conf->getconfi("processor", "eventserver", "port");
52 
53  char* rbuf = conf->getconf("eventsampler", "ringbufout");
54  int interval = conf->getconfi("eventsampler", "interval");
55 
56  EventSampler es(nodelist, port, rbuf, interval);
57 
58  es.server();
59 }
60 
61 
62 
Abstract base class for different kinds of events.
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:91